diff --git a/unauthenticated/js/bundle.min.js b/unauthenticated/js/bundle.min.js index 7f3a64aff..d636b2ae0 100644 --- a/unauthenticated/js/bundle.min.js +++ b/unauthenticated/js/bundle.min.js @@ -104,11 +104,11 @@ if(typeof jQuery==="undefined"){throw new Error("Bootstrap's JavaScript requires */ (function(e){"use strict";if(typeof define==="function"&&define.amd){define(["jquery"],e)}else if(typeof exports==="object"&&typeof require==="function"){e(require("jquery"))}else{e(jQuery)}})(function(e){"use strict";var t=function(){return{escapeRegExChars:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(e){var t=document.createElement("div");t.className=e;t.style.position="absolute";t.style.display="none";return t}}}(),n={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40};function i(t,n){var s=e.noop,o=this,r={ajaxSettings:{},autoSelectFirst:false,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},externalEvent:i.externalEvent,formatResult:i.formatResult,formatGroup:i.formatGroup,delimiter:null,zIndex:11001,type:"GET",noCache:false,onSearchStart:s,onSearchComplete:s,onSearchError:s,preserveInput:false,containerClass:"autocomplete-suggestions",tabDisabled:false,dataType:"text",currentRequest:null,triggerSelectOnValidInput:true,preventBadQueries:true,lookupFilter:function(e,t,n){return e.value.toLowerCase().indexOf(n)!==-1},paramName:"query",transformResult:function(t){return typeof t==="string"?e.parseJSON(t):t},showNoSuggestionNotice:false,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:false};o.element=t;o.el=e(t);o.suggestions=[];o.badQueries=[];o.selectedIndex=-1;o.currentValue=o.element.value;o.intervalId=0;o.cachedResponse={};o.onChangeInterval=null;o.onChange=null;o.isLocal=false;o.suggestionsContainer=null;o.noSuggestionsContainer=null;o.options=e.extend({},r,n);o.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"};o.hint=null;o.hintValue="";o.selection=null;o.initialize();o.setOptions(n)}i.utils=t;e.Autocomplete=i;i.formatResult=function(e,n){if(!n){return e.value}var i="("+t.escapeRegExChars(n)+")";return e.value.replace(new RegExp(i,"gi"),"$1").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/<(\/?strong)>/g,"<$1>").replace(/<(\/?x-hidden)>/g,"<$1>")};i.formatGroup=function(e,t){return'
'+t+"
"};i.prototype={killerFn:null,initialize:function(){var t=this,n="."+t.classes.suggestion,s=t.classes.selected,o=t.options,r;t.element.setAttribute("autocomplete","off");t.killerFn=function(n){if(!e(n.target).closest("."+t.options.containerClass).length){t.killSuggestions();t.disableKillerFn()}};t.noSuggestionsContainer=e('
').html(this.options.noSuggestionNotice).get(0);t.suggestionsContainer=i.utils.createNode(o.containerClass);r=e(t.suggestionsContainer);r.appendTo(o.appendTo);if(o.width!=="auto"){r.css("width",o.width)}r.on("mouseover.autocomplete",n,function(){t.activate(e(this).data("index"))});r.on("mouseout.autocomplete",function(){t.selectedIndex=-1;r.children("."+s).removeClass(s)});r.on("click.autocomplete",n,function(){t.select(e(this).data("index"));return false});t.fixPositionCapture=function(){if(t.visible){t.fixPosition()}};e(window).on("resize.autocomplete",t.fixPositionCapture);t.el.on("keydown.autocomplete",function(e){t.onKeyPress(e)});t.el.on("keyup.autocomplete",function(e){t.onKeyUp(e)});t.el.on("blur.autocomplete",function(){t.onBlur()});t.el.on("focus.autocomplete",function(){t.onFocus()});t.el.on("change.autocomplete",function(e){t.onKeyUp(e)});t.el.on("input.autocomplete",function(e){t.onKeyUp(e)})},onFocus:function(){var e=this;e.fixPosition();if(e.el.val().length>=e.options.minChars){e.onValueChange()}},onBlur:function(){this.enableKillerFn()},abortAjax:function(){var e=this;if(e.currentRequest){e.currentRequest.abort();e.currentRequest=null}},setOptions:function(t){var n=this,i=n.options;e.extend(i,t);n.isLocal=e.isArray(i.lookup);if(n.isLocal){i.lookup=n.verifySuggestionsFormat(i.lookup)}i.orientation=n.validateOrientation(i.orientation,"bottom");e(n.suggestionsContainer).css({"max-height":i.maxHeight+"px",width:i.width+"px","z-index":i.zIndex})},clearCache:function(){this.cachedResponse={};this.badQueries=[]},clear:function(){this.clearCache();this.currentValue="";this.suggestions=[]},disable:function(){var e=this;e.disabled=true;clearInterval(e.onChangeInterval);e.abortAjax()},enable:function(){this.disabled=false},fixPosition:function(){var t=this,n=e(t.suggestionsContainer),i=n.parent().get(0);if(i!==document.body&&!t.options.forceFixPosition){return}var s=t.options.orientation,o=n.outerHeight(),r=t.el.outerHeight(),a=t.el.offset(),l={top:a.top,left:a.left};if(s==="auto"){var u=e(window).height(),c=e(window).scrollTop(),g=-c+a.top-o,f=c+u-(a.top+r+o);s=Math.max(g,f)===g?"top":"bottom"}if(s==="top"){l.top+=-o}else{l.top+=r}if(i!==document.body){var d=n.css("opacity"),p;if(!t.visible){n.css("opacity",0).show()}p=n.offsetParent().offset();l.top-=p.top;l.left-=p.left;if(!t.visible){n.css("opacity",d).hide()}}if(t.options.width==="auto"){l.width=t.el.outerWidth()+"px"}n.css(l)},enableKillerFn:function(){var t=this;e(document).on("click.autocomplete",t.killerFn)},disableKillerFn:function(){var t=this;e(document).off("click.autocomplete",t.killerFn)},killSuggestions:function(){var e=this;e.stopKillSuggestions();e.intervalId=window.setInterval(function(){if(e.visible){if(!e.options.preserveInput){e.el.val(e.currentValue)}e.hide()}e.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var e=this,t=e.el.val().length,n=e.element.selectionStart,i;if(typeof n==="number"){return n===t}if(document.selection){i=document.selection.createRange();i.moveStart("character",-t);return t===i.text.length}return true},onKeyPress:function(e){var t=this;if(!t.disabled&&!t.visible&&e.which===n.DOWN&&t.currentValue){t.suggest();return}if(t.disabled||!t.visible){return}i.externalEvent=e;switch(e.which){case n.ESC:t.el.val(t.currentValue);t.hide();break;case n.RIGHT:if(t.hint&&t.options.onHint&&t.isCursorAtEnd()){t.selectHint();break}return;case n.TAB:if(t.hint&&t.options.onHint){t.selectHint();return}if(t.selectedIndex===-1){t.hide();return}t.select(t.selectedIndex);if(t.options.tabDisabled===false){return}break;case n.RETURN:if(t.selectedIndex===-1){t.hide();return}t.select(t.selectedIndex);break;case n.UP:t.moveUp();break;case n.DOWN:t.moveDown();break;default:return}e.stopImmediatePropagation();e.preventDefault()},onKeyUp:function(e){var t=this;if(t.disabled){return}switch(e.which){case n.UP:case n.DOWN:return}clearInterval(t.onChangeInterval);if(t.currentValue!==t.el.val()){t.findBestHint();if(t.options.deferRequestBy>0){t.onChangeInterval=setInterval(function(){t.onValueChange()},t.options.deferRequestBy)}else{t.onValueChange()}}},onValueChange:function(){var t=this,n=t.options,i=t.el.val(),s=t.getQuery(i);if(t.selection&&t.currentValue!==s){t.selection=null;(n.onInvalidateSelection||e.noop).call(t.element)}clearInterval(t.onChangeInterval);t.currentValue=i;t.selectedIndex=-1;if(n.triggerSelectOnValidInput&&t.isExactMatch(s)){t.select(0);return}if(s.lengthr){a.suggestions=a.suggestions.slice(0,r)}return a},getSuggestions:function(t){var n,i=this,s=i.options,o=s.serviceUrl,r,a,l;s.params[s.paramName]=t;r=s.ignoreParams?null:s.params;if(s.onSearchStart.call(i.element,s.params)===false){return}if(e.isFunction(s.lookup)){s.lookup(t,function(e){i.suggestions=e.suggestions;i.suggest();s.onSearchComplete.call(i.element,t,e.suggestions)});return}if(i.isLocal){n=i.getSuggestionsLocal(t)}else{if(e.isFunction(o)){o=o.call(i.element,t)}a=o+"?"+e.param(r||{});n=i.cachedResponse[a]}if(n&&e.isArray(n.suggestions)){i.suggestions=n.suggestions;i.suggest();s.onSearchComplete.call(i.element,t,n.suggestions)}else if(!i.isBadQuery(t)){i.abortAjax();l={url:o,data:r,type:s.type,dataType:s.dataType};e.extend(l,s.ajaxSettings);i.currentRequest=e.ajax(l).done(function(e){var n;i.currentRequest=null;n=s.transformResult(e,t);i.processResponse(n,t,a);s.onSearchComplete.call(i.element,t,n.suggestions)}).fail(function(e,n,o){s.onSearchError.call(i.element,t,e,n,o)})}else{s.onSearchComplete.call(i.element,t,[])}},isBadQuery:function(e){if(!this.options.preventBadQueries){return false}var t=this.badQueries,n=t.length;while(n--){if(e.indexOf(t[n])===0){return true}}return false},hide:function(){var t=this,n=e(t.suggestionsContainer);if(e.isFunction(t.options.onHide)&&t.visible){t.options.onHide.call(t.element,n)}t.visible=false;t.selectedIndex=-1;clearInterval(t.onChangeInterval);e(t.suggestionsContainer).hide();t.signalHint(null)},suggest:function(){if(!this.suggestions.length){if(this.options.showNoSuggestionNotice){this.noSuggestions()}else{this.hide()}return}var t=this,n=t.options,i=n.groupBy,s=n.formatResult,o=t.getQuery(t.currentValue),r=t.classes.suggestion,a=t.classes.selected,l=e(t.suggestionsContainer),u=e(t.noSuggestionsContainer),c=n.beforeRender,g="",f,d=function(e,t){var s=e.data[i];if(f===s){return""}f=s;return n.formatGroup(e,f)};if(n.triggerSelectOnValidInput&&t.isExactMatch(o)){t.select(0);return}e.each(t.suggestions,function(e,t){if(i){g+=d(t,o,e)}t.value=t.value.replace(/((.*?)<\/x-hidden>)/g,"[[$2]]");g+='
'+s(t,o,e)+"
"});this.adjustContainerWidth();u.detach();g=g.replace(/\[\[.*?\]\]/g,"");l.html(g);if(e.isFunction(c)){c.call(t.element,l,t.suggestions)}t.fixPosition();l.show();if(n.autoSelectFirst){t.selectedIndex=0;l.scrollTop(0);l.children("."+r).first().addClass(a)}t.visible=true;t.findBestHint()},noSuggestions:function(){var t=this,n=e(t.suggestionsContainer),i=e(t.noSuggestionsContainer);this.adjustContainerWidth();i.detach();n.empty();n.append(i);t.fixPosition();n.show();t.visible=true},adjustContainerWidth:function(){var t=this,n=t.options,i,s=e(t.suggestionsContainer);if(n.width==="auto"){i=t.el.outerWidth();s.css("width",i>0?i:300)}else if(n.width==="flex"){s.css("width","")}},findBestHint:function(){var t=this,n=t.el.val().toLowerCase(),i=null;if(!n){return}e.each(t.suggestions,function(e,t){var s=t.value.toLowerCase().indexOf(n)===0;if(s){i=t}return!s});t.signalHint(i)},signalHint:function(t){var n="",i=this;if(t){n=i.currentValue+t.value.substr(i.currentValue.length)}if(i.hintValue!==n){i.hintValue=n;i.hint=t;(this.options.onHint||e.noop)(n)}},verifySuggestionsFormat:function(t){if(t.length&&typeof t[0]==="string"){return e.map(t,function(e){return{value:e,data:null}})}return t},validateOrientation:function(t,n){t=e.trim(t||"").toLowerCase();if(e.inArray(t,["auto","bottom","top"])===-1){t=n}return t},processResponse:function(e,t,n){var i=this,s=i.options;e.suggestions=i.verifySuggestionsFormat(e.suggestions);if(!s.noCache){i.cachedResponse[n]=e;if(s.preventBadQueries&&!e.suggestions.length){i.badQueries.push(t)}}if(t!==i.getQuery(i.currentValue)){return}i.suggestions=e.suggestions;i.suggest()},activate:function(t){var n=this,i,s=n.classes.selected,o=e(n.suggestionsContainer),r=o.find("."+n.classes.suggestion);o.find("."+s).removeClass(s);n.selectedIndex=t;if(n.selectedIndex!==-1&&r.length>n.selectedIndex){i=r.get(n.selectedIndex);e(i).addClass(s);return i}return null},selectHint:function(){var t=this,n=e.inArray(t.hint,t.suggestions);t.select(n)},select:function(e){var t=this;t.hide();t.onSelect(e);t.disableKillerFn()},moveUp:function(){var t=this;if(t.selectedIndex===-1){return}if(t.selectedIndex===0){e(t.suggestionsContainer).children().first().removeClass(t.classes.selected);t.selectedIndex=-1;t.el.val(t.currentValue);t.findBestHint();return}t.adjustScroll(t.selectedIndex-1)},moveDown:function(){var e=this;if(e.selectedIndex===e.suggestions.length-1){return}e.adjustScroll(e.selectedIndex+1)},adjustScroll:function(t){var n=this,i=n.activate(t);if(!i){return}var s,o,r,a=e(i).outerHeight();s=i.offsetTop;o=e(n.suggestionsContainer).scrollTop();r=o+n.options.maxHeight-a;if(sr){e(n.suggestionsContainer).scrollTop(s-n.options.maxHeight+a)}if(!n.options.preserveInput){var l=n.getValue(n.suggestions[t].value);if(l){l=l.replace(/\[\[.*?\]\]/g,"")}n.el.val(l)}n.signalHint(null)},onSelect:function(t){var n=this,i=n.options.onSelect,s=n.suggestions[t];n.currentValue=n.getValue(s.value);if(n.currentValue!==n.el.val()&&!n.options.preserveInput){n.el.val(n.currentValue)}n.signalHint(null);n.suggestions=[];n.selection=s;if(e.isFunction(i)){i.call(n.element,s)}},getValue:function(e){var t=this,n=t.options.delimiter,i,s;if(!n){return e}i=t.currentValue;s=i.split(n);if(s.length===1){return e}return i.substr(0,i.length-s[s.length-1].length)+e},dispose:function(){var t=this;t.el.off(".autocomplete").removeData("autocomplete");t.disableKillerFn();e(window).off("resize.autocomplete",t.fixPositionCapture);e(t.suggestionsContainer).remove()}};e.fn.autocomplete=e.fn.devbridgeAutocomplete=function(t,n){var s="autocomplete";if(!arguments.length){return this.first().data(s)}return this.each(function(){var o=e(this),r=o.data(s);if(typeof t==="string"){if(r&&typeof r[t]==="function"){r[t](n)}}else{if(r&&r.dispose){r.dispose()}r=new i(this,t);o.data(s,r)}})}}); /*! - * CodeMirror 5.65.16 (https://codemirror.net) + * CodeMirror 5.65.18 (https://codemirror.net) * Copyright 2017 by Marijn Haverbeke * Licensed under MIT (https://codemirror.net/LICENSE) */ -(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?module.exports=t():typeof define==="function"&&define.amd?define(t):(e=e||self,e.CodeMirror=t())})(this,function(){"use strict";var e=navigator.userAgent;var t=navigator.platform;var i=/gecko\/\d/i.test(e);var n=/MSIE \d/.test(e);var r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e);var o=/Edge\/(\d+)/.exec(e);var l=n||r||o;var a=l&&(n?document.documentMode||6:+(o||r)[1]);var s=!o&&/WebKit\//.test(e);var f=s&&/Qt\/\d+\.\d+/.test(e);var c=!o&&/Chrome\/(\d+)/.exec(e);var u=c&&+c[1];var h=/Opera\//.test(e);var d=/Apple Computer/.test(navigator.vendor);var p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e);var m=/PhantomJS/.test(e);var g=d&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2);var v=/Android/.test(e);var y=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e);var x=g||/Mac/.test(t);var b=/\bCrOS\b/.test(e);var w=/win/i.test(t);var C=h&&e.match(/Version\/(\d*\.\d*)/);if(C){C=Number(C[1])}if(C&&C>=15){h=false;s=true}var S=x&&(f||h&&(C==null||C<12.11));var k=i||l&&a>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var M=function(e,t){var i=e.className;var n=L(t).exec(i);if(n){var r=i.slice(n.index+n[0].length);e.className=i.slice(0,n.index)+(r?n[1]+r:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t){e.removeChild(e.firstChild)}return e}function O(e,t){return T(e).appendChild(t)}function A(e,t,i,n){var r=document.createElement(e);if(i){r.className=i}if(n){r.style.cssText=n}if(typeof t=="string"){r.appendChild(document.createTextNode(t))}else if(t){for(var o=0;o=t){return l+(t-o)}l+=a-o;l+=i-l%i;o=a+1}}var G=function(){this.id=null;this.f=null;this.time=0;this.handler=z(this.onTimeout,this)};G.prototype.onTimeout=function(e){e.id=0;if(e.time<=+new Date){e.f()}else{setTimeout(e.handler,e.time-+new Date)}};G.prototype.set=function(e,t){this.f=t;var i=+new Date+e;if(!this.id||i=t){return n+Math.min(l,t-r)}r+=o-n;r+=i-r%i;n=o+1;if(r>=t){return n}}}var Q=[""];function Z(e){while(Q.length<=e){Q.push(ee(Q)+" ")}return Q[e]}function ee(e){return e[e.length-1]}function te(e,t){var i=[];for(var n=0;n"€"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function ae(e,t){if(!t){return le(e)}if(t.source.indexOf("\\w")>-1&&le(e)){return true}return t.test(e)}function se(e){for(var t in e){if(e.hasOwnProperty(t)&&e[t]){return false}}return true}var fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ce(e){return e.charCodeAt(0)>=768&&fe.test(e)}function ue(e,t,i){while((i<0?t>0:ti?-1:1;for(;;){if(t==i){return t}var r=(t+i)/2,o=n<0?Math.ceil(r):Math.floor(r);if(o==t){return e(o)?t:i}if(e(o)){i=o}else{t=o+n}}}function de(e,t,i,n){if(!e){return n(t,i,"ltr",0)}var r=false;for(var o=0;ot||t==i&&l.to==t){n(Math.max(l.from,t),Math.min(l.to,i),l.level==1?"rtl":"ltr",o);r=true}}if(!r){n(t,i,"ltr")}}var pe=null;function me(e,t,i){var n;pe=null;for(var r=0;rt){return r}if(o.to==t){if(o.from!=o.to&&i=="before"){n=r}else{pe=r}}if(o.from==t){if(o.from!=o.to&&i!="before"){n=r}else{pe=r}}}return n!=null?n:pe}var ge=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(i){if(i<=247){return e.charAt(i)}else if(1424<=i&&i<=1524){return"R"}else if(1536<=i&&i<=1785){return t.charAt(i-1536)}else if(1774<=i&&i<=2220){return"r"}else if(8192<=i&&i<=8203){return"w"}else if(i==8204){return"b"}else{return"L"}}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var r=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(e,t,i){this.level=e;this.from=t;this.to=i}return function(e,t){var f=t=="ltr"?"L":"R";if(e.length==0||t=="ltr"&&!n.test(e)){return false}var c=e.length,u=[];for(var h=0;h-1){n[t]=r.slice(0,o).concat(r.slice(o+1))}}}}function Ce(e,t){var i=be(e,t);if(!i.length){return}var n=Array.prototype.slice.call(arguments,2);for(var r=0;r0}function Me(e){e.prototype.on=function(e,t){xe(this,e,t)};e.prototype.off=function(e,t){we(this,e,t)}}function Te(e){if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}}function Oe(e){if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}}function Ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==false}function Ne(e){Te(e);Oe(e)}function Pe(e){return e.target||e.srcElement}function Fe(e){var t=e.which;if(t==null){if(e.button&1){t=1}else if(e.button&2){t=3}else if(e.button&4){t=2}}if(x&&e.ctrlKey&&t==1){t=3}return t}var De=function(){if(l&&a<9){return false}var e=A("div");return"draggable"in e||"dragDrop"in e}();var He;function Ee(e){if(He==null){var t=A("span","​");O(e,A("span",[t,document.createTextNode("x")]));if(e.firstChild.offsetHeight!=0){He=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&a<8)}}var i=He?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");i.setAttribute("cm-text","");return i}var We;function Ie(e){if(We!=null){return We}var t=O(e,document.createTextNode("AخA"));var i=P(t,0,1).getBoundingClientRect();var n=P(t,1,2).getBoundingClientRect();T(e);if(!i||i.left==i.right){return false}return We=n.right-i.right<3}var Re="\n\nb".split(/\n/).length!=3?function(e){var t=0,i=[],n=e.length;while(t<=n){var r=e.indexOf("\n",t);if(r==-1){r=e.length}var o=e.slice(t,e.charAt(r-1)=="\r"?r-1:r);var l=o.indexOf("\r");if(l!=-1){i.push(o.slice(0,l));t+=l+1}else{i.push(o);t=r+1}}return i}:function(e){return e.split(/\r\n?|\n/)};var Be=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return false}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}if(!t||t.parentElement()!=e){return false}return t.compareEndPoints("StartToEnd",t)!=0};var je=function(){var e=A("div");if("oncopy"in e){return true}e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}();var ze=null;function qe(e){if(ze!=null){return ze}var t=O(e,A("span","x"));var i=t.getBoundingClientRect();var n=P(t,0,1).getBoundingClientRect();return ze=Math.abs(i.left-n.left)>1}var Ue={},Ge={};function Ve(e,t){if(arguments.length>2){t.dependencies=Array.prototype.slice.call(arguments,2)}Ue[e]=t}function Ke(e,t){Ge[e]=t}function $e(e){if(typeof e=="string"&&Ge.hasOwnProperty(e)){e=Ge[e]}else if(e&&typeof e.name=="string"&&Ge.hasOwnProperty(e.name)){var t=Ge[e.name];if(typeof t=="string"){t={name:t}}e=re(t,e);e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e)){return $e("application/xml")}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e)){return $e("application/json")}if(typeof e=="string"){return{name:e}}else{return e||{name:"null"}}}function Xe(e,t){t=$e(t);var i=Ue[t.name];if(!i){return Xe(e,"text/plain")}var n=i(e,t);if(_e.hasOwnProperty(t.name)){var r=_e[t.name];for(var o in r){if(!r.hasOwnProperty(o)){continue}if(n.hasOwnProperty(o)){n["_"+o]=n[o]}n[o]=r[o]}}n.name=t.name;if(t.helperType){n.helperType=t.helperType}if(t.modeProps){for(var l in t.modeProps){n[l]=t.modeProps[l]}}return n}var _e={};function Ye(e,t){var i=_e.hasOwnProperty(e)?_e[e]:_e[e]={};q(t,i)}function Je(e,t){if(t===true){return t}if(e.copyState){return e.copyState(t)}var i={};for(var n in t){var r=t[n];if(r instanceof Array){r=r.concat([])}i[n]=r}return i}function Qe(e,t){var i;while(e.innerMode){i=e.innerMode(t);if(!i||i.mode==e){break}t=i.state;e=i.mode}return i||{mode:e,state:t}}function Ze(e,t,i){return e.startState?e.startState(t,i):true}var et=function(e,t,i){this.pos=this.start=0;this.string=e;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=i};et.prototype.eol=function(){return this.pos>=this.string.length};et.prototype.sol=function(){return this.pos==this.lineStart};et.prototype.peek=function(){return this.string.charAt(this.pos)||undefined};et.prototype.next=function(){if(this.post};et.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>e};et.prototype.skipToEnd=function(){this.pos=this.string.length};et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}};et.prototype.backUp=function(e){this.pos-=e};et.prototype.column=function(){if(this.lastColumnPos0){return null}if(o&&t!==false){this.pos+=o[0].length}return o}};et.prototype.current=function(){return this.string.slice(this.start,this.pos)};et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}};et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)};et.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function tt(e,t){t-=e.first;if(t<0||t>=e.size){throw new Error("There is no line "+(t+e.first)+" in the document.")}var i=e;while(!i.lines){for(var n=0;;++n){var r=i.children[n],o=r.chunkSize();if(t=e.first&&ti){return ft(i,tt(e,i).text.length)}return vt(t,tt(e,t.line).text.length)}function vt(e,t){var i=e.ch;if(i==null||i>t){return ft(e.line,t)}else if(i<0){return ft(e.line,0)}else{return e}}function yt(e,t){var i=[];for(var n=0;nthis.maxLookAhead){this.maxLookAhead=e}return t};bt.prototype.baseToken=function(e){if(!this.baseTokens){return null}while(this.baseTokens[this.baseTokenPos]<=e){this.baseTokenPos+=2}var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}};bt.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0){this.maxLookAhead--}};bt.fromSaved=function(e,t,i){if(t instanceof xt){return new bt(e,Je(e.mode,t.state),i,t.lookAhead)}else{return new bt(e,Je(e.mode,t),i)}};bt.prototype.save=function(e){var t=e!==false?Je(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new xt(t,this.maxLookAhead):t};function wt(e,t,i,n){var r=[e.state.modeGen],o={};Nt(e,t.text,e.doc.mode,i,function(e,t){return r.push(e,t)},o,n);var l=i.state;var a=function(n){i.baseTokens=r;var a=e.state.overlays[n],s=1,f=0;i.state=true;Nt(e,t.text,a.mode,i,function(e,t){var i=s;while(fe){r.splice(s,1,e,r[s+1],n)}s+=2;f=Math.min(e,n)}if(!t){return}if(a.opaque){r.splice(i,s-i,e,"overlay "+t);s=i+2}else{for(;ie.options.maxHighlightLength&&Je(e.doc.mode,n.state);var o=wt(e,t,n);if(r){n.state=r}t.stateAfter=n.save(!r);t.styles=o.styles;if(o.classes){t.styleClasses=o.classes}else if(t.styleClasses){t.styleClasses=null}if(i===e.doc.highlightFrontier){e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier)}}return t.styles}function St(e,t,i){var n=e.doc,r=e.display;if(!n.mode.startState){return new bt(n,true,t)}var o=Pt(e,t,i);var l=o>n.first&&tt(n,o-1).stateAfter;var a=l?bt.fromSaved(n,l,o):new bt(n,Ze(n.mode),o);n.iter(o,t,function(i){kt(e,i.text,a);var n=a.line;i.stateAfter=n==t-1||n%5==0||n>=r.viewFrom&&nt.start){return o}}throw new Error("Mode "+e.name+" failed to advance stream.")}var Tt=function(e,t,i){this.start=e.start;this.end=e.pos;this.string=e.current();this.type=t||null;this.state=i};function Ot(e,t,i,n){var r=e.doc,o=r.mode,l;t=gt(r,t);var a=tt(r,t.line),s=St(e,t.line,i);var f=new et(a.text,e.options.tabSize,s),c;if(n){c=[]}while((n||f.pose.options.maxHighlightLength){a=false;if(l){kt(e,t,n,c.pos)}c.pos=t.length;u=null}else{u=At(Mt(i,c,n.state,h),o)}if(h){var d=h[0].name;if(d){u="m-"+(u?d+" "+u:d)}}if(!a||f!=u){while(sl;--a){if(a<=o.first){return o.first}var s=tt(o,a-1),f=s.stateAfter;if(f&&(!i||a+(f instanceof xt?f.lookAhead:0)<=o.modeFrontier)){return a}var c=U(s.text,null,e.options.tabSize);if(r==null||n>c){r=a-1;n=c}}return r}function Ft(e,t){e.modeFrontier=Math.min(e.modeFrontier,t);if(e.highlightFrontieri;n--){var r=tt(e,n).stateAfter;if(r&&(!(r instanceof xt)||n+r.lookAhead=t:o.to>t);(n||(n=[])).push(new It(l,o.from,s?null:o.to))}}}return n}function qt(e,t,i){var n;if(e){for(var r=0;r=t:o.to>t);if(a||o.from==t&&l.type=="bookmark"&&(!i||o.marker.insertLeft)){var s=o.from==null||(l.inclusiveLeft?o.from<=t:o.from0&&a){for(var b=0;b0){continue}var c=[s,1],u=ct(f.from,a.from),h=ct(f.to,a.to);if(u<0||!l.inclusiveLeft&&!u){c.push({from:f.from,to:a.from})}if(h>0||!l.inclusiveRight&&!h){c.push({from:a.to,to:f.to})}r.splice.apply(r,c);s+=c.length-3}}return r}function Kt(e){var t=e.markedSpans;if(!t){return}for(var i=0;it)&&(!n||Yt(n,o.marker)<0)){n=o.marker}}}return n}function ti(e,t,i,n,r){var o=tt(e,t);var l=Ht&&o.markedSpans;if(l){for(var a=0;a=0&&u<=0||c<=0&&u>=0){continue}if(c<=0&&(s.marker.inclusiveRight&&r.inclusiveLeft?ct(f.to,i)>=0:ct(f.to,i)>0)||c>=0&&(s.marker.inclusiveRight&&r.inclusiveLeft?ct(f.from,n)<=0:ct(f.from,n)<0)){return true}}}}function ii(e){var t;while(t=Qt(e)){e=t.find(-1,true).line}return e}function ni(e){var t;while(t=Zt(e)){e=t.find(1,true).line}return e}function ri(e){var t,i;while(t=Zt(e)){e=t.find(1,true).line;(i||(i=[])).push(e)}return i}function oi(e,t){var i=tt(e,t),n=ii(i);if(i==n){return t}return ot(n)}function li(e,t){if(t>e.lastLine()){return t}var i=tt(e,t),n;if(!ai(e,i)){return t}while(n=Zt(i)){i=n.find(1,true).line}return ot(i)+1}function ai(e,t){var i=Ht&&t.markedSpans;if(i){for(var n=void 0,r=0;rt.maxLineLength){t.maxLineLength=i;t.maxLine=e}})}var hi=function(e,t,i){this.text=e;$t(this,t);this.height=i?i(this):1};hi.prototype.lineNo=function(){return ot(this)};Me(hi);function di(e,t,i,n){e.text=t;if(e.stateAfter){e.stateAfter=null}if(e.styles){e.styles=null}if(e.order!=null){e.order=null}Kt(e);$t(e,i);var r=n?n(e):1;if(r!=e.height){rt(e,r)}}function pi(e){e.parent=null;Kt(e)}var mi={},gi={};function vi(e,t){if(!e||/^\s*$/.test(e)){return null}var i=t.addModeClass?gi:mi;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function yi(e,t){var i=N("span",null,null,s?"padding-right: .1px":null);var n={pre:N("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:false,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var o=r?t.rest[r-1]:t.line,l=void 0;n.pos=0;n.addToken=bi;if(Ie(e.display.measure)&&(l=ve(o,e.doc.direction))){n.addToken=Ci(n.addToken,l)}n.map=[];var a=t!=e.display.externalMeasured&&ot(o);ki(o,n,Ct(e,o,a));if(o.styleClasses){if(o.styleClasses.bgClass){n.bgClass=E(o.styleClasses.bgClass,n.bgClass||"")}if(o.styleClasses.textClass){n.textClass=E(o.styleClasses.textClass,n.textClass||"")}}if(n.map.length==0){n.map.push(0,0,n.content.appendChild(Ee(e.display.measure)))}if(r==0){t.measure.map=n.map;t.measure.cache={}}else{(t.measure.maps||(t.measure.maps=[])).push(n.map);(t.measure.caches||(t.measure.caches=[])).push({})}}if(s){var f=n.content.lastChild;if(/\bcm-tab\b/.test(f.className)||f.querySelector&&f.querySelector(".cm-tab")){n.content.className="cm-tab-wrap-hack"}}Ce(e,"renderLine",e,t.line,n.pre);if(n.pre.className){n.textClass=E(n.pre.className,n.textClass||"")}return n}function xi(e){var t=A("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);t.setAttribute("aria-label",t.title);return t}function bi(e,t,i,n,r,o,s){if(!t){return}var f=e.splitSpaces?wi(t,e.trailingSpace):t;var c=e.cm.state.specialChars,u=false;var h;if(!c.test(t)){e.col+=t.length;h=document.createTextNode(f);e.map.push(e.pos,e.pos+t.length,h);if(l&&a<9){u=true}e.pos+=t.length}else{h=document.createDocumentFragment();var d=0;while(true){c.lastIndex=d;var p=c.exec(t);var m=p?p.index-d:t.length-d;if(m){var g=document.createTextNode(f.slice(d,d+m));if(l&&a<9){h.appendChild(A("span",[g]))}else{h.appendChild(g)}e.map.push(e.pos,e.pos+m,g);e.col+=m;e.pos+=m}if(!p){break}d+=m+1;var v=void 0;if(p[0]=="\t"){var y=e.cm.options.tabSize,x=y-e.col%y;v=h.appendChild(A("span",Z(x),"cm-tab"));v.setAttribute("role","presentation");v.setAttribute("cm-text","\t");e.col+=x}else if(p[0]=="\r"||p[0]=="\n"){v=h.appendChild(A("span",p[0]=="\r"?"␍":"␤","cm-invalidchar"));v.setAttribute("cm-text",p[0]);e.col+=1}else{v=e.cm.options.specialCharPlaceholder(p[0]);v.setAttribute("cm-text",p[0]);if(l&&a<9){h.appendChild(A("span",[v]))}else{h.appendChild(v)}e.col+=1}e.map.push(e.pos,e.pos+1,v);e.pos++}}e.trailingSpace=f.charCodeAt(t.length-1)==32;if(i||n||r||u||o||s){var b=i||"";if(n){b+=n}if(r){b+=r}var w=A("span",[h],b,o);if(s){for(var C in s){if(s.hasOwnProperty(C)&&C!="style"&&C!="class"){w.setAttribute(C,s[C])}}}return e.content.appendChild(w)}e.content.appendChild(h)}function wi(e,t){if(e.length>1&&!/ /.test(e)){return e}var i=t,n="";for(var r=0;rf&&u.from<=f){break}}if(u.to>=c){return e(i,n,r,o,l,a,s)}e(i,n.slice(0,u.to-f),r,o,null,a,s);o=null;n=n.slice(u.to-f);f=u.to}}}function Si(e,t,i,n){var r=!n&&i.widgetNode;if(r){e.map.push(e.pos,e.pos+t,r)}if(!n&&e.cm.display.input.needsContentAttribute){if(!r){r=e.content.appendChild(document.createElement("span"))}r.setAttribute("cm-marker",i.id)}if(r){e.cm.display.input.setUneditable(r);e.content.appendChild(r)}e.pos+=t;e.trailingSpace=false}function ki(e,t,i){var n=e.markedSpans,r=e.text,o=0;if(!n){for(var l=1;ls||S.collapsed&&C.to==s&&C.from==s)){if(C.to!=null&&C.to!=s&&d>C.to){d=C.to;m=""}if(S.className){p+=" "+S.className}if(S.css){h=(h?h+";":"")+S.css}if(S.startStyle&&C.from==s){g+=" "+S.startStyle}if(S.endStyle&&C.to==d){(b||(b=[])).push(S.endStyle,C.to)}if(S.title){(y||(y={})).title=S.title}if(S.attributes){for(var k in S.attributes){(y||(y={}))[k]=S.attributes[k]}}if(S.collapsed&&(!v||Yt(v.marker,S)<0)){v=C}}else if(C.from>s&&d>C.from){d=C.from}}if(b){for(var L=0;L=a){break}var T=Math.min(a,d);while(true){if(c){var O=s+c.length;if(!v){var A=O>T?c.slice(0,T-s):c;t.addToken(t,A,u?u+p:p,g,s+A.length==d?m:"",h,y)}if(O>=T){c=c.slice(T-s);s=T;break}s=O;g=""}c=r.slice(o,o=i[f++]);u=vi(i[f++],t.cm.options)}}}function Li(e,t,i){this.line=t;this.rest=ri(t);this.size=this.rest?ot(ee(this.rest))-i+1:1;this.node=this.text=null;this.hidden=ai(e,t)}function Mi(e,t,i){var n=[],r;for(var o=t;o2){o.push((s.bottom+f.top)/2-i.top)}}}o.push(i.bottom-i.top)}}function tn(e,t,i){if(e.line==t){return{map:e.measure.map,cache:e.measure.cache}}if(e.rest){for(var n=0;ni){return{map:e.measure.maps[r],cache:e.measure.caches[r],before:true}}}}}function nn(e,t){t=ii(t);var i=ot(t);var n=e.display.externalMeasured=new Li(e.doc,t,i);n.lineN=i;var r=n.built=yi(e,n);n.text=r.pre;O(e.display.lineMeasure,r.pre);return n}function rn(e,t,i,n){return an(e,ln(e,t),i,n)}function on(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt){o=s-a;r=o-1;if(t>=s){l="right"}}if(r!=null){n=e[f+2];if(a==s&&i==(n.insertLeft?"left":"right")){l=i}if(i=="left"&&r==0){while(f&&e[f-2]==e[f-3]&&e[f-1].insertLeft){n=e[(f-=3)+2];l="left"}}if(i=="right"&&r==s-a){while(f=0;r--){if((i=e[r]).left!=i.right){break}}}return i}function un(e,t,i,n){var r=fn(t.map,i,n);var o=r.node,s=r.start,f=r.end,c=r.collapse;var u;if(o.nodeType==3){for(var h=0;h<4;h++){while(s&&ce(t.line.text.charAt(r.coverStart+s))){--s}while(r.coverStart+f0){c=n="right"}var d;if(e.options.lineWrapping&&(d=o.getClientRects()).length>1){u=d[n=="right"?d.length-1:0]}else{u=o.getBoundingClientRect()}}if(l&&a<9&&!s&&(!u||!u.left&&!u.right)){var p=o.parentNode.getClientRects()[0];if(p){u={left:p.left,right:p.left+Hn(e.display),top:p.top,bottom:p.bottom}}else{u=sn}}var m=u.top-t.rect.top,g=u.bottom-t.rect.top;var v=(m+g)/2;var y=t.view.measure.heights;var x=0;for(;x=n.text.length){s=n.text.length;f="before"}else if(s<=0){s=0;f="after"}if(!a){return l(f=="before"?s-1:s,f=="before")}function c(e,t,i){var n=a[t],r=n.level==1;return l(i?e-1:e,r!=i)}var u=me(a,s,f);var h=pe;var d=c(s,u,f=="before");if(h!=null){d.other=c(s,h,f!="before")}return d}function Sn(e,t){var i=0;t=gt(e.doc,t);if(!e.options.lineWrapping){i=Hn(e.display)*t.ch}var n=tt(e.doc,t.line);var r=fi(n)+Xi(e.display);return{left:i,right:i,top:r,bottom:r+n.height}}function kn(e,t,i,n,r){var o=ft(e,t,i);o.xRel=r;if(n){o.outside=n}return o}function Ln(e,t,i){var n=e.doc;i+=e.display.viewOffset;if(i<0){return kn(n.first,0,null,-1,-1)}var r=lt(n,i),o=n.first+n.size-1;if(r>o){return kn(n.first+n.size-1,tt(n,o).text.length,null,1,1)}if(t<0){t=0}var l=tt(n,r);for(;;){var a=An(e,l,r,t,i);var s=ei(l,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s){return a}var f=s.find(1);if(f.line==r){return f}l=tt(n,r=f.line)}}function Mn(e,t,i,n){n-=yn(t);var r=t.text.length;var o=he(function(t){return an(e,i,t-1).bottom<=n},r,0);r=he(function(t){return an(e,i,t).top>n},o,r);return{begin:o,end:r}}function Tn(e,t,i,n){if(!i){i=ln(e,t)}var r=xn(e,t,an(e,i,n),"line").top;return Mn(e,t,i,r)}function On(e,t,i,n){return e.bottom<=i?false:e.top>i?true:(n?e.left:e.right)>t}function An(e,t,i,n,r){r-=fi(t);var o=ln(e,t);var l=yn(t);var a=0,s=t.text.length,f=true;var c=ve(t,e.doc.direction);if(c){var u=(e.options.lineWrapping?Pn:Nn)(e,t,i,o,c,n,r);f=u.level!=1;a=f?u.from:u.to-1;s=f?u.to:u.from-1}var h=null,d=null;var p=he(function(t){var i=an(e,o,t);i.top+=l;i.bottom+=l;if(!On(i,n,r,false)){return false}if(i.top<=r&&i.left<=n){h=t;d=i}return true},a,s);var m,g,v=false;if(d){var y=n-d.left=b.bottom?1:0}p=ue(t.text,p,1);return kn(i,p,g,v,n-m)}function Nn(e,t,i,n,r,o,l){var a=he(function(a){var s=r[a],f=s.level!=1;return On(Cn(e,ft(i,f?s.to:s.from,f?"before":"after"),"line",t,n),o,l,true)},0,r.length-1);var s=r[a];if(a>0){var f=s.level!=1;var c=Cn(e,ft(i,f?s.from:s.to,f?"after":"before"),"line",t,n);if(On(c,o,l,true)&&c.top>l){s=r[a-1]}}return s}function Pn(e,t,i,n,r,o,l){var a=Mn(e,t,n,l);var s=a.begin;var f=a.end;if(/\s/.test(t.text.charAt(f-1))){f--}var c=null,u=null;for(var h=0;h=f||d.to<=s){continue}var p=d.level!=1;var m=an(e,n,p?Math.min(f,d.to)-1:Math.max(s,d.from)).right;var g=mg){c=d;u=g}}if(!c){c=r[r.length-1]}if(c.fromf){c={from:c.from,to:f,level:c.level}}return c}var Fn;function Dn(e){if(e.cachedTextHeight!=null){return e.cachedTextHeight}if(Fn==null){Fn=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t){Fn.appendChild(document.createTextNode("x"));Fn.appendChild(A("br"))}Fn.appendChild(document.createTextNode("x"))}O(e.measure,Fn);var i=Fn.offsetHeight/50;if(i>3){e.cachedTextHeight=i}T(e.measure);return i||1}function Hn(e){if(e.cachedCharWidth!=null){return e.cachedCharWidth}var t=A("span","xxxxxxxxxx");var i=A("pre",[t],"CodeMirror-line-like");O(e.measure,i);var n=t.getBoundingClientRect(),r=(n.right-n.left)/10;if(r>2){e.cachedCharWidth=r}return r||10}function En(e){var t=e.display,i={},n={};var r=t.gutters.clientLeft;for(var o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;i[a]=o.offsetLeft+o.clientLeft+r;n[a]=o.clientWidth}return{fixedPos:Wn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Wn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function In(e){var t=Dn(e.display),i=e.options.lineWrapping;var n=i&&Math.max(5,e.display.scroller.clientWidth/Hn(e.display)-3);return function(r){if(ai(e.doc,r)){return 0}var o=0;if(r.widgets){for(var l=0;l0&&(f=tt(e.doc,s.line).text).length==s.ch){var c=U(f,f.length,e.options.tabSize)-f.length;s=ft(s.line,Math.max(0,Math.round((o-Yi(e.display).left)/Hn(e.display))-c))}return s}function jn(e,t){if(t>=e.display.viewTo){return null}t-=e.display.viewFrom;if(t<0){return null}var i=e.display.view;for(var n=0;nt)){r.updateLineNumbers=t}e.curOp.viewChanged=true;if(t>=r.viewTo){if(Ht&&oi(e.doc,t)r.viewFrom){Un(e)}else{r.viewFrom+=n;r.viewTo+=n}}else if(t<=r.viewFrom&&i>=r.viewTo){Un(e)}else if(t<=r.viewFrom){var o=Gn(e,i,i+n,1);if(o){r.view=r.view.slice(o.index);r.viewFrom=o.lineN;r.viewTo+=n}else{Un(e)}}else if(i>=r.viewTo){var l=Gn(e,t,t,-1);if(l){r.view=r.view.slice(0,l.index);r.viewTo=l.lineN}else{Un(e)}}else{var a=Gn(e,t,t,-1);var s=Gn(e,i,i+n,1);if(a&&s){r.view=r.view.slice(0,a.index).concat(Mi(e,a.lineN,s.lineN)).concat(r.view.slice(s.index));r.viewTo+=n}else{Un(e)}}var f=r.externalMeasured;if(f){if(i=r.lineN&&t=n.viewTo){return}var o=n.view[jn(e,t)];if(o.node==null){return}var l=o.changes||(o.changes=[]);if(V(l,i)==-1){l.push(i)}}function Un(e){e.display.viewFrom=e.display.viewTo=e.doc.first;e.display.view=[];e.display.viewOffset=0}function Gn(e,t,i,n){var r=jn(e,t),o,l=e.display.view;if(!Ht||i==e.doc.first+e.doc.size){return{index:r,lineN:i}}var a=e.display.viewFrom;for(var s=0;s0){if(r==l.length-1){return null}o=a+l[r].size-t;r++}else{o=a-t}t+=o;i+=o}while(oi(e.doc,i)!=i){if(r==(n<0?0:l.length-1)){return null}i+=n*l[r-(n<0?1:0)].size;r+=n}return{index:r,lineN:i}}function Vn(e,t,i){var n=e.display,r=n.view;if(r.length==0||t>=n.viewTo||i<=n.viewFrom){n.view=Mi(e,t,i);n.viewFrom=t}else{if(n.viewFrom>t){n.view=Mi(e,t,n.viewFrom).concat(n.view)}else if(n.viewFromi){n.view=n.view.slice(0,jn(e,i))}}n.viewTo=i}function Kn(e){var t=e.display.view,i=0;for(var n=0;n=e.display.viewTo||s.to().line0?l:e.defaultCharWidth())+"px"}if(n.other){var a=i.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="";a.style.left=n.other.left+"px";a.style.top=n.other.top+"px";a.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function Yn(e,t){return e.top-t.top||e.left-t.left}function Jn(e,t,i){var n=e.display,r=e.doc;var o=document.createDocumentFragment();var l=Yi(e.display),a=l.left;var s=Math.max(n.sizerWidth,Qi(e)-n.sizer.offsetLeft)-l.right;var f=r.direction=="ltr";function c(e,t,i,n){if(t<0){t=0}t=Math.round(t);n=Math.round(n);o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(i==null?s-e:i)+"px;\n height: "+(n-t)+"px"))}function u(t,i,n){var o=tt(r,t);var l=o.text.length;var u,h;function d(i,n){return wn(e,ft(t,i),"div",o,n)}function p(t,i,n){var r=Tn(e,o,null,t);var l=i=="ltr"==(n=="after")?"left":"right";var a=n=="after"?r.begin:r.end-(/\s/.test(o.text.charAt(r.end-1))?2:1);return d(a,l)[l]}var m=ve(o,r.direction);de(m,i||0,n==null?l:n,function(e,t,r,o){var g=r=="ltr";var v=d(e,g?"left":"right");var y=d(t-1,g?"right":"left");var x=i==null&&e==0,b=n==null&&t==l;var w=o==0,C=!m||o==m.length-1;if(y.top-v.top<=3){var S=(f?x:b)&&w;var k=(f?b:x)&&C;var L=S?a:(g?v:y).left;var M=k?s:(g?y:v).right;c(L,v.top,M-L,v.bottom)}else{var T,O,A,N;if(g){T=f&&x&&w?a:v.left;O=f?s:p(e,r,"before");A=f?a:p(t,r,"after");N=f&&b&&C?s:y.right}else{T=!f?a:p(e,r,"before");O=!f&&x&&w?s:v.right;A=!f&&b&&C?a:y.left;N=!f?s:p(t,r,"after")}c(T,v.top,O-T,v.bottom);if(v.bottom0){t.blinker=setInterval(function(){if(!e.hasFocus()){ir(e)}t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate)}else if(e.options.cursorBlinkRate<0){t.cursorDiv.style.visibility="hidden"}}function Zn(e){if(!e.hasFocus()){e.display.input.focus();if(!e.state.focused){tr(e)}}}function er(e){e.state.delayingBlurEvent=true;setTimeout(function(){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false;if(e.state.focused){ir(e)}}},100)}function tr(e,t){if(e.state.delayingBlurEvent&&!e.state.draggingText){e.state.delayingBlurEvent=false}if(e.options.readOnly=="nocursor"){return}if(!e.state.focused){Ce(e,"focus",e,t);e.state.focused=true;H(e.display.wrapper,"CodeMirror-focused");if(!e.curOp&&e.display.selForContextMenu!=e.doc.sel){e.display.input.reset();if(s){setTimeout(function(){return e.display.input.reset(true)},20)}}e.display.input.receivedFocus()}Qn(e)}function ir(e,t){if(e.state.delayingBlurEvent){return}if(e.state.focused){Ce(e,"blur",e,t);e.state.focused=false;M(e.display.wrapper,"CodeMirror-focused")}clearInterval(e.display.blinker);setTimeout(function(){if(!e.state.focused){e.display.shift=false}},150)}function nr(e){var t=e.display;var i=t.lineDiv.offsetTop;var n=Math.max(0,t.scroller.getBoundingClientRect().top);var r=t.lineDiv.getBoundingClientRect().top;var o=0;for(var s=0;s.005||m<-.005){if(re.display.sizerWidth){var v=Math.ceil(h/Hn(e.display));if(v>e.display.maxLineLength){e.display.maxLineLength=v;e.display.maxLine=f.line;e.display.maxLineChanged=true}}}if(Math.abs(o)>2){t.scroller.scrollTop+=o}}function rr(e){if(e.widgets){for(var t=0;t=l){o=lt(t,fi(tt(t,s))-e.wrapper.clientHeight);l=s}}return{from:o,to:Math.max(l,o+1)}}function lr(e,t){if(Se(e,"scrollCursorIntoView")){return}var i=e.display,n=i.sizer.getBoundingClientRect(),r=null;var o=i.wrapper.ownerDocument;if(t.top+n.top<0){r=true}else if(t.bottom+n.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)){r=false}if(r!=null&&!m){var l=A("div","​",null,"position: absolute;\n top: "+(t.top-i.viewOffset-Xi(e.display))+"px;\n height: "+(t.bottom-t.top+Ji(e)+i.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l);l.scrollIntoView(r);e.display.lineSpace.removeChild(l)}}function ar(e,t,i,n){if(n==null){n=0}var r;if(!e.options.lineWrapping&&t==i){i=t.sticky=="before"?ft(t.line,t.ch+1,"before"):t;t=t.ch?ft(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t}for(var o=0;o<5;o++){var l=false;var a=Cn(e,t);var s=!i||i==t?a:Cn(e,i);r={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-n,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+n};var f=fr(e,r);var c=e.doc.scrollTop,u=e.doc.scrollLeft;if(f.scrollTop!=null){gr(e,f.scrollTop);if(Math.abs(e.doc.scrollTop-c)>1){l=true}}if(f.scrollLeft!=null){yr(e,f.scrollLeft);if(Math.abs(e.doc.scrollLeft-u)>1){l=true}}if(!l){break}}return r}function sr(e,t){var i=fr(e,t);if(i.scrollTop!=null){gr(e,i.scrollTop)}if(i.scrollLeft!=null){yr(e,i.scrollLeft)}}function fr(e,t){var i=e.display,n=Dn(e.display);if(t.top<0){t.top=0}var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop;var o=Zi(e),l={};if(t.bottom-t.top>o){t.bottom=t.top+o}var a=e.doc.height+_i(i);var s=t.topa-n;if(t.topr+o){var c=Math.min(t.top,(f?a:t.bottom)-o);if(c!=r){l.scrollTop=c}}var u=e.options.fixedGutter?0:i.gutters.offsetWidth;var h=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-u;var d=Qi(e)-i.gutters.offsetWidth;var p=t.right-t.left>d;if(p){t.right=t.left+d}if(t.left<10){l.scrollLeft=0}else if(t.leftd+h-3){l.scrollLeft=t.right+(p?0:10)-d}return l}function cr(e,t){if(t==null){return}pr(e);e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ur(e){pr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hr(e,t,i){if(t!=null||i!=null){pr(e)}if(t!=null){e.curOp.scrollLeft=t}if(i!=null){e.curOp.scrollTop=i}}function dr(e,t){pr(e);e.curOp.scrollToPos=t}function pr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Sn(e,t.from),n=Sn(e,t.to);mr(e,i,n,t.margin)}}function mr(e,t,i,n){var r=fr(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});hr(e,r.scrollLeft,r.scrollTop)}function gr(e,t){if(Math.abs(e.doc.scrollTop-t)<2){return}if(!i){$r(e,{top:t})}vr(e,t,true);if(i){$r(e)}Br(e,100)}function vr(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t));if(e.display.scroller.scrollTop==t&&!i){return}e.doc.scrollTop=t;e.display.scrollbars.setScrollTop(t);if(e.display.scroller.scrollTop!=t){e.display.scroller.scrollTop=t}}function yr(e,t,i,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth));if((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n){return}e.doc.scrollLeft=t;Jr(e);if(e.display.scroller.scrollLeft!=t){e.display.scroller.scrollLeft=t}e.display.scrollbars.setScrollLeft(t)}function xr(e){var t=e.display,i=t.gutters.offsetWidth;var n=Math.round(e.doc.height+_i(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:n,scrollHeight:n+Ji(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var br=function(e,t,i){this.cm=i;var n=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var r=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=r.tabIndex=-1;e(n);e(r);xe(n,"scroll",function(){if(n.clientHeight){t(n.scrollTop,"vertical")}});xe(r,"scroll",function(){if(r.clientWidth){t(r.scrollLeft,"horizontal")}});this.checkedZeroWidth=false;if(l&&a<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}};br.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1;var i=e.scrollHeight>e.clientHeight+1;var n=e.nativeBarWidth;if(i){this.vert.style.display="block";this.vert.style.bottom=t?n+"px":"0";var r=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else{this.vert.scrollTop=0;this.vert.style.display="";this.vert.firstChild.style.height="0"}if(t){this.horiz.style.display="block";this.horiz.style.right=i?n+"px":"0";this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&e.clientHeight>0){if(n==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{right:i?n:0,bottom:t?n:0}};br.prototype.setScrollLeft=function(e){if(this.horiz.scrollLeft!=e){this.horiz.scrollLeft=e}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}};br.prototype.setScrollTop=function(e){if(this.vert.scrollTop!=e){this.vert.scrollTop=e}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}};br.prototype.zeroWidthHack=function(){var e=x&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e;this.horiz.style.visibility=this.vert.style.visibility="hidden";this.disableHoriz=new G;this.disableVert=new G};br.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function n(){var r=e.getBoundingClientRect();var o=i=="vert"?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);if(o!=e){e.style.visibility="hidden"}else{t.set(1e3,n)}}t.set(1e3,n)};br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz);e.removeChild(this.vert)};var wr=function(){};wr.prototype.update=function(){return{bottom:0,right:0}};wr.prototype.setScrollLeft=function(){};wr.prototype.setScrollTop=function(){};wr.prototype.clear=function(){};function Cr(e,t){if(!t){t=xr(e)}var i=e.display.barWidth,n=e.display.barHeight;Sr(e,t);for(var r=0;r<4&&i!=e.display.barWidth||n!=e.display.barHeight;r++){if(i!=e.display.barWidth&&e.options.lineWrapping){nr(e)}Sr(e,xr(e));i=e.display.barWidth;n=e.display.barHeight}}function Sr(e,t){var i=e.display;var n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px";i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px";i.heightForcer.style.borderBottom=n.bottom+"px solid transparent";if(n.right&&n.bottom){i.scrollbarFiller.style.display="block";i.scrollbarFiller.style.height=n.bottom+"px";i.scrollbarFiller.style.width=n.right+"px"}else{i.scrollbarFiller.style.display=""}if(n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter){i.gutterFiller.style.display="block";i.gutterFiller.style.height=n.bottom+"px";i.gutterFiller.style.width=t.gutterWidth+"px"}else{i.gutterFiller.style.display=""}}var kr={native:br,null:wr};function Lr(e){if(e.display.scrollbars){e.display.scrollbars.clear();if(e.display.scrollbars.addClass){M(e.display.wrapper,e.display.scrollbars.addClass)}}e.display.scrollbars=new kr[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller);xe(t,"mousedown",function(){if(e.state.focused){setTimeout(function(){return e.display.input.focus()},0)}});t.setAttribute("cm-not-content","true")},function(t,i){if(i=="horizontal"){yr(e,t)}else{gr(e,t)}},e);if(e.display.scrollbars.addClass){H(e.display.wrapper,e.display.scrollbars.addClass)}}var Mr=0;function Tr(e){e.curOp={cm:e,viewChanged:false,startHeight:e.doc.height,forceUpdate:false,updateInput:0,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++Mr,markArrays:null};Oi(e.curOp)}function Or(e){var t=e.curOp;if(t){Ni(t,function(e){for(var t=0;t=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping;e.update=e.mustUpdate&&new zr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Pr(e){e.updatedDisplay=e.mustUpdate&&Vr(e.cm,e.update)}function Fr(e){var t=e.cm,i=t.display;if(e.updatedDisplay){nr(t)}e.barMeasure=xr(t);if(i.maxLineChanged&&!t.options.lineWrapping){e.adjustWidthTo=rn(t,i.maxLine,i.maxLine.text.length).left+3;t.display.sizerWidth=e.adjustWidthTo;e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Ji(t)+t.display.barWidth);e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Qi(t))}if(e.updatedDisplay||e.selectionChanged){e.preparedSelection=i.input.prepareSelection()}}function Dr(e){var t=e.cm;if(e.adjustWidthTo!=null){t.display.sizer.style.minWidth=e.adjustWidthTo+"px";if(e.maxScrollLeft=e.display.viewTo){return}var i=+new Date+e.options.workTime;var n=St(e,t.highlightFrontier);var r=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles;var a=o.text.length>e.options.maxHighlightLength?Je(t.mode,n.state):null;var s=wt(e,o,n,true);if(a){n.state=a}o.styles=s.styles;var f=o.styleClasses,c=s.classes;if(c){o.styleClasses=c}else if(f){o.styleClasses=null}var u=!l||l.length!=o.styles.length||f!=c&&(!f||!c||f.bgClass!=c.bgClass||f.textClass!=c.textClass);for(var h=0;!u&&hi){Br(e,e.options.workDelay);return true}});t.highlightFrontier=n.line;t.modeFrontier=Math.max(t.modeFrontier,n.line);if(r.length){Er(e,function(){for(var t=0;t=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Kn(e)==0){return false}if(Qr(e)){Un(e);t.dims=En(e)}var r=n.first+n.size;var o=Math.max(t.visible.from-e.options.viewportMargin,n.first);var l=Math.min(r,t.visible.to+e.options.viewportMargin);if(i.viewFroml&&i.viewTo-l<20){l=Math.min(r,i.viewTo)}if(Ht){o=oi(e.doc,o);l=li(e.doc,l)}var a=o!=i.viewFrom||l!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vn(e,o,l);i.viewOffset=fi(tt(e.doc,i.viewFrom));e.display.mover.style.top=i.viewOffset+"px";var s=Kn(e);if(!a&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)){return false}var f=Ur(e);if(s>4){i.lineDiv.style.display="none"}Xr(e,i.updateLineNumbers,t.dims);if(s>4){i.lineDiv.style.display=""}i.renderedView=i.view;Gr(f);T(i.cursorDiv);T(i.selectionDiv);i.gutters.style.height=i.sizer.style.minHeight=0;if(a){i.lastWrapHeight=t.wrapperHeight;i.lastWrapWidth=t.wrapperWidth;Br(e,400)}i.updateLineNumbers=null;return true}function Kr(e,t){var i=t.viewport;for(var n=true;;n=false){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Qi(e)){if(i&&i.top!=null){i={top:Math.min(e.doc.height+_i(e.display)-Zi(e),i.top)}}t.visible=or(e.display,e.doc,i);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo){break}}else if(n){t.visible=or(e.display,e.doc,i)}if(!Vr(e,t)){break}nr(e);var r=xr(e);$n(e);Cr(e,r);Yr(e,r);t.force=false}t.signal(e,"update",e);if(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 $r(e,t){var i=new zr(e,t);if(Vr(e,i)){nr(e);Kr(e,i);var n=xr(e);$n(e);Cr(e,n);Yr(e,n);i.finish()}}function Xr(e,t,i){var n=e.display,r=e.options.lineNumbers;var o=n.lineDiv,l=o.firstChild;function a(t){var i=t.nextSibling;if(s&&x&&e.display.currentWheelTarget==t){t.style.display="none"}else{t.parentNode.removeChild(t)}return i}var f=n.view,c=n.viewFrom;for(var u=0;u-1){p=false}Hi(e,h,c,i)}if(p){T(h.lineNumber);h.lineNumber.appendChild(document.createTextNode(st(e.options,c)))}l=h.node.nextSibling}c+=h.size}while(l){l=a(l)}}function _r(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px";Fi(e,"gutterChanged",e)}function Yr(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+Ji(e)+"px"}function Jr(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter)){return}var n=Wn(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var r=t.gutters.offsetWidth,o=n+"px";for(var l=0;l=105){o.wrapper.style.clipPath="inset(0px)"}o.wrapper.setAttribute("translate","no");if(l&&a<8){o.gutters.style.zIndex=-1;o.scroller.style.paddingRight=0}if(!s&&!(i&&y)){o.scroller.draggable=true}if(e){if(e.appendChild){e.appendChild(o.wrapper)}else{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=false;o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null;o.alignWidgets=false;o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null;o.maxLine=null;o.maxLineLength=0;o.maxLineChanged=false;o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null;o.shift=false;o.selForContextMenu=null;o.activeTouch=null;o.gutterSpecs=Zr(r.gutters,r.lineNumbers);eo(o);n.init(o)}var no=0,ro=null;if(l){ro=-.53}else if(i){ro=15}else if(c){ro=-.7}else if(d){ro=-1/3}function oo(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;if(t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS){t=e.detail}if(i==null&&e.detail&&e.axis==e.VERTICAL_AXIS){i=e.detail}else if(i==null){i=e.wheelDelta}return{x:t,y:i}}function lo(e){var t=oo(e);t.x*=ro;t.y*=ro;return t}function ao(e,t){if(c&&u==102){if(e.display.chromeScrollHack==null){e.display.sizer.style.pointerEvents="none"}else{clearTimeout(e.display.chromeScrollHack)}e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null;e.display.sizer.style.pointerEvents=""},100)}var n=oo(t),r=n.x,o=n.y;var l=ro;if(t.deltaMode===0){r=t.deltaX;o=t.deltaY;l=1}var a=e.display,f=a.scroller;var d=f.scrollWidth>f.clientWidth;var p=f.scrollHeight>f.clientHeight;if(!(r&&d||o&&p)){return}if(o&&x&&s){e:for(var m=t.target,g=a.view;m!=f;m=m.parentNode){for(var v=0;v=0&&ct(e,n.to())<=0){return i}}return-1};var fo=function(e,t){this.anchor=e;this.head=t};fo.prototype.from=function(){return pt(this.anchor,this.head)};fo.prototype.to=function(){return dt(this.anchor,this.head)};fo.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function co(e,t,i){var n=e&&e.options.selectionsMayTouch;var r=t[i];t.sort(function(e,t){return ct(e.from(),t.from())});i=V(t,r);for(var o=1;o0:s>=0){var f=pt(a.from(),l.from()),c=dt(a.to(),l.to());var u=a.empty()?l.from()==l.head:a.from()==a.head;if(o<=i){--i}t.splice(--o,2,new fo(u?c:f,u?f:c))}}return new so(t,i)}function uo(e,t){return new so([new fo(e,t||e)],0)}function ho(e){if(!e.text){return e.to}return ft(e.from.line+e.text.length-1,ee(e.text).length+(e.text.length==1?e.from.ch:0))}function po(e,t){if(ct(e,t.from)<0){return e}if(ct(e,t.to)<=0){return ho(t)}var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;if(e.line==t.to.line){n+=ho(t).ch-t.to.ch}return ft(i,n)}function mo(e,t){var i=[];for(var n=0;n1){e.remove(a.line+1,p-1)}e.insert(a.line+1,v)}Fi(e,"change",e,t)}function Co(e,t,i){function n(e,r,o){if(e.linked){for(var l=0;l1&&!e.done[e.done.length-2].ranges){e.done.pop();return ee(e.done)}}function No(e,t,i,n){var r=e.history;r.undone.length=0;var o=+new Date,l;var a;if((r.lastOp==n||r.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&r.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(l=Ao(r,r.lastOp==n))){a=ee(l.changes);if(ct(t.from,t.to)==0&&ct(t.from,a.to)==0){a.to=ho(t)}else{l.changes.push(To(e,t))}}else{var s=ee(r.done);if(!s||!s.ranges){Do(e.sel,r.done)}l={changes:[To(e,t)],generation:r.generation};r.done.push(l);while(r.done.length>r.undoDepth){r.done.shift();if(!r.done[0].ranges){r.done.shift()}}}r.done.push(i);r.generation=++r.maxGeneration;r.lastModTime=r.lastSelTime=o;r.lastOp=r.lastSelOp=n;r.lastOrigin=r.lastSelOrigin=t.origin;if(!a){Ce(e,"historyAdded")}}function Po(e,t,i,n){var r=t.charAt(0);return r=="*"||r=="+"&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Fo(e,t,i,n){var r=e.history,o=n&&n.origin;if(i==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||Po(e,o,ee(r.done),t))){r.done[r.done.length-1]=t}else{Do(t,r.done)}r.lastSelTime=+new Date;r.lastSelOrigin=o;r.lastSelOp=i;if(n&&n.clearRedo!==false){Oo(r.undone)}}function Do(e,t){var i=ee(t);if(!(i&&i.ranges&&i.equals(e))){t.push(e)}}function Ho(e,t,i,n){var r=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,n),function(i){if(i.markedSpans){(r||(r=t["spans_"+e.id]={}))[o]=i.markedSpans}++o})}function Eo(e){if(!e){return null}var t;for(var i=0;i-1){ee(a)[u]=f[u];delete f[u]}}}}}}return n}function Bo(e,t,i,n){if(n){var r=e.anchor;if(i){var o=ct(t,r)<0;if(o!=ct(i,r)<0){r=t;t=i}else if(o!=ct(t,i)<0){t=i}}return new fo(r,t)}else{return new fo(i||t,t)}}function jo(e,t,i,n,r){if(r==null){r=e.cm&&(e.cm.display.shift||e.extend)}Ko(e,new so([Bo(e.sel.primary(),t,i,r)],0),n)}function zo(e,t,i){var n=[];var r=e.cm&&(e.cm.display.shift||e.extend);for(var o=0;o=t.ch:a.to>t.ch))){if(r){Ce(s,"beforeCursorEnter");if(s.explicitlyCleared){if(!o.markedSpans){break}else{--l;continue}}}if(!s.atomic){continue}if(i){var u=s.find(n<0?1:-1),h=void 0;if(n<0?c:f){u=Zo(e,u,-n,u&&u.line==t.line?o:null)}if(u&&u.line==t.line&&(h=ct(u,i))&&(n<0?h<0:h>0)){return Jo(e,u,t,n,r)}}var d=s.find(n<0?-1:1);if(n<0?f:c){d=Zo(e,d,n,d.line==t.line?o:null)}return d?Jo(e,d,t,n,r):null}}}return t}function Qo(e,t,i,n,r){var o=n||1;var l=Jo(e,t,i,o,r)||!r&&Jo(e,t,i,o,true)||Jo(e,t,i,-o,r)||!r&&Jo(e,t,i,-o,true);if(!l){e.cantEdit=true;return ft(e.first,0)}return l}function Zo(e,t,i,n){if(i<0&&t.ch==0){if(t.line>e.first){return gt(e,ft(t.line-1))}else{return null}}else if(i>0&&t.ch==(n||tt(e,t.line)).text.length){if(t.line=0;--r){nl(e,{from:n[r].from,to:n[r].to,text:r?[""]:t.text,origin:t.origin})}}else{nl(e,t)}}function nl(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0){return}var i=mo(e,t);No(e,t,i,e.cm?e.cm.curOp.id:NaN);ll(e,t,i,Ut(e,t));var n=[];Co(e,function(e,i){if(!i&&V(n,e.history)==-1){ul(e.history,t);n.push(e.history)}ll(e,t,null,Ut(e,t))})}function rl(e,t,i){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!i){return}var r=e.history,o,l=e.sel;var a=t=="undo"?r.done:r.undone,s=t=="undo"?r.undone:r.done;var f=0;for(;f=0;--d){var p=h(d);if(p)return p.v}}function ol(e,t){if(t==0){return}e.first+=t;e.sel=new so(te(e.sel.ranges,function(e){return new fo(ft(e.anchor.line+t,e.anchor.ch),ft(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){zn(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,n=i.viewFrom;ne.lastLine()){return}if(t.from.lineo){t={from:t.from,to:ft(o,tt(e,o).text.length),text:[t.text[0]],origin:t.origin}}t.removed=it(e,t.from,t.to);if(!i){i=mo(e,t)}if(e.cm){al(e.cm,t,n)}else{wo(e,t,n)}$o(e,i,X);if(e.cantEdit&&Qo(e,ft(e.firstLine(),0))){e.cantEdit=false}}function al(e,t,i){var n=e.doc,r=e.display,o=t.from,l=t.to;var a=false,s=o.line;if(!e.options.lineWrapping){s=ot(ii(tt(n,o.line)));n.iter(s,l.line+1,function(e){if(e==r.maxLine){a=true;return true}})}if(n.sel.contains(t.from,t.to)>-1){ke(e)}wo(n,t,i,In(e));if(!e.options.lineWrapping){n.iter(s,o.line+t.text.length,function(e){var t=ci(e);if(t>r.maxLineLength){r.maxLine=e;r.maxLineLength=t;r.maxLineChanged=true;a=false}});if(a){e.curOp.updateMaxLine=true}}Ft(n,o.line);Br(e,400);var f=t.text.length-(l.line-o.line)-1;if(t.full){zn(e)}else if(o.line==l.line&&t.text.length==1&&!bo(e.doc,t)){qn(e,o.line,"text")}else{zn(e,o.line,l.line+1,f)}var c=Le(e,"changes"),u=Le(e,"change");if(u||c){var h={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};if(u){Fi(e,"change",e,h)}if(c){(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}}e.display.selForContextMenu=null}function sl(e,t,i,n,r){var o;if(!n){n=i}if(ct(n,i)<0){o=[n,i],i=o[0],n=o[1]}if(typeof t=="string"){t=e.splitLines(t)}il(e,{from:i,to:n,text:t,origin:r})}function fl(e,t,i,n){if(i1||!(this.children[0]instanceof dl))){var a=[];this.collapse(a);this.children=[new dl(a)];this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){var l=r.lines.length%25+25;for(var a=l;a10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var n=0;ne.display.maxLineLength){e.display.maxLine=f;e.display.maxLineLength=c;e.display.maxLineChanged=true}}}if(n!=null&&e&&this.collapsed){zn(e,n,r+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(e){_o(e.doc)}}if(e){Fi(e,"markerCleared",e,this,n,r)}if(t){Or(e)}if(this.parent){this.parent.clear()}};xl.prototype.find=function(e,t){if(e==null&&this.type=="bookmark"){e=1}var i,n;for(var r=0;r0||l==0&&o.clearWhenEmpty!==false){return o}if(o.replacedWith){o.collapsed=true;o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget");if(!n.handleMouseEvents){o.widgetNode.setAttribute("cm-ignore-events","true")}if(n.insertLeft){o.widgetNode.insertLeft=true}}if(o.collapsed){if(ti(e,t.line,t,i,o)||t.line!=i.line&&ti(e,i.line,t,i,o)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}Wt()}if(o.addToHistory){No(e,{from:t,to:i,origin:"markText"},e.sel,NaN)}var a=t.line,s=e.cm,f;e.iter(a,i.line+1,function(n){if(s&&o.collapsed&&!s.options.lineWrapping&&ii(n)==s.display.maxLine){f=true}if(o.collapsed&&a!=t.line){rt(n,0)}jt(n,new It(o,a==t.line?t.ch:null,a==i.line?i.ch:null),e.cm&&e.cm.curOp);++a});if(o.collapsed){e.iter(t.line,i.line+1,function(t){if(ai(e,t)){rt(t,0)}})}if(o.clearOnEnter){xe(o,"beforeCursorEnter",function(){return o.clear()})}if(o.readOnly){Et();if(e.history.done.length||e.history.undone.length){e.clearHistory()}}if(o.collapsed){o.id=++yl;o.atomic=true}if(s){if(f){s.curOp.updateMaxLine=true}if(o.collapsed){zn(s,t.line,i.line+1)}else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title){for(var c=t.line;c<=i.line;c++){qn(s,c,"text")}}if(o.atomic){_o(s.doc)}Fi(s,"markerAdded",s,o)}return o}var wl=function(e,t){this.markers=e;this.primary=t;for(var i=0;i=0;s--){il(this,n[s])}if(a){Vo(this,a)}else if(this.cm){ur(this.cm)}}),undo:Rr(function(){rl(this,"undo")}),redo:Rr(function(){rl(this,"redo")}),undoSelection:Rr(function(){rl(this,"undo",true)}),redoSelection:Rr(function(){rl(this,"redo",true)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,i=0;for(var n=0;n=e.ch)){t.push(r.marker.parent||r.marker)}}}return t},findMarks:function(e,t,i){e=gt(this,e);t=gt(this,t);var n=[],r=e.line;this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l){for(var a=0;a=s.to||s.from==null&&r!=e.line||s.from!=null&&r==t.line&&s.from>=t.ch)&&(!i||i(s.marker))){n.push(s.marker.parent||s.marker)}}}++r});return n},getAllMarks:function(){var e=[];this.iter(function(t){var i=t.markedSpans;if(i){for(var n=0;ne){t=e;return true}e-=o;++i});return gt(this,ft(i,t))},indexFromPos:function(e){e=gt(this,e);var t=e.ch;if(e.linet){t=e.from}if(e.to!=null&&e.to-1){t.state.draggingText(e);setTimeout(function(){return t.display.input.focus()},20);return}try{var u=e.dataTransfer.getData("Text");if(u){var h;if(t.state.draggingText&&!t.state.draggingText.copy){h=t.listSelections()}$o(t.doc,uo(i,i));if(h){for(var d=0;d=0;t--){sl(e.doc,"",n[t].from,n[t].to,"+delete")}ur(e)})}function Jl(e,t,i){var n=ue(e.text,t+i,i);return n<0||n>e.text.length?null:n}function Ql(e,t,i){var n=Jl(e,t.ch,i);return n==null?null:new ft(t.line,n,i<0?"after":"before")}function Zl(e,t,i,n,r){if(e){if(t.doc.direction=="rtl"){r=-r}var o=ve(i,t.doc.direction);if(o){var l=r<0?ee(o):o[0];var a=r<0==(l.level==1);var s=a?"after":"before";var f;if(l.level>0||t.doc.direction=="rtl"){var c=ln(t,i);f=r<0?i.text.length-1:0;var u=an(t,c,f).top;f=he(function(e){return an(t,c,e).top==u},r<0==(l.level==1)?l.from:l.to-1,f);if(s=="before"){f=Jl(i,f,1)}}else{f=r<0?l.to:l.from}return new ft(n,f,s)}}return new ft(n,r<0?i.text.length:0,r<0?"before":"after")}function ea(e,t,i,n){var r=ve(t,e.doc.direction);if(!r){return Ql(t,i,n)}if(i.ch>=t.text.length){i.ch=t.text.length;i.sticky="before"}else if(i.ch<=0){i.ch=0;i.sticky="after"}var o=me(r,i.ch,i.sticky),l=r[o];if(e.doc.direction=="ltr"&&l.level%2==0&&(n>0?l.to>i.ch:l.from=l.from&&h>=c.begin:h<=l.to&&h<=c.end)){var d=u?"before":"after";return new ft(i.line,h,d)}}var p=function(e,t,n){var o=function(e,t){return t?new ft(i.line,a(e,1),"before"):new ft(i.line,e,"after")};for(;e>=0&&e0==(l.level!=1);var f=s?n.begin:a(n.end,-1);if(l.from<=f&&f0?c.end:a(c.begin,-1);if(g!=null&&!(n>0&&g==t.text.length)){m=p(n>0?0:r.length-1,n,f(g));if(m){return m}}return null}var ta={selectAll:el,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),X)},killLine:function(e){return Yl(e,function(t){if(t.empty()){var i=tt(e.doc,t.head.line).text.length;if(t.head.ch==i&&t.head.line0){r=new ft(r.line,r.ch+1);e.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),ft(r.line,r.ch-2),r,"+transpose")}else if(r.line>e.doc.first){var l=tt(e.doc,r.line-1).text;if(l){r=new ft(r.line,1);e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ft(r.line-1,l.length-1),r,"+transpose")}}}i.push(new fo(r,r))}e.setSelections(i)})},newlineAndIndent:function(e){return Er(e,function(){var t=e.listSelections();for(var i=t.length-1;i>=0;i--){e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input")}t=e.listSelections();for(var n=0;ne&&ct(t,this.pos)==0&&i==this.button};var xa,ba;function wa(e,t){var i=+new Date;if(ba&&ba.compare(i,e,t)){xa=ba=null;return"triple"}else if(xa&&xa.compare(i,e,t)){ba=new ya(i,e,t);xa=null;return"double"}else{xa=new ya(i,e,t);ba=null;return"single"}}function Ca(e){var t=this,i=t.display;if(Se(t,e)||i.activeTouch&&i.input.supportsTouch()){return}i.input.ensurePolled();i.shift=e.shiftKey;if($i(i,e)){if(!s){i.scroller.draggable=false;setTimeout(function(){return i.scroller.draggable=true},100)}return}if(Pa(t,e)){return}var n=Bn(t,e),r=Fe(e),o=n?wa(n,r):"single";j(t).focus();if(r==1&&t.state.selectingText){t.state.selectingText(e)}if(n&&Sa(t,r,n,o,e)){return}if(r==1){if(n){La(t,n,o,e)}else if(Pe(e)==i.scroller){Te(e)}}else if(r==2){if(n){jo(t.doc,n)}setTimeout(function(){return i.input.focus()},20)}else if(r==3){if(k){t.display.input.onContextMenu(e)}else{er(t)}}}function Sa(e,t,i,n,r){var o="Click";if(n=="double"){o="Double"+o}else if(n=="triple"){o="Triple"+o}o=(t==1?"Left":t==2?"Middle":"Right")+o;return sa(e,$l(o,r),r,function(t){if(typeof t=="string"){t=ta[t]}if(!t){return false}var n=false;try{if(e.isReadOnly()){e.state.suppressEdits=true}n=t(e,i)!=$}finally{e.state.suppressEdits=false}return n})}function ka(e,t,i){var n=e.getOption("configureMouse");var r=n?n(e,t,i):{};if(r.unit==null){var o=b?i.shiftKey&&i.metaKey:i.altKey;r.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}if(r.extend==null||e.doc.extend){r.extend=e.doc.extend||i.shiftKey}if(r.addNew==null){r.addNew=x?i.metaKey:i.ctrlKey}if(r.moveOnDrag==null){r.moveOnDrag=!(x?i.altKey:i.ctrlKey)}return r}function La(e,t,i,n){if(l){setTimeout(z(Zn,e),0)}else{e.curOp.focus=D(R(e))}var r=ka(e,i,n);var o=e.doc.sel,a;if(e.options.dragDrop&&De&&!e.isReadOnly()&&i=="single"&&(a=o.contains(t))>-1&&(ct((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(ct(a.to(),t)>0||t.xRel<0)){Ma(e,n,t,r)}else{Oa(e,n,t,r)}}function Ma(e,t,i,n){var r=e.display,o=false;var f=Wr(e,function(t){if(s){r.scroller.draggable=false}e.state.draggingText=false;if(e.state.delayingBlurEvent){if(e.hasFocus()){e.state.delayingBlurEvent=false}else{er(e)}}we(r.wrapper.ownerDocument,"mouseup",f);we(r.wrapper.ownerDocument,"mousemove",c);we(r.scroller,"dragstart",u);we(r.scroller,"drop",f);if(!o){Te(t);if(!n.addNew){jo(e.doc,i,null,null,n.extend)}if(s&&!d||l&&a==9){setTimeout(function(){r.wrapper.ownerDocument.body.focus({preventScroll:true});r.input.focus()},20)}else{r.input.focus()}}});var c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10};var u=function(){return o=true};if(s){r.scroller.draggable=true}e.state.draggingText=f;f.copy=!n.moveOnDrag;xe(r.wrapper.ownerDocument,"mouseup",f);xe(r.wrapper.ownerDocument,"mousemove",c);xe(r.scroller,"dragstart",u);xe(r.scroller,"drop",f);e.state.delayingBlurEvent=true;setTimeout(function(){return r.input.focus()},20);if(r.scroller.dragDrop){r.scroller.dragDrop()}}function Ta(e,t,i){if(i=="char"){return new fo(t,t)}if(i=="word"){return e.findWordAt(t)}if(i=="line"){return new fo(ft(t.line,0),gt(e.doc,ft(t.line+1,0)))}var n=i(e,t);return new fo(n.from,n.to)}function Oa(e,t,i,n){if(l){er(e)}var r=e.display,o=e.doc;Te(t);var a,s,f=o.sel,c=f.ranges;if(n.addNew&&!n.extend){s=o.sel.contains(i);if(s>-1){a=c[s]}else{a=new fo(i,i)}}else{a=o.sel.primary();s=o.sel.primIndex}if(n.unit=="rectangle"){if(!n.addNew){a=new fo(i,i)}i=Bn(e,t,true,true);s=-1}else{var u=Ta(e,i,n.unit);if(n.extend){a=Bo(a,u.anchor,u.head,n.extend)}else{a=u}}if(!n.addNew){s=0;Ko(o,new so([a],0),_);f=o.sel}else if(s==-1){s=c.length;Ko(o,co(e,c.concat([a]),s),{scroll:false,origin:"*mouse"})}else if(c.length>1&&c[s].empty()&&n.unit=="char"&&!n.extend){Ko(o,co(e,c.slice(0,s).concat(c.slice(s+1)),0),{scroll:false,origin:"*mouse"});f=o.sel}else{qo(o,s,a,_)}var h=i;function d(t){if(ct(h,t)==0){return}h=t;if(n.unit=="rectangle"){var r=[],l=e.options.tabSize;var c=U(tt(o,i.line).text,i.ch,l);var u=U(tt(o,t.line).text,t.ch,l);var d=Math.min(c,u),p=Math.max(c,u);for(var m=Math.min(i.line,t.line),g=Math.min(e.lastLine(),Math.max(i.line,t.line));m<=g;m++){var v=tt(o,m).text,y=J(v,d,l);if(d==p){r.push(new fo(ft(m,y),ft(m,y)))}else if(v.length>y){r.push(new fo(ft(m,y),ft(m,J(v,p,l))))}}if(!r.length){r.push(new fo(i,i))}Ko(o,co(e,f.ranges.slice(0,s).concat(r),s),{origin:"*mouse",scroll:false});e.scrollIntoView(t)}else{var x=a;var b=Ta(e,t,n.unit);var w=x.anchor,C;if(ct(b.anchor,w)>0){C=b.head;w=pt(x.from(),b.anchor)}else{C=b.anchor;w=dt(x.to(),b.head)}var S=f.ranges.slice(0);S[s]=Aa(e,new fo(gt(o,w),C));Ko(o,co(e,S,s),_)}}var p=r.wrapper.getBoundingClientRect();var m=0;function g(t){var i=++m;var l=Bn(e,t,true,n.unit=="rectangle");if(!l){return}if(ct(l,h)!=0){e.curOp.focus=D(R(e));d(l);var a=or(r,o);if(l.line>=a.to||l.linep.bottom?20:0;if(s){setTimeout(Wr(e,function(){if(m!=i){return}r.scroller.scrollTop+=s;g(t)}),50)}}}function v(t){e.state.selectingText=false;m=Infinity;if(t){Te(t);r.input.focus()}we(r.wrapper.ownerDocument,"mousemove",y);we(r.wrapper.ownerDocument,"mouseup",x);o.history.lastSelOrigin=null}var y=Wr(e,function(e){if(e.buttons===0||!Fe(e)){v(e)}else{g(e)}});var x=Wr(e,v);e.state.selectingText=x;xe(r.wrapper.ownerDocument,"mousemove",y);xe(r.wrapper.ownerDocument,"mouseup",x)}function Aa(e,t){var i=t.anchor;var n=t.head;var r=tt(e.doc,i.line);if(ct(i,n)==0&&i.sticky==n.sticky){return t}var o=ve(r);if(!o){return t}var l=me(o,i.ch,i.sticky),a=o[l];if(a.from!=i.ch&&a.to!=i.ch){return t}var s=l+(a.from==i.ch==(a.level!=1)?0:1);if(s==0||s==o.length){return t}var f;if(n.line!=i.line){f=(n.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0}else{var c=me(o,n.ch,n.sticky);var u=c-l||(n.ch-i.ch)*(a.level==1?-1:1);if(c==s-1||c==s){f=u<0}else{f=u>0}}var h=o[s+(f?-1:0)];var d=f==(h.level==1);var p=d?h.from:h.to,m=d?"after":"before";return i.ch==p&&i.sticky==m?t:new fo(new ft(i.line,p,m),n)}function Na(e,t,i,n){var r,o;if(t.touches){r=t.touches[0].clientX;o=t.touches[0].clientY}else{try{r=t.clientX;o=t.clientY}catch(e){return false}}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right)){return false}if(n){Te(t)}var l=e.display;var a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!Le(e,i)){return Ae(t)}o-=a.top-l.viewOffset;for(var s=0;s=r){var c=lt(e.doc,o);var u=e.display.gutterSpecs[s];Ce(e,i,e,c,u.className,t);return Ae(t)}}}function Pa(e,t){return Na(e,t,"gutterClick",true)}function Fa(e,t){if($i(e.display,t)||Da(e,t)){return}if(Se(e,t,"contextmenu")){return}if(!k){e.display.input.onContextMenu(t)}}function Da(e,t){if(!Le(e,"gutterContextMenu")){return false}return Na(e,t,"gutterContextMenu",false)}function Ha(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");mn(e)}var Ea={toString:function(){return"CodeMirror.Init"}};var Wa={};var Ia={};function Ra(e){var t=e.optionHandlers;function i(i,n,r,o){e.defaults[i]=n;if(r){t[i]=o?function(e,t,i){if(i!=Ea){r(e,t,i)}}:r}}e.defineOption=i;e.Init=Ea;i("value","",function(e,t){return e.setValue(t)},true);i("mode",null,function(e,t){e.doc.modeOption=t;yo(e)},true);i("indentUnit",2,yo,true);i("indentWithTabs",false);i("smartIndent",true);i("tabSize",4,function(e){xo(e);mn(e);zn(e)},true);i("lineSeparator",null,function(e,t){e.doc.lineSep=t;if(!t){return}var i=[],n=e.doc.first;e.doc.iter(function(e){for(var r=0;;){var o=e.text.indexOf(t,r);if(o==-1){break}r=o+t.length;i.push(ft(n,o))}n++});for(var r=i.length-1;r>=0;r--){sl(e.doc,t,i[r],ft(i[r].line,i[r].ch+t.length))}});i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(e,t,i){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");if(i!=Ea){e.refresh()}});i("specialCharPlaceholder",xi,function(e){return e.refresh()},true);i("electricChars",true);i("inputStyle",y?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);i("spellcheck",false,function(e,t){return e.getInputField().spellcheck=t},true);i("autocorrect",false,function(e,t){return e.getInputField().autocorrect=t},true);i("autocapitalize",false,function(e,t){return e.getInputField().autocapitalize=t},true);i("rtlMoveVisually",!w);i("wholeLineUpdateBefore",true);i("theme","default",function(e){Ha(e);to(e)},true);i("keyMap","default",function(e,t,i){var n=_l(t);var r=i!=Ea&&_l(i);if(r&&r.detach){r.detach(e,n)}if(n.attach){n.attach(e,r||null)}});i("extraKeys",null);i("configureMouse",null);i("lineWrapping",false,ja,true);i("gutters",[],function(e,t){e.display.gutterSpecs=Zr(t,e.options.lineNumbers);to(e)},true);i("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?Wn(e.display)+"px":"0";e.refresh()},true);i("coverGutterNextToScrollbar",false,function(e){return Cr(e)},true);i("scrollbarStyle","native",function(e){Lr(e);Cr(e);e.display.scrollbars.setScrollTop(e.doc.scrollTop);e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},true);i("lineNumbers",false,function(e,t){e.display.gutterSpecs=Zr(e.options.gutters,t);to(e)},true);i("firstLineNumber",1,to,true);i("lineNumberFormatter",function(e){return e},to,true);i("showCursorWhenSelecting",false,$n,true);i("resetSelectionOnContextMenu",true);i("lineWiseCopyCut",true);i("pasteLinesPerSelection",true);i("selectionsMayTouch",false);i("readOnly",false,function(e,t){if(t=="nocursor"){ir(e);e.display.input.blur()}e.display.input.readOnlyChanged(t)});i("screenReaderLabel",null,function(e,t){t=t===""?null:t;e.display.input.screenReaderLabelChanged(t)});i("disableInput",false,function(e,t){if(!t){e.display.input.reset()}},true);i("dragDrop",true,Ba);i("allowDropFileTypes",null);i("cursorBlinkRate",530);i("cursorScrollMargin",0);i("cursorHeight",1,$n,true);i("singleCursorHeightPerLine",true,$n,true);i("workTime",100);i("workDelay",100);i("flattenSpans",true,xo,true);i("addModeClass",false,xo,true);i("pollInterval",100);i("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t});i("historyEventDelay",1250);i("viewportMargin",10,function(e){return e.refresh()},true);i("maxHighlightLength",1e4,xo,true);i("moveInputWithCursor",true,function(e,t){if(!t){e.display.input.resetPosition()}});i("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""});i("autofocus",null);i("direction","ltr",function(e,t){return e.doc.setDirection(t)},true);i("phrases",null)}function Ba(e,t,i){var n=i&&i!=Ea;if(!t!=!n){var r=e.display.dragFunctions;var o=t?xe:we;o(e.display.scroller,"dragstart",r.start);o(e.display.scroller,"dragenter",r.enter);o(e.display.scroller,"dragover",r.over);o(e.display.scroller,"dragleave",r.leave);o(e.display.scroller,"drop",r.drop)}}function ja(e){if(e.options.lineWrapping){H(e.display.wrapper,"CodeMirror-wrap");e.display.sizer.style.minWidth="";e.display.sizerWidth=null}else{M(e.display.wrapper,"CodeMirror-wrap");ui(e)}Rn(e);zn(e);mn(e);setTimeout(function(){return Cr(e)},100)}function za(e,t){var i=this;if(!(this instanceof za)){return new za(e,t)}this.options=t=t?q(t):{};q(Wa,t,false);var n=t.value;if(typeof n=="string"){n=new Tl(n,t.mode,null,t.lineSeparator,t.direction)}else if(t.mode){n.modeOption=t.mode}this.doc=n;var r=new za.inputStyles[t.inputStyle](this);var o=this.display=new io(e,n,r,t);o.wrapper.CodeMirror=this;Ha(this);if(t.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}Lr(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:-1,cutIncoming:-1,selectingText:false,draggingText:false,highlight:new G,keySeq:null,specialChars:null};if(t.autofocus&&!y){o.input.focus()}if(l&&a<11){setTimeout(function(){return i.display.input.reset(true)},20)}qa(this);El();Tr(this);this.curOp.forceUpdate=true;So(this,n);if(t.autofocus&&!y||this.hasFocus()){setTimeout(function(){if(i.hasFocus()&&!i.state.focused){tr(i)}},20)}else{ir(this)}for(var f in Ia){if(Ia.hasOwnProperty(f)){Ia[f](this,t[f],Ea)}}Qr(this);if(t.finishInit){t.finishInit(this)}for(var c=0;c20*20}xe(t.scroller,"touchstart",function(r){if(!Se(e,r)&&!o(r)&&!Pa(e,r)){t.input.ensurePolled();clearTimeout(i);var l=+new Date;t.activeTouch={start:l,moved:false,prev:l-n.end<=300?n:null};if(r.touches.length==1){t.activeTouch.left=r.touches[0].pageX;t.activeTouch.top=r.touches[0].pageY}}});xe(t.scroller,"touchmove",function(){if(t.activeTouch){t.activeTouch.moved=true}});xe(t.scroller,"touchend",function(i){var n=t.activeTouch;if(n&&!$i(t,i)&&n.left!=null&&!n.moved&&new Date-n.start<300){var o=e.coordsChar(t.activeTouch,"page"),l;if(!n.prev||s(n,n.prev)){l=new fo(o,o)}else if(!n.prev.prev||s(n,n.prev.prev)){l=e.findWordAt(o)}else{l=new fo(ft(o.line,0),gt(e.doc,ft(o.line+1,0)))}e.setSelection(l.anchor,l.head);e.focus();Te(i)}r()});xe(t.scroller,"touchcancel",r);xe(t.scroller,"scroll",function(){if(t.scroller.clientHeight){gr(e,t.scroller.scrollTop);yr(e,t.scroller.scrollLeft,true);Ce(e,"scroll",e)}});xe(t.scroller,"mousewheel",function(t){return ao(e,t)});xe(t.scroller,"DOMMouseScroll",function(t){return ao(e,t)});xe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0});t.dragFunctions={enter:function(t){if(!Se(e,t)){Ne(t)}},over:function(t){if(!Se(e,t)){Pl(e,t);Ne(t)}},start:function(t){return Nl(e,t)},drop:Wr(e,Al),leave:function(t){if(!Se(e,t)){Fl(e)}}};var f=t.input.getField();xe(f,"keyup",function(t){return ma.call(e,t)});xe(f,"keydown",Wr(e,da));xe(f,"keypress",Wr(e,ga));xe(f,"focus",function(t){return tr(e,t)});xe(f,"blur",function(t){return ir(e,t)})}var Ua=[];za.defineInitHook=function(e){return Ua.push(e)};function Ga(e,t,i,n){var r=e.doc,o;if(i==null){i="add"}if(i=="smart"){if(!r.mode.indent){i="prev"}else{o=St(e,t).state}}var l=e.options.tabSize;var a=tt(r,t),s=U(a.text,null,l);if(a.stateAfter){a.stateAfter=null}var f=a.text.match(/^\s*/)[0],c;if(!n&&!/\S/.test(a.text)){c=0;i="not"}else if(i=="smart"){c=r.mode.indent(o,a.text.slice(f.length),a.text);if(c==$||c>150){if(!n){return}i="prev"}}if(i=="prev"){if(t>r.first){c=U(tt(r,t-1).text,null,l)}else{c=0}}else if(i=="add"){c=s+e.options.indentUnit}else if(i=="subtract"){c=s-e.options.indentUnit}else if(typeof i=="number"){c=s+i}c=Math.max(0,c);var u="",h=0;if(e.options.indentWithTabs){for(var d=Math.floor(c/l);d;--d){h+=l;u+="\t"}}if(hl;var s=Re(t),f=null;if(a&&n.ranges.length>1){if(Va&&Va.text.join("\n")==t){if(n.ranges.length%Va.text.length==0){f=[];for(var c=0;c=0;h--){var d=n.ranges[h];var p=d.from(),m=d.to();if(d.empty()){if(i&&i>0){p=ft(p.line,p.ch-i)}else if(e.state.overwrite&&!a){m=ft(m.line,Math.min(tt(o,m.line).text.length,m.ch+ee(s).length))}else if(a&&Va&&Va.lineWise&&Va.text.join("\n")==s.join("\n")){p=m=ft(p.line,0)}}var g={from:p,to:m,text:f?f[h%f.length]:s,origin:r||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};il(e.doc,g);Fi(e,"inputRead",e,g)}if(t&&!a){_a(e,t)}ur(e);if(e.curOp.updateInput<2){e.curOp.updateInput=u}e.curOp.typing=true;e.state.pasteIncoming=e.state.cutIncoming=-1}function Xa(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i){e.preventDefault();if(!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()){Er(t,function(){return $a(t,i,0,null,"paste")})}return true}}function _a(e,t){if(!e.options.electricChars||!e.options.smartIndent){return}var i=e.doc.sel;for(var n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line){continue}var o=e.getModeAt(r.head);var l=false;if(o.electricChars){for(var a=0;a-1){l=Ga(e,r.head.line,"smart");break}}}else if(o.electricInput){if(o.electricInput.test(tt(e.doc,r.head.line).text.slice(0,r.head.ch))){l=Ga(e,r.head.line,"smart")}}if(l){Fi(e,"electricInput",e,r.head.line)}}}function Ya(e){var t=[],i=[];for(var n=0;n0){qo(this.doc,n,new fo(o,f[n].to()),X)}}else if(r.head.line>i){Ga(this,r.head.line,e,true);i=r.head.line;if(n==this.doc.sel.primIndex){ur(this)}}}}),getTokenAt:function(e,t){return Ot(this,e,t)},getLineTokens:function(e,t){return Ot(this,ft(e),t,true)},getTokenTypeAt:function(e){e=gt(this.doc,e);var t=Ct(this,tt(this.doc,e.line));var i=0,n=(t.length-1)/2,r=e.ch;var o;if(r==0){o=t[2]}else{for(;;){var l=i+n>>1;if((l?t[l*2-1]:0)>=r){n=l}else if(t[l*2+1]o){e=o;n=true}r=tt(this.doc,e)}else{r=e}return xn(this,r,{top:0,left:0},t||"page",i||n).top+(n?this.doc.height-fi(r):0)},defaultTextHeight:function(){return Dn(this.display)},defaultCharWidth:function(){return Hn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,n,r){var o=this.display;e=Cn(this,gt(this.doc,e));var l=e.bottom,a=e.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);o.sizer.appendChild(t);if(n=="over"){l=e.top}else if(n=="above"||n=="near"){var s=Math.max(o.wrapper.clientHeight,this.doc.height),f=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);if((n=="above"||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight){l=e.top-t.offsetHeight}else if(e.bottom+t.offsetHeight<=s){l=e.bottom}if(a+t.offsetWidth>f){a=f-t.offsetWidth}}t.style.top=l+"px";t.style.left=t.style.right="";if(r=="right"){a=o.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{if(r=="left"){a=0}else if(r=="middle"){a=(o.sizer.clientWidth-t.offsetWidth)/2}t.style.left=a+"px"}if(i){sr(this,{left:a,top:l,right:a+t.offsetWidth,bottom:l+t.offsetHeight})}},triggerOnKeyDown:Ir(da),triggerOnKeyPress:Ir(ga),triggerOnKeyUp:ma,triggerOnMouseDown:Ir(Ca),execCommand:function(e){if(ta.hasOwnProperty(e)){return ta[e].call(null,this)}},triggerElectric:Ir(function(e){_a(this,e)}),findPosH:function(e,t,i,n){var r=1;if(t<0){r=-1;t=-t}var o=gt(this.doc,e);for(var l=0;l0&&a(i.charAt(n-1))){--n}while(r.5||this.options.lineWrapping){Rn(this)}Ce(this,"refresh",this)}),swapDoc:Ir(function(e){var t=this.doc;t.cm=null;if(this.state.selectingText){this.state.selectingText()}So(this,e);mn(this);this.display.input.reset();hr(this,e.scrollLeft,e.scrollTop);this.curOp.forceScroll=true;Fi(this,"swapDoc",this,t);return 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}};Me(e);e.registerHelper=function(t,n,r){if(!i.hasOwnProperty(t)){i[t]=e[t]={_global:[]}}i[t][n]=r};e.registerGlobalHelper=function(t,n,r,o){e.registerHelper(t,n,o);i[t]._global.push({pred:r,val:o})}}function es(e,t,i,n,r){var o=t;var l=i;var a=tt(e,t.line);var s=r&&e.direction=="rtl"?-i:i;function f(){var i=t.line+s;if(i=e.first+e.size){return false}t=new ft(i,t.ch,t.sticky);return a=tt(e,i)}function c(o){var l;if(n=="codepoint"){var c=a.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(c)){l=null}else{var u=i>0?c>=55296&&c<56320:c>=56320&&c<57343;l=new ft(t.line,Math.max(0,Math.min(a.text.length,t.ch+i*(u?2:1))),-i)}}else if(r){l=ea(e.cm,a,t,i)}else{l=Ql(a,t,i)}if(l==null){if(!o&&f()){t=Zl(r,e.cm,a,t.line,s)}else{return false}}else{t=l}return true}if(n=="char"||n=="codepoint"){c()}else if(n=="column"){c(true)}else if(n=="word"||n=="group"){var u=null,h=n=="group";var d=e.cm&&e.cm.getHelper(t,"wordChars");for(var p=true;;p=false){if(i<0&&!c(!p)){break}var m=a.text.charAt(t.ch)||"\n";var g=ae(m,d)?"w":h&&m=="\n"?"n":!h||/\s/.test(m)?null:"p";if(h&&!p&&!g){g="s"}if(u&&u!=g){if(i<0){i=1;c();t.sticky="after"}break}if(g){u=g}if(i>0&&!c(!p)){break}}}var v=Qo(e,t,o,l,true);if(ut(o,v)){v.hitSide=true}return v}function ts(e,t,i,n){var r=e.doc,o=t.left,l;if(n=="page"){var a=Math.min(e.display.wrapper.clientHeight,j(e).innerHeight||r(e).documentElement.clientHeight);var s=Math.max(a-.5*Dn(e.display),3);l=(i>0?t.bottom:t.top)+i*s}else if(n=="line"){l=i>0?t.bottom+3:t.top-3}var f;for(;;){f=Ln(e,o,l);if(!f.outside){break}if(i<0?l<=0:l>=r.height){f.hitSide=true;break}l+=i*5}return f}var is=function(e){this.cm=e;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new G;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};is.prototype.init=function(e){var t=this;var i=this,n=i.cm;var r=i.div=e.lineDiv;r.contentEditable=true;Ja(r,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function o(e){for(var t=e.target;t;t=t.parentNode){if(t==r){return true}if(/\bCodeMirror-(?:line)?widget\b/.test(t.className)){break}}return false}xe(r,"paste",function(e){if(!o(e)||Se(n,e)||Xa(e,n)){return}if(a<=11){setTimeout(Wr(n,function(){return t.updateFromDOM()}),20)}});xe(r,"compositionstart",function(e){t.composing={data:e.data,done:false}});xe(r,"compositionupdate",function(e){if(!t.composing){t.composing={data:e.data,done:false}}});xe(r,"compositionend",function(e){if(t.composing){if(e.data!=t.composing.data){t.readFromDOMSoon()}t.composing.done=true}});xe(r,"touchstart",function(){return i.forceCompositionEnd()});xe(r,"input",function(){if(!t.composing){t.readFromDOMSoon()}});function l(e){if(!o(e)||Se(n,e)){return}if(n.somethingSelected()){Ka({lineWise:false,text:n.getSelections()});if(e.type=="cut"){n.replaceSelection("",null,"cut")}}else if(!n.options.lineWiseCopyCut){return}else{var t=Ya(n);Ka({lineWise:true,text:t.text});if(e.type=="cut"){n.operation(function(){n.setSelections(t.ranges,0,X);n.replaceSelection("",null,"cut")})}}if(e.clipboardData){e.clipboardData.clearData();var l=Va.text.join("\n");e.clipboardData.setData("Text",l);if(e.clipboardData.getData("Text")==l){e.preventDefault();return}}var a=Qa(),s=a.firstChild;Ja(s);n.display.lineSpace.insertBefore(a,n.display.lineSpace.firstChild);s.value=Va.text.join("\n");var f=D(B(r));W(s);setTimeout(function(){n.display.lineSpace.removeChild(a);f.focus();if(f==r){i.showPrimarySelection()}},50)}xe(r,"copy",l);xe(r,"cut",l)};is.prototype.screenReaderLabelChanged=function(e){if(e){this.div.setAttribute("aria-label",e)}else{this.div.removeAttribute("aria-label")}};is.prototype.prepareSelection=function(){var e=Xn(this.cm,false);e.focus=D(B(this.div))==this.div;return e};is.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length){return}if(e.focus||t){this.showPrimarySelection()}this.showMultipleSelections(e)};is.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};is.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary();var r=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||o.line=t.display.viewFrom&&ns(t,r)||{node:s[0].measure.map[2],offset:0};var c=o.linee.firstLine()){n=ft(n.line-1,tt(e.doc,n.line-1).length)}if(r.ch==tt(e.doc,r.line).text.length&&r.linet.viewTo-1){return false}var o,l,a;if(n.line==t.viewFrom||(o=jn(e,n.line))==0){l=ot(t.view[0].line);a=t.view[0].node}else{l=ot(t.view[o].line);a=t.view[o-1].node.nextSibling}var s=jn(e,r.line);var f,c;if(s==t.view.length-1){f=t.viewTo-1;c=t.lineDiv.lastChild}else{f=ot(t.view[s+1].line)-1;c=t.view[s+1].node.previousSibling}if(!a){return false}var u=e.doc.splitLines(ls(e,a,c,l,f));var h=it(e.doc,ft(l,0),ft(f,tt(e.doc,f).text.length));while(u.length>1&&h.length>1){if(ee(u)==ee(h)){u.pop();h.pop();f--}else if(u[0]==h[0]){u.shift();h.shift();l++}else{break}}var d=0,p=0;var m=u[0],g=h[0],v=Math.min(m.length,g.length);while(dn.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1)){d--;p++}}u[u.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,"");u[0]=u[0].slice(d).replace(/\u200b+$/,"");var w=ft(l,d);var C=ft(f,h.length?ee(h).length-p:0);if(u.length>1||u[0]||ct(w,C)){sl(e.doc,u,w,C,"+input");return true}};is.prototype.ensurePolled=function(){this.forceCompositionEnd()};is.prototype.reset=function(){this.forceCompositionEnd()};is.prototype.forceCompositionEnd=function(){if(!this.composing){return}clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()};is.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null){return}this.readDOMTimeout=setTimeout(function(){e.readDOMTimeout=null;if(e.composing){if(e.composing.done){e.composing=null}else{return}}e.updateFromDOM()},80)};is.prototype.updateFromDOM=function(){var e=this;if(this.cm.isReadOnly()||!this.pollContent()){Er(this.cm,function(){return zn(e.cm)})}};is.prototype.setUneditable=function(e){e.contentEditable="false"};is.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing){return}e.preventDefault();if(!this.cm.isReadOnly()){Wr(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)}};is.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")};is.prototype.onContextMenu=function(){};is.prototype.resetPosition=function(){};is.prototype.needsContentAttribute=true;function ns(e,t){var i=on(e,t.line);if(!i||i.hidden){return null}var n=tt(e.doc,t.line);var r=tn(i,n,t.line);var o=ve(n,e.doc.direction),l="left";if(o){var a=me(o,t.ch);l=a%2?"right":"left"}var s=fn(r.map,t.ch,l);s.offset=s.collapse=="right"?s.end:s.start;return s}function rs(e){for(var t=e;t;t=t.parentNode){if(/CodeMirror-gutter-wrapper/.test(t.className)){return true}}return false}function os(e,t){if(t){e.bad=true}return e}function ls(e,t,i,n,r){var o="",l=false,a=e.doc.lineSeparator(),s=false;function f(e){return function(t){return t.id==e}}function c(){if(l){o+=a;if(s){o+=a}l=s=false}}function u(e){if(e){c();o+=e}}function h(t){if(t.nodeType==1){var i=t.getAttribute("cm-text");if(i){u(i);return}var o=t.getAttribute("cm-marker"),d;if(o){var p=e.findMarks(ft(n,0),ft(r+1,0),f(+o));if(p.length&&(d=p[0].find(0))){u(it(e.doc,d.from,d.to).join(a))}return}if(t.getAttribute("contenteditable")=="false"){return}var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&t.textContent.length==0){return}if(m){c()}for(var g=0;g=9&&t.hasSelection){t.hasSelection=null}i.poll()});xe(r,"paste",function(e){if(Se(n,e)||Xa(e,n)){return}n.state.pasteIncoming=+new Date;i.fastPoll()});function o(e){if(Se(n,e)){return}if(n.somethingSelected()){Ka({lineWise:false,text:n.getSelections()})}else if(!n.options.lineWiseCopyCut){return}else{var t=Ya(n);Ka({lineWise:true,text:t.text});if(e.type=="cut"){n.setSelections(t.ranges,null,X)}else{i.prevInput="";r.value=t.text.join("\n");W(r)}}if(e.type=="cut"){n.state.cutIncoming=+new Date}}xe(r,"cut",o);xe(r,"copy",o);xe(e.scroller,"paste",function(t){if($i(e,t)||Se(n,t)){return}if(!r.dispatchEvent){n.state.pasteIncoming=+new Date;i.focus();return}var o=new Event("paste");o.clipboardData=t.clipboardData;r.dispatchEvent(o)});xe(e.lineSpace,"selectstart",function(t){if(!$i(e,t)){Te(t)}});xe(r,"compositionstart",function(){var e=n.getCursor("from");if(i.composing){i.composing.range.clear()}i.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}});xe(r,"compositionend",function(){if(i.composing){i.poll();i.composing.range.clear();i.composing=null}})};fs.prototype.createField=function(e){this.wrapper=Qa();this.textarea=this.wrapper.firstChild;var t=this.cm.options;Ja(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)};fs.prototype.screenReaderLabelChanged=function(e){if(e){this.textarea.setAttribute("aria-label",e)}else{this.textarea.removeAttribute("aria-label")}};fs.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc;var n=Xn(e);if(e.options.moveInputWithCursor){var r=Cn(e,i.sel.primary().head,"div");var o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+l.top-o.top));n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+l.left-o.left))}return n};fs.prototype.showSelection=function(e){var t=this.cm,i=t.display;O(i.cursorDiv,e.cursors);O(i.selectionDiv,e.selection);if(e.teTop!=null){this.wrapper.style.top=e.teTop+"px";this.wrapper.style.left=e.teLeft+"px"}};fs.prototype.reset=function(e){if(this.contextMenuPending||this.composing&&e){return}var t=this.cm;this.resetting=true;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i;if(t.state.focused){W(this.textarea)}if(l&&a>=9){this.hasSelection=i}}else if(!e){this.prevInput=this.textarea.value="";if(l&&a>=9){this.hasSelection=null}}this.resetting=false};fs.prototype.getField=function(){return this.textarea};fs.prototype.supportsTouch=function(){return false};fs.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!y||D(B(this.textarea))!=this.textarea)){try{this.textarea.focus()}catch(e){}}};fs.prototype.blur=function(){this.textarea.blur()};fs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};fs.prototype.receivedFocus=function(){this.slowPoll()};fs.prototype.slowPoll=function(){var e=this;if(this.pollingFast){return}this.polling.set(this.cm.options.pollInterval,function(){e.poll();if(e.cm.state.focused){e.slowPoll()}})};fs.prototype.fastPoll=function(){var e=false,t=this;t.pollingFast=true;function i(){var n=t.poll();if(!n&&!e){e=true;t.polling.set(60,i)}else{t.pollingFast=false;t.slowPoll()}}t.polling.set(20,i)};fs.prototype.poll=function(){var e=this;var t=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Be(i)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq){return false}var r=i.value;if(r==n&&!t.somethingSelected()){return false}if(l&&a>=9&&this.hasSelection===r||x&&/[\uf700-\uf7ff]/.test(r)){t.display.input.reset();return false}if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(o==8203&&!n){n="​"}if(o==8666){this.reset();return this.cm.execCommand("undo")}}var s=0,f=Math.min(n.length,r.length);while(s1e3||r.indexOf("\n")>-1){i.value=e.prevInput=""}else{e.prevInput=r}if(e.composing){e.composing.range.clear();e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"})}});return true};fs.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}};fs.prototype.onKeyPress=function(){if(l&&a>=9){this.hasSelection=null}this.fastPoll()};fs.prototype.onContextMenu=function(e){var t=this,i=t.cm,n=i.display,r=t.textarea;if(t.contextMenuPending){t.contextMenuPending()}var o=Bn(i,e),f=n.scroller.scrollTop;if(!o||h){return}var c=i.options.resetSelectionOnContextMenu;if(c&&i.doc.sel.contains(o)==-1){Wr(i,Ko)(i.doc,uo(o),X)}var u=r.style.cssText,d=t.wrapper.style.cssText;var p=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static";r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var m;if(s){m=r.ownerDocument.defaultView.scrollY}n.input.focus();if(s){r.ownerDocument.defaultView.scrollTo(null,m)}n.input.reset();if(!i.somethingSelected()){r.value=t.prevInput=" "}t.contextMenuPending=v;n.selForContextMenu=i.doc.sel;clearTimeout(n.detectingSelectAll);function g(){if(r.selectionStart!=null){var e=i.somethingSelected();var o="​"+(e?r.value:"");r.value="⇚";r.value=o;t.prevInput=e?"":"​";r.selectionStart=1;r.selectionEnd=o.length;n.selForContextMenu=i.doc.sel}}function v(){if(t.contextMenuPending!=v){return}t.contextMenuPending=false;t.wrapper.style.cssText=d;r.style.cssText=u;if(l&&a<9){n.scrollbars.setScrollTop(n.scroller.scrollTop=f)}if(r.selectionStart!=null){if(!l||l&&a<9){g()}var e=0,o=function(){if(n.selForContextMenu==i.doc.sel&&r.selectionStart==0&&r.selectionEnd>0&&t.prevInput=="​"){Wr(i,el)(i)}else if(e++<10){n.detectingSelectAll=setTimeout(o,500)}else{n.selForContextMenu=null;n.input.reset()}};n.detectingSelectAll=setTimeout(o,200)}}if(l&&a>=9){g()}if(k){Ne(e);var y=function(){we(window,"mouseup",y);setTimeout(v,20)};xe(window,"mouseup",y)}else{setTimeout(v,50)}};fs.prototype.readOnlyChanged=function(e){if(!e){this.reset()}this.textarea.disabled=e=="nocursor";this.textarea.readOnly=!!e};fs.prototype.setUneditable=function(){};fs.prototype.needsContentAttribute=false;function cs(e,t){t=t?q(t):{};t.value=e.value;if(!t.tabindex&&e.tabIndex){t.tabindex=e.tabIndex}if(!t.placeholder&&e.placeholder){t.placeholder=e.placeholder}if(t.autofocus==null){var i=D(B(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function n(){e.value=a.getValue()}var r;if(e.form){xe(e.form,"submit",n);if(!t.leaveSubmitMethodAlone){var o=e.form;r=o.submit;try{var l=o.submit=function(){n();o.submit=r;o.submit();o.submit=l}}catch(e){}}}t.finishInit=function(i){i.save=n;i.getTextArea=function(){return e};i.toTextArea=function(){i.toTextArea=isNaN;n();e.parentNode.removeChild(i.getWrapperElement());e.style.display="";if(e.form){we(e.form,"submit",n);if(!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"){e.form.submit=r}}}};e.style.display="none";var a=za(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return a}function us(e){e.off=we;e.on=xe;e.wheelEventPixels=lo;e.Doc=Tl;e.splitLines=Re;e.countColumn=U;e.findColumn=J;e.isWordChar=le;e.Pass=$;e.signal=Ce;e.Line=hi;e.changeEnd=ho;e.scrollbarModel=kr;e.Pos=ft;e.cmpPos=ct;e.modes=Ue;e.mimeModes=Ge;e.resolveMode=$e;e.getMode=Xe;e.modeExtensions=_e;e.extendMode=Ye;e.copyState=Je;e.startState=Ze;e.innerMode=Qe;e.commands=ta;e.keyMap=ql;e.keyName=Xl;e.isModifierKey=Kl;e.lookupKey=Vl;e.normalizeKeyMap=Gl;e.StringStream=et;e.SharedTextMarker=wl;e.TextMarker=xl;e.LineWidget=ml;e.e_preventDefault=Te;e.e_stopPropagation=Oe;e.e_stop=Ne;e.addClass=H;e.contains=F;e.rmClass=M;e.keyNames=Rl}Ra(za);Za(za);var hs="iter insert remove copy getEditor constructor".split(" ");for(var ds in Tl.prototype){if(Tl.prototype.hasOwnProperty(ds)&&V(hs,ds)<0){za.prototype[ds]=function(e){return function(){return e.apply(this.doc,arguments)}}(Tl.prototype[ds])}}Me(Tl);za.inputStyles={textarea:fs,contenteditable:is};za.defineMode=function(e){if(!za.defaults.mode&&e!="null"){za.defaults.mode=e}Ve.apply(this,arguments)};za.defineMIME=Ke;za.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}});za.defineMIME("text/plain","null");za.defineExtension=function(e,t){za.prototype[e]=t};za.defineDocExtension=function(e,t){Tl.prototype[e]=t};za.fromTextArea=cs;us(za);za.version="5.65.16";return za});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],e);else e(CodeMirror)})(function(e){"use strict";e.defineMode("rpm-changes",function(){var e=/^-+$/;var t=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;var i=/^[\w+.-]+@[\w.-]+/;return{token:function(n){if(n.sol()){if(n.match(e)){return"tag"}if(n.match(t)){return"tag"}}if(n.match(i)){return"string"}n.next();return null}}});e.defineMIME("text/x-rpm-changes","rpm-changes");e.defineMode("rpm-spec",function(){var e=/^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;var t=/^[a-zA-Z0-9()]+:/;var i=/^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/;var n=/^%(ifnarch|ifarch|if)/;var r=/^%(else|endif)/;var o=/^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/;return{startState:function(){return{controlFlow:false,macroParameters:false,section:false}},token:function(l,a){if(l.string.trim().startsWith("#"))return l.skipToEnd(),"comment";if(l.string.trim().match(//))return l.skipToEnd(),"header";if(l.string.trim().match(/|||/))return l.skipToEnd(),"keyword";if(l.string.trim().match(/|/))return l.skipToEnd(),"def";var s=l.peek();if(s=="#"){l.skipToEnd();return"comment"}if(l.sol()){if(l.match(t)){return"header"}if(l.match(i)){return"atom"}}if(l.match(/^\$\w+/)){return"def"}if(l.match(/^\$\{\w+\}/)){return"def"}if(l.match(r)){return"keyword"}if(l.match(n)){a.controlFlow=true;return"keyword"}if(a.controlFlow){if(l.match(o)){return"operator"}if(l.match(/^(\d+)/)){return"number"}if(l.eol()){a.controlFlow=false}}if(l.match(e)){if(l.eol()){a.controlFlow=false}return"number"}if(l.match(/^%[\w]+/)){if(l.match("(")){a.macroParameters=true}return"keyword"}if(a.macroParameters){if(l.match(/^\d+/)){return"number"}if(l.match(")")){a.macroParameters=false;return"keyword"}}if(l.match(/^%\{\??[\w \-\:\!]+\}/)){if(l.eol()){a.controlFlow=false}return"def"}l.next();return null}}});e.defineMIME("text/x-rpm-spec","rpm-spec")});(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){function t(t,i,n){t=t.getWrapperElement();var r=t.appendChild(document.createElement("div"));r.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top";"string"==typeof i?r.innerHTML=i:r.appendChild(i);e.addClass(t,"dialog-opened");return r}function i(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose();e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(n,r,o){function l(t){if("string"==typeof t)c.value=t;else if(!s&&(s=!0,e.rmClass(a.parentNode,"dialog-opened"),a.parentNode.removeChild(a),f.focus(),o.onClose))o.onClose(a)}o||(o={});i(this,null);var a=t(this,n,o.bottom),s=!1,f=this,c=a.getElementsByTagName("input")[0];if(c){c.focus();o.value&&(c.value=o.value,!1!==o.selectValueOnOpen&&c.select());if(o.onInput)e.on(c,"input",function(e){o.onInput(e,c.value,l)});if(o.onKeyUp)e.on(c,"keyup",function(e){o.onKeyUp(e,c.value,l)});e.on(c,"keydown",function(t){if(!(o&&o.onKeyDown&&o.onKeyDown(t,c.value,l))){if(27==t.keyCode||!1!==o.closeOnEnter&&13==t.keyCode)c.blur(),e.e_stop(t),l();13==t.keyCode&&r(c.value,t)}});if(!1!==o.closeOnBlur)e.on(a,"focusout",function(e){null!==e.relatedTarget&&l()})}else if(n=a.getElementsByTagName("button")[0]){e.on(n,"click",function(){l();f.focus()});if(!1!==o.closeOnBlur)e.on(n,"blur",l);n.focus()}return l});e.defineExtension("openConfirm",function(n,r,o){function l(){s||(s=!0,e.rmClass(a.parentNode,"dialog-opened"),a.parentNode.removeChild(a),f.focus())}i(this,null);var a=t(this,n,o&&o.bottom);n=a.getElementsByTagName("button");var s=!1,f=this,c=1;n[0].focus();for(o=0;o=c&&l()},200)});e.on(u,"focus",function(){++c})}});e.defineExtension("openNotification",function(n,r){function o(){a||(a=!0,clearTimeout(s),e.rmClass(l.parentNode,"dialog-opened"),l.parentNode.removeChild(l))}i(this,o);var l=t(this,n,r&&r.bottom),a=!1,s,f=r&&"undefined"!==typeof r.duration?r.duration:5e3;e.on(l,"click",function(t){e.e_preventDefault(t);o()});f&&(s=setTimeout(o,f));return o})});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e);else e(CodeMirror)})(function(e){"use strict";e.defineOption("search",{bottom:false});function t(e,t){if(typeof e=="string")e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g");else if(!e.global)e=new RegExp(e.source,e.ignoreCase?"gi":"g");return{token:function(t){e.lastIndex=t.pos;var i=e.exec(t.string);if(i&&i.index==t.pos){t.pos+=i[0].length||1;return"searching"}else if(i){t.pos=i.index}else{t.skipToEnd()}}}}function i(){this.posFrom=this.posTo=this.lastQuery=this.query=null;this.overlay=null}function n(e){return e.state.search||(e.state.search=new i)}function r(e){return typeof e=="string"&&e==e.toLowerCase()}function o(e,t,i){return e.getSearchCursor(t,i,{caseFold:r(t),multiline:true})}function l(e,t,i,n,r){e.openDialog(t,n,{value:i,selectValueOnOpen:true,closeOnEnter:false,onClose:function(){p(e)},onKeyDown:r,bottom:e.options.search.bottom})}function a(e,t,i,n,r){if(e.openDialog)e.openDialog(t,r,{value:n,selectValueOnOpen:true,bottom:e.options.search.bottom});else r(prompt(i,n))}function s(e,t,i,n){if(e.openConfirm)e.openConfirm(t,n);else if(confirm(i))n[0]()}function f(e){return e.replace(/\\([nrt\\])/g,function(e,t){if(t=="n")return"\n";if(t=="r")return"\r";if(t=="t")return"\t";if(t=="\\")return"\\";return e})}function c(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t){try{e=new RegExp(t[1],t[2].indexOf("i")==-1?"":"i")}catch(e){}}else{e=f(e)}if(typeof e=="string"?e=="":e.test(""))e=/x^/;return e}function u(e,i,n){i.queryText=n;i.query=c(n);e.removeOverlay(i.overlay,r(i.query));i.overlay=t(i.query,r(i.query));e.addOverlay(i.overlay);if(e.showMatchesOnScrollbar){if(i.annotate){i.annotate.clear();i.annotate=null}i.annotate=e.showMatchesOnScrollbar(i.query,r(i.query))}}function h(t,i,r,o){var s=n(t);if(s.query)return d(t,i);var f=t.getSelection()||s.lastQuery;if(f instanceof RegExp&&f.source=="x^")f=null;if(r&&t.openDialog){var c=null;var h=function(i,n){e.e_stop(n);if(!i)return;if(i!=s.queryText){u(t,s,i);s.posFrom=s.posTo=t.getCursor()}if(c)c.style.opacity=1;d(t,n.shiftKey,function(e,i){var n;if(i.line<3&&document.querySelector&&(n=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>t.cursorCoords(i,"window").top)(c=n).style.opacity=.4})};l(t,g(t),f,h,function(i,r){var o=e.keyName(i);var l=t.getOption("extraKeys"),a=l&&l[o]||e.keyMap[t.getOption("keyMap")][o];if(a=="findNext"||a=="findPrev"||a=="findPersistentNext"||a=="findPersistentPrev"){e.e_stop(i);u(t,n(t),r);t.execCommand(a)}else if(a=="find"||a=="findPersistent"){e.e_stop(i);h(r,i)}});if(o&&f){u(t,s,f);d(t,i)}}else{a(t,g(t),"Search for:",f,function(e){if(e&&!s.query)t.operation(function(){u(t,s,e);s.posFrom=s.posTo=t.getCursor();d(t,i)})})}}function d(t,i,r){t.operation(function(){var l=n(t);var a=o(t,l.query,i?l.posFrom:l.posTo);if(!a.find(i)){a=o(t,l.query,i?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0));if(!a.find(i))return}t.setSelection(a.from(),a.to());t.scrollIntoView({from:a.from(),to:a.to()},20);l.posFrom=a.from();l.posTo=a.to();if(r)r(a.from(),a.to())})}function p(e){e.operation(function(){var t=n(e);t.lastQuery=t.query;if(!t.query)return;t.query=t.queryText=null;e.removeOverlay(t.overlay);if(t.annotate){t.annotate.clear();t.annotate=null}})}function m(e,t){var i=e?document.createElement(e):document.createDocumentFragment();for(var n in t){i[n]=t[n]}for(var r=2;rc)break;var h=e.getLine(f++);a=a==null?h:a+"\n"+h}s=s*2;i.lastIndex=l.ch;var d=i.exec(a);if(d){var p=a.slice(0,d.index).split("\n"),m=d[0].split("\n");var g=l.line+p.length-1,v=p[p.length-1].length;return{from:t(g,v),to:t(g+m.length-1,m.length==1?v+m[0].length:m[m.length-1].length),match:d}}}}function a(e,t,i){var n,r=0;while(r<=e.length){t.lastIndex=r;var o=t.exec(e);if(!o)break;var l=o.index+o[0].length;if(l>e.length-i)break;if(!n||l>n.index+n[0].length)n=o;r=o.index+1}return n}function s(e,i,r){i=n(i,"g");for(var o=r.line,l=r.ch,s=e.firstLine();o>=s;o--,l=-1){var f=e.getLine(o);var c=a(f,i,l<0?0:f.length-l);if(c)return{from:t(o,c.index),to:t(o,c.index+c[0].length),match:c}}}function f(e,i,o){if(!r(i))return s(e,i,o);i=n(i,"gm");var l,f=1,c=e.getLine(o.line).length-o.ch;for(var u=o.line,h=e.firstLine();u>=h;){for(var d=0;d=h;d++){var p=e.getLine(u--);l=l==null?p:p+"\n"+l}f*=2;var m=a(l,i,c);if(m){var g=l.slice(0,m.index).split("\n"),v=m[0].split("\n");var y=u+g.length,x=g[g.length-1].length;return{from:t(y,x),to:t(y+v.length-1,v.length==1?x+v[0].length:v[v.length-1].length),match:m}}}}var c,u;if(String.prototype.normalize){c=function(e){return e.normalize("NFD").toLowerCase()};u=function(e){return e.normalize("NFD")}}else{c=function(e){return e.toLowerCase()};u=function(e){return e}}function h(e,t,i,n){if(e.length==t.length)return i;for(var r=0,o=i+Math.max(0,e.length-t.length);;){if(r==o)return r;var l=r+o>>1;var a=n(e.slice(0,l)).length;if(a==i)return l;else if(a>i)o=l;else r=l+1}}function d(e,i,n,r){if(!i.length)return null;var o=r?c:u;var l=o(i).split(/\r|\n\r?/);e:for(var a=n.line,s=n.ch,f=e.lastLine()+1-l.length;a<=f;a++,s=0){var d=e.getLine(a).slice(s),p=o(d);if(l.length==1){var m=p.indexOf(l[0]);if(m==-1)continue e;var n=h(d,p,m,o)+s;return{from:t(a,h(d,p,m,o)+s),to:t(a,h(d,p,m+l[0].length,o)+s)}}else{var g=p.length-l[0].length;if(p.slice(g)!=l[0])continue e;for(var v=1;v=f;a--,s=-1){var d=e.getLine(a);if(s>-1)d=d.slice(0,s);var p=o(d);if(l.length==1){var m=p.lastIndexOf(l[0]);if(m==-1)continue e;return{from:t(a,h(d,p,m,o)),to:t(a,h(d,p,m+l[0].length,o))}}else{var g=l[l.length-1];if(p.slice(0,g.length)!=g)continue e;for(var v=1,n=a-l.length+1;v(this.doc.getLine(n.line)||"").length){n.ch=0;n.line++}}if(e.cmpPos(n,this.doc.clipPos(n))!=0){return this.atOccurrence=false}}var r=this.matches(i,n);this.afterEmptyMatch=r&&e.cmpPos(r.from,r.to)==0;if(r){this.pos=r;this.atOccurrence=true;return this.pos.match||true}else{var o=t(i?this.doc.firstLine():this.doc.lastLine()+1,0);this.pos={from:o,to:o};return this.atOccurrence=false}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(i,n){if(!this.atOccurrence)return;var r=e.splitLines(i);this.doc.replaceRange(r,this.pos.from,this.pos.to,n);this.pos.to=t(this.pos.from.line+r.length-1,r[r.length-1].length+(r.length==1?this.pos.from.ch:0))}};e.defineExtension("getSearchCursor",function(e,t,i){return new m(this.doc,e,t,i)});e.defineDocExtension("getSearchCursor",function(e,t,i){return new m(this,e,t,i)});e.defineExtension("selectMatches",function(t,i){var n=[];var r=this.getSearchCursor(t,this.getCursor("from"),i);while(r.findNext()){if(e.cmpPos(r.to(),this.getCursor("to"))>0)break;n.push({anchor:r.from(),head:r.to()})}if(n.length)this.setSelections(n,0)})});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"),require("../dialog/dialog"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","../dialog/dialog"],e);else e(CodeMirror)})(function(e){"use strict";e.defineOption("search",{bottom:false});function t(e,t,i,n,r){if(e.openDialog)e.openDialog(t,r,{value:n,selectValueOnOpen:true,bottom:e.options.search.bottom});else r(prompt(i,n))}function i(e){return e.phrase("Jump to line:")+' '+e.phrase("(Use line:column or scroll% syntax)")+""}function n(e,t){var i=Number(t);if(/^[-+]/.test(t))return e.getCursor().line+i;else return i-1}e.commands.jumpToLine=function(e){var r=e.getCursor();t(e,i(e),e.phrase("Jump to line:"),r.line+1+":"+r.ch,function(t){if(!t)return;var i;if(i=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t)){e.setCursor(n(e,i[1]),Number(i[2]))}else if(i=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var o=Math.round(e.lineCount()*Number(i[1])/100);if(/^[-+]/.test(i[1]))o=r.line+o+1;e.setCursor(o-1,r.ch)}else if(i=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t)){e.setCursor(n(e,i[1]),r.ch)}})};e.keyMap["default"]["Alt-G"]="jumpToLine"});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e);else e(CodeMirror)})(function(e){"use strict";e.defineExtension("showMatchesOnScrollbar",function(e,i,n){if(typeof n=="string")n={className:n};if(!n)n={};return new t(this,e,i,n)});function t(e,t,i,n){this.cm=e;this.options=n;var r={listenForChanges:false};for(var o in n)r[o]=n[o];if(!r.className)r.className="CodeMirror-search-match";this.annotation=e.annotateScrollbar(r);this.query=t;this.caseFold=i;this.gap={from:e.firstLine(),to:e.lastLine()+1};this.matches=[];this.update=null;this.findMatches();this.annotation.update(this.matches);var l=this;e.on("change",this.changeHandler=function(e,t){l.onChange(t)})}var i=1e3;t.prototype.findMatches=function(){if(!this.gap)return;for(var t=0;t=this.gap.to)break;if(n.to.line>=this.gap.from)this.matches.splice(t--,1)}var r=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),{caseFold:this.caseFold,multiline:this.options.multiline});var o=this.options&&this.options.maxMatches||i;while(r.findNext()){var n={from:r.from(),to:r.to()};if(n.from.line>=this.gap.to)break;this.matches.splice(t++,0,n);if(this.matches.length>o)break}this.gap=null};function n(e,t,i){if(e<=t)return e;return Math.max(t,e+i)}t.prototype.onChange=function(t){var i=t.from.line;var r=e.changeEnd(t).line;var o=r-t.to.line;if(this.gap){this.gap.from=Math.min(n(this.gap.from,i,o),t.from.line);this.gap.to=Math.max(n(this.gap.to,i,o),t.from.line)}else{this.gap={from:t.from.line,to:r+1}}if(o)for(var l=0;l=t.options.minChars)l(e,h,false,t.options.style)})}function f(e,t,i){var n=e.getRange(t,i);if(n.match(/^\w+$/)!==null){if(t.ch>0){var r={line:t.line,ch:t.ch-1};var o=e.getRange(r,t);if(o.match(/\W/)===null)return false}if(i.cho?0:n.indent[o]}}e.defineSimpleMode=function(t,i){e.defineMode(t,function(t){return e.simpleMode(t,i)})};e.simpleMode=function(i,n){t(n,"start");var l={},s=n.meta||{},f=!1,c;for(c in n)if(c!=s&&n.hasOwnProperty(c))for(var u=l[c]=[],h=n[c],d=0;dr.start&&(o.startingInner=!1);c==r.pos&&l.parseDelimiters&&(o.innerActive=o.inner=null);l.innerStyle&&(a=a?a+" "+l.innerStyle:l.innerStyle);return a}a=Infinity;for(var s=r.string,f=0;fl?i.charCoords(e,"local")[t?"top":"bottom"]:i.heightAtLine(s,"local")+(t?0:s.height)}!1!==e&&this.computeScale();var i=this.cm;e=this.hScale;var n=document.createDocumentFragment(),r=this.annotations,o=i.getOption("lineWrapping"),l=o&&1.5*i.defaultTextHeight(),a=null,s=null,f=i.lastLine();if(i.display.barWidth)for(var c=0,u;cf)){for(var d=u||t(h.from,!0)*e,p=t(h.to,!1)*e;cf);){u=t(r[c+1].from,!0)*e;if(u>p+.9)break;h=r[++c];p=t(h.to,!1)*e}if(p!=d){p=Math.max(p-d,3);var m=n.appendChild(document.createElement("div"));m.style.cssText="position: absolute; right: 0px; width: "+Math.max(i.display.barWidth-1,2)+"px; top: "+(d+this.buttonHeight)+"px; height: "+p+"px";m.className=this.options.className;h.id&&m.setAttribute("annotation-id",h.id)}}}this.div.textContent="";this.div.appendChild(n)};t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler);this.cm.off("markerAdded",this.resizeHandler);this.cm.off("markerCleared",this.resizeHandler);this.changeHandler&&this.cm.off("changes",this.changeHandler);this.div.parentNode.removeChild(this.div)}});!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,n){if(0>n&&0==i.ch)return t.clipPos(h(i.line-1));var r=t.getLine(i.line);if(n>0&&i.ch>=r.length)return t.clipPos(h(i.line+1,0));for(var o,l="start",a=i.ch,s=0>n?0:r.length,f=0;a!=s;a+=n,f++){var c=r.charAt(0>n?a-1:a),u="_"!=c&&e.isWordChar(c)?"w":"o";if("w"==u&&c.toUpperCase()==c&&(u="W"),"start"==l)"o"!=u&&(l="in",o=u);else if("in"==l&&o!=u){if("w"==o&&"W"==u&&0>n&&a--,"W"==o&&"w"==u&&n>0){o="w";continue}break}}return h(i.line,a)}function i(e,i){e.extendSelectionsBy(function(n){return e.display.shift||e.doc.extend||n.empty()?t(e.doc,n.head,i):0>i?n.from():n.to()})}function n(t,i){for(var n=i.ch,r=n,o=t.getLine(i.line);n&&e.isWordChar(o.charAt(n-1));)--n;for(;re?-1:e==t?0:1}),t.replaceRange(c,s,f),n&&e.push({anchor:s,head:h(a+1,0)})}n&&t.setSelections(e,0)})}function a(t,i){t.operation(function(){for(var r=t.listSelections(),o=[],l=[],a=0;a=0;a--){var s=r[o[a]];if(!(f&&e.cmpPos(s.head,f)>0)){var c=n(t,s.head);f=c.from,t.replaceRange(i(c.word),c.from,c.to)}}})}function s(t){var i=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(i,r)){var o=n(t,i);if(!o.word)return;i=o.from,r=o.to}return{from:i,to:r,query:t.getRange(i,r),word:o}}function f(e,t){var i=s(e);if(i){var n=i.query,r=e.getSearchCursor(n,t?i.to:i.from);(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):(r=e.getSearchCursor(n,t?h(e.firstLine(),0):e.clipPos(h(e.lastLine()))),(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):i.word&&e.setSelection(i.from,i.to))}}var c=e.keyMap.sublime={fallthrough:"default"},u=e.commands,h=e.Pos,d=e.keyMap["default"]==e.keyMap.macDefault,p=d?"Cmd-":"Ctrl-",m=d?"Ctrl-":"Alt-";u[c[m+"Left"]="goSubwordLeft"]=function(e){i(e,-1)},u[c[m+"Right"]="goSubwordRight"]=function(e){i(e,1)},d&&(c["Cmd-Left"]="goLineStartSmart");var g=d?"Ctrl-Alt-":"Ctrl-";u[c[g+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var i=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=i&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},u[c[g+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var i=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=i&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},u[c["Shift-"+p+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),i=[],n=0;nr.line&&l==o.line&&0==o.ch||i.push({anchor:l==r.line?r:h(l,0),head:l==o.line?o:h(l)});e.setSelections(i,0)},c["Shift-Tab"]="indentLess",u[c.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},u[c[p+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),i=[],n=0;nr?n.push(s,f):n.length&&(n[n.length-1]=f),r=f}t.operation(function(){for(var e=0;et.lastLine()?t.replaceRange("\n"+l,h(t.lastLine()),null,"+swapLine"):t.replaceRange(l+"\n",h(r,0),null,"+swapLine")}t.setSelections(o),t.scrollIntoView()})},u[c[y+"Down"]="swapLineDown"]=function(t){if(t.isReadOnly())return e.Pass;for(var i=t.listSelections(),n=[],r=t.lastLine()+1,o=i.length-1;o>=0;o--){var l=i[o],a=l.to().line+1,s=l.from().line;0!=l.to().ch||l.empty()||a--,r>a?n.push(a,s):n.length&&(n[n.length-1]=s),r=s}t.operation(function(){for(var e=n.length-2;e>=0;e-=2){var i=n[e],r=n[e+1],o=t.getLine(i);i==t.lastLine()?t.replaceRange("",h(i-1),h(i),"+swapLine"):t.replaceRange("",h(i,0),h(i+1,0),"+swapLine"),t.replaceRange(o+"\n",h(r,0),null,"+swapLine")}t.scrollIntoView()})},u[c[p+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},u[c[p+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),i=[],n=0;ni;i++){var n=e.listSelections()[i];n.empty()?e.replaceRange(e.getLine(n.head.line)+"\n",h(n.head.line,0)):e.replaceRange(e.getRange(n.from(),n.to()),n.from())}e.scrollIntoView()})},d||(c[p+"T"]="transposeChars"),u[c.F9="sortLines"]=function(e){l(e,!0)},u[c[p+"F9"]="sortLinesInsensitive"]=function(e){l(e,!1)},u[c.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var i=t.shift(),n=i.find();if(n)return t.push(i),e.setSelection(n.from,n.to)}},u[c["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var i=t[t.length-1].find();if(i)return e.setSelection(i.from,i.to);t.pop()}},u[c[p+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),i=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),n=0;n=0;r--){var o=i[r].head,l=t.getRange({line:o.line,ch:0},o),a=e.countColumn(l,null,t.getOption("tabSize")),s=t.findPosH(o,-1,"char",!1);if(l&&!/\S/.test(l)&&a%n==0){var f=new h(o.line,e.findColumn(l,a-n,n));f.ch!=o.ch&&(s=f)}t.replaceRange("",s,o,"+delete")}})},u[c[x+p+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange("",t[i].anchor,h(t[i].to().line),"+delete");e.scrollIntoView()})},u[c[x+p+"U"]="upcaseAtCursor"]=function(e){a(e,function(e){return e.toUpperCase()})},u[c[x+p+"L"]="downcaseAtCursor"]=function(e){a(e,function(e){return e.toLowerCase()})},u[c[x+p+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},u[c[x+p+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},u[c[x+p+"W"]="deleteToSublimeMark"]=function(t){var i=t.state.sublimeMark&&t.state.sublimeMark.find();if(i){var n=t.getCursor(),r=i;if(e.cmpPos(n,r)>0){var o=r;r=n,n=o}t.state.sublimeKilled=t.getRange(n,r),t.replaceRange("",n,r)}},u[c[x+p+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},u[c[x+p+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},c[x+p+"G"]="clearBookmarks",u[c[x+p+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)};var b=d?"Ctrl-Shift-":"Ctrl-Alt-";u[c[b+"Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),i=0;ie.firstLine()&&e.addSelection(h(n.head.line-1,n.head.ch))}})},u[c[b+"Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),i=0;io))for(c==t.line&&(h=t.ch-(0>i?1:0));h!=d;h+=i){var p=u.charAt(h);if(r.test(p)&&(void 0===n||(e.getTokenTypeAt(a(c,h+1))||"")==(n||""))){var m=s[p];if(m&&">"==m.charAt(1)==0document.documentMode),a=e.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};e.defineOption("matchBrackets",!1,function(t,i,n){n&&n!=e.Init&&(t.off("cursorActivity",r),t.off("focus",r),t.off("blur",o),o(t));i&&(t.state.matchBrackets="object"==typeof i?i:{},t.on("cursorActivity",r),t.on("focus",r),t.on("blur",o))});e.defineExtension("matchBrackets",function(){n(this,!0)});e.defineExtension("findMatchingBracket",function(e,i,n){if(n||"boolean"==typeof i)n?(n.strict=i,i=n):i=i?{strict:!0}:null;return t(this,e,i)});e.defineExtension("scanForBracket",function(e,t,n,r){return i(this,e,t,n,r)})});(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){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:f[t]}function i(e){for(var t=0;t",triples:"",explode:"[]{}"},c=e.Pos;e.defineOption("autoCloseBrackets",!1,function(n,r,o){o&&o!=e.Init&&(n.removeKeyMap(u),n.state.closeBrackets=null);r&&(i(t(r,"pairs")),n.state.closeBrackets=r,n.addKeyMap(u))});var u={Backspace:function(i){var n=r(i);if(!n||i.getOption("disableInput"))return e.Pass;var o=t(n,"pairs");n=i.listSelections();for(var l=0;l=a?-1:o.lastIndexOf(n,a-1),-1==a){if(1==s)break;s=1;a=o.length}else{if(1==s&&aa)){var f=a;a="{";s="}"}else if(null!=s)f=s,a="[",s="]";else return;var c=1,u=t.lastLine(),h=r;e:for(;h<=u;++h)for(var d=t.getLine(h),p=h==r?f:0;;){var m=d.indexOf(a,p);p=d.indexOf(s,p);0>m&&(m=d.length);0>p&&(p=d.length);p=Math.min(m,p);if(p==d.length)break;if(t.getTokenTypeAt(e.Pos(h,p+1))==l)if(p==m)++c;else if(!--c){var g=h;var v=p;break e}++p}if(null!=g&&r!=g)return{from:e.Pos(r,f),to:e.Pos(g,v)}});e.registerHelper("fold","import",function(t,i){function n(i){if(it.lastLine())return null;var n=t.getTokenAt(e.Pos(i,1));/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(i,n.end+1)));if("keyword"!=n.type||"import"!=n.string)return null;var r=i;for(i=Math.min(t.lastLine(),i+10);r<=i;++r){var o=t.getLine(r).indexOf(";");if(-1!=o)return{startCh:n.end,end:e.Pos(r,o)}}}var r=i.line,o=n(r),l;if(!o||n(r-1)||(l=n(r-2))&&l.end.line==r-1)return null;for(l=o.end;;){var a=n(l.line+1);if(null==a)break;l=a.end}return{from:t.clipPos(e.Pos(r,o.startCh+1)),to:l}});e.registerHelper("fold","include",function(t,i){function n(i){if(it.lastLine())return null;var n=t.getTokenAt(e.Pos(i,1));/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(i,n.end+1)));if("meta"==n.type&&"#include"==n.string.slice(0,8))return n.start+8}var r=i.line,o=n(r);if(null==o||null!=n(r-1))return null;for(var l=r;null!=n(l+1);)++l;return{from:e.Pos(r,o+1),to:t.clipPos(e.Pos(l))}})});(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){e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,i){var n=t.getModeAt(i),r=n.blockCommentStart;n=n.blockCommentEnd;if(r&&n){for(var o=i.line,l=t.getLine(o),a=i.ch,s=0;;)if(a=0>=a?-1:l.lastIndexOf(r,a-1),-1==a){if(1==s)return;s=1;a=l.length}else{if(1==s&&ah&&(h=c.length);0>u&&(u=c.length);u=Math.min(h,u);if(u==c.length)break;if(u==h)++s;else if(!--s){var d=f;var p=u;break e}++u}if(null!=d&&(o!=d||p!=l))return{from:e.Pos(o,l),to:e.Pos(d,p)}}})});(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){function t(t,r,o,l){function a(e){var i=s(t,r);if(!i||i.to.line-i.from.linet.firstLine();)r=e.Pos(r.line-1,0),c=a(!1);if(c&&!c.cleared&&"unfold"!==l){var u=i(t,o,c);e.on(u,"mousedown",function(t){h.clear();e.e_preventDefault(t)});var h=t.markText(c.from,c.to,{replacedWith:u,clearOnEnter:n(t,o,"clearOnEnter"),__isFold:!0});h.on("clear",function(i,n){e.signal(t,"unfold",t,i,n)});e.signal(t,"fold",t,c.from,c.to)}}function i(e,t,i){e=n(e,t,"widget");"function"==typeof e&&(e=e(i.from,i.to));"string"==typeof e?(i=document.createTextNode(e),e=document.createElement("span"),e.appendChild(i),e.className="CodeMirror-foldmarker"):e&&(e=e.cloneNode(!0));return e}function n(e,t,i){return t&&void 0!==t[i]?t[i]:(e=e.options.foldOptions)&&void 0!==e[i]?e[i]:r[i]}e.newFoldFunction=function(e,i){return function(n,r){t(n,r,{rangeFinder:e,widget:i})}};e.defineExtension("foldCode",function(e,i,n){t(this,e,i,n)});e.defineExtension("isFolded",function(e){e=this.findMarksAt(e);for(var t=0;t=a){if(u&&h&&u.test(h.className))return;r=n(o.indicatorOpen)}}(r||h)&&e.setGutterMarker(t,o.gutter,r)})}function o(e){var t=e.getViewport(),i=e.state.foldGutter;i&&(e.operation(function(){r(e,t.from,t.to)}),i.from=t.from,i.to=t.to)}function l(e,t,n){var r=e.state.foldGutter;r&&(r=r.options,n==r.gutter&&((n=i(e,t))?n.clear():e.foldCode(c(t,0),r)))}function a(e){var t=e.state.foldGutter;if(t){var i=t.options;t.from=t.to=0;clearTimeout(t.changeUpdate);t.changeUpdate=setTimeout(function(){o(e)},i.foldOnChangeTimeSpan||600)}}function s(e){var t=e.state.foldGutter;if(t){var i=t.options;clearTimeout(t.changeUpdate);t.changeUpdate=setTimeout(function(){var i=e.getViewport();t.from==t.to||20t.to&&(r(e,t.to,i.to),t.to=i.to)})},i.updateViewportTimeSpan||400)}}function f(e,t){var i=e.state.foldGutter;if(i){var n=t.line;n>=i.from&&nr)){for(var o=null,l=n.line+1,a=i.lastLine();l<=a;++l){var s=t(i,l);if(-1!=s)if(s>r)o=l;else break}if(o)return{from:e.Pos(n.line,i.getLine(n.line).length),to:e.Pos(o,i.getLine(o).length)}}})});(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){e.registerHelper("fold","markdown",function(t,i){function n(i){return(i=t.getTokenTypeAt(e.Pos(i,0)))&&/\bheader\b/.test(i)}function r(e,t,i){return(t=t&&t.match(/^#+/))&&n(e)?t[0].length:(t=i&&i.match(/^[=\-]+\s*$/))&&n(e+1)?"="==i[0]?1:2:100}var o=t.getLine(i.line),l=t.getLine(i.line+1),a=r(i.line,o,l);if(100!==a){for(var s=t.lastLine(),f=i.line,c=t.getLine(f+2);f=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function r(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function o(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t)if(n(e))continue;else break;if(i(e,t+1)){var r=e.text.lastIndexOf("/",t);r=-1f&&(!t||t==n[2]))return{tag:n[2],from:c(l,s),to:c(e.line,e.ch)}}else i.push(n[2])}}function f(e,t){for(var n=[];;){var o;e:for(o=e;;){var a=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(-1==a)if(r(o))continue;else{o=void 0;break e}if(i(o,a+1)){var s=o.text.lastIndexOf("/",a);s=-1f&&(!t||t==s[2]))return{tag:s[2],from:c(e.line,e.ch),to:c(o,a)}}}}}var c=e.Pos,u=RegExp("<(/?)([A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");e.registerHelper("fold","xml",function(e,i){for(var n=new t(e,i.line,0);;){var r=a(n);if(!r||n.line!=i.line)break;var l=o(n);if(!l)break;if(!r[1]&&"selfClose"!=l){l=c(n.line,n.ch);if(r=n=s(n,r[2]))r=n.from,r=0<(r.line-l.line||r.ch-l.ch);return r?{from:l,to:n.from}:null}}});e.findMatchingTag=function(e,i,n){var r=new t(e,i.line,i.ch,n);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var a=o(r),u=a&&c(r.line,r.ch),h=a&&l(r);if(a&&h&&!(0<(r.line-i.line||r.ch-i.ch))){i={from:c(r.line,r.ch),to:u,tag:h[2]};if("selfClose"==a)return{open:i,close:null,at:"open"};if(h[1])return{open:f(r,h[2]),close:i,at:"close"};r=new t(e,u.line,u.ch,n);return{open:i,close:s(r,h[2]),at:"open"}}}};e.findEnclosingTag=function(e,i,n,r){for(var o=new t(e,i.line,i.ch,n);;){var l=f(o,r);if(!l)break;var a=new t(e,i.line,i.ch,n);if(a=s(a,l.tag))return{open:l,close:a}}};e.scanForClosingTag=function(e,i,n,r){e=new t(e,i.line,i.ch,r?{from:0,to:r}:null);return s(e,n)}});(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){function t(e,t){this.cm=e;this.options=t;this.widget=null;this.tick=this.debounce=0;this.startPos=this.cm.getCursor("start");this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;if(this.options.updateOnCursorActivity){var i=this;e.on("cursorActivity",this.activityFunc=function(){i.cursorActivity()})}}function i(e,t){function i(e,i){var r="string"!=typeof i?function(e){return i(e,t)}:n.hasOwnProperty(i)?n[i]:i;o[e]=r}var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close};/Mac/.test(navigator.platform)&&(n["Ctrl-P"]=function(){t.moveFocus(-1)},n["Ctrl-N"]=function(){t.moveFocus(1)});var r=e.options.customKeys,o=r?{}:n;if(r)for(var l in r)r.hasOwnProperty(l)&&i(l,r[l]);if(r=e.options.extraKeys)for(l in r)r.hasOwnProperty(l)&&i(l,r[l]);return o}function n(e,t){for(;t&&t!=e;){if("LI"===t.nodeName.toUpperCase()&&t.parentNode==e)return t;t=t.parentNode}}function r(t,r){this.id="cm-complete-"+Math.floor(Math.random(1e6));this.completion=t;this.data=r;this.picked=!1;var o=this,l=t.cm,a=l.getInputField().ownerDocument,s=a.defaultView||a.parentWindow,f=this.hints=a.createElement("ul");f.setAttribute("role","listbox");f.setAttribute("aria-expanded","true");f.id=this.id;f.className="CodeMirror-hints "+t.cm.options.theme;this.selectedHint=r.selectedHint||0;for(var c=r.list,u=0;uf.clientHeight+1:!1,w;setTimeout(function(){w=l.getScrollInfo()});if(0S&&(f.style.height=(C=S)+"px"),f.style.top=(v=u.top-C)+p+"px",y=!1):f.style.height=x-m.top-2+"px"}p=m.right-d;b&&(p+=l.display.nativeBarWidth);0d&&(f.style.width=d-5+"px",p-=m.right-m.left-d),f.style.left=(g=Math.max(u.left-p-h,0))+"px");if(b)for(u=f.firstChild;u;u=u.nextSibling)u.style.paddingRight=l.display.nativeBarWidth+"px";l.addKeyMap(this.keyMap=i(t,{moveFocus:function(e,t){o.changeActive(o.selectedHint+e,t)},setFocus:function(e){o.changeActive(e)},menuSize:function(){return o.screenAmount()},length:c.length,close:function(){t.close()},pick:function(){o.pick()},data:r}));if(t.options.closeOnUnfocus){var k;l.on("blur",this.onBlur=function(){k=setTimeout(function(){t.close()},100)});l.on("focus",this.onFocus=function(){clearTimeout(k)})}l.on("scroll",this.onScroll=function(){var e=l.getScrollInfo(),i=l.getWrapperElement().getBoundingClientRect();w||(w=l.getScrollInfo());var n=v+w.top-e.top,r=n-(s.pageYOffset||(a.documentElement||a.body).scrollTop);y||(r+=f.offsetHeight);if(r<=i.top||r>=i.bottom)return t.close();f.style.top=n+"px";f.style.left=g+w.left-e.left+"px"});e.on(f,"dblclick",function(e){(e=n(f,e.target||e.srcElement))&&null!=e.hintId&&(o.changeActive(e.hintId),o.pick())});e.on(f,"click",function(e){(e=n(f,e.target||e.srcElement))&&null!=e.hintId&&(o.changeActive(e.hintId),t.options.completeOnSingleClick&&o.pick())});e.on(f,"mousedown",function(){setTimeout(function(){l.focus()},20)});u=this.getSelectedHintRange();0===u.from&&0===u.to||this.scrollToActive();e.signal(r,"select",c[this.selectedHint],f.childNodes[this.selectedHint]);return!0}function o(e,t){if(!e.somethingSelected())return t;for(var i=[],n=0;n=this.data.list.length?t=i?this.data.list.length-1:0:0>t&&(t=i?0:this.data.list.length-1);if(this.selectedHint!=t){var n=this.hints.childNodes[this.selectedHint];n&&(n.className=n.className.replace(" CodeMirror-hint-active",""),n.removeAttribute("aria-selected"));n=this.hints.childNodes[this.selectedHint=t];n.className+=" CodeMirror-hint-active";n.setAttribute("aria-selected","true");this.completion.cm.getInputField().setAttribute("aria-activedescendant",n.id);this.scrollToActive();e.signal(this.data,"select",this.data.list[this.selectedHint],n)}},scrollToActive:function(){var e=this.getSelectedHintRange(),t=this.hints.childNodes[e.from];e=this.hints.childNodes[e.to];var i=this.hints.firstChild;t.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=e.offsetTop+e.offsetHeight-this.hints.clientHeight+i.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var e=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-e),to:Math.min(this.data.list.length-1,this.selectedHint+e)}}};e.registerHelper("hint","auto",{resolve:function(t,i){var n=t.getHelpers(i,"hint"),r;if(n.length){var a=function(e,t,i){function r(n){if(n==a.length)return t(null);l(a[n],e,i,function(e){e&&0,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};e.defineOption("hintOptions",null)});(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){var t=/[\w$]+/;e.registerHelper("hint","anyword",function(i,n){for(var r=n&&n.word||t,o=n&&n.range||500,l=i.getCursor(),a=i.getLine(l.line),s=l.ch,f=s;f&&r.test(a.charAt(f-1));)--f;a=f!=s&&a.slice(f,s);var c=n&&n.list||[],u={};r=new RegExp(r.source,"g");for(var h=-1;1>=h;h+=2)for(var d=l.line,p=Math.min(Math.max(d+h*o,i.firstLine()),i.lastLine())+h;d!=p;d+=h)for(var m=i.getLine(d),g;g=r.exec(m);)d==l.line&&g[0]===a||a&&0!=g[0].lastIndexOf(a,0)||Object.prototype.hasOwnProperty.call(u,g[0])||(u[g[0]]=!0,c.push(g[0]));return{list:c,from:e.Pos(l.line,f),to:e.Pos(l.line,s)}})});(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){function t(e){for(var t=0;t=t||(s.line>=t&&(s=l(t,0)),t=a.line,null==n?this.uncomment(a,s,e)?n="un":(this.lineComment(a,s,e),n="line"):"un"==n?this.uncomment(a,s,e):this.lineComment(a,s,e))}});e.defineExtension("lineComment",function(e,a,s){s||(s=r);var f=this,c=n(f,e),u=f.getLine(e.line);if(null!=u&&!i(f,e,u)){var h=s.lineComment||c.lineComment;if(h){var d=Math.min(0!=a.ch||a.line==e.line?a.line+1:a.line,f.lastLine()+1),p=null==s.padding?" ":s.padding,m=s.commentBlankLines||e.line==a.line;f.operation(function(){if(s.indent){for(var i=null,n=e.line;nr.length)i=r}for(n=e.line;nh||s.operation(function(){if(0!=i.fullLines){var n=o.test(s.getLine(h));s.replaceRange(d+u,l(h));s.replaceRange(c+d,l(e.line,0));var r=i.blockCommentLead||f.blockCommentLead;if(null!=r)for(var p=e.line+1;p<=h;++p)(p!=h||n)&&s.replaceRange(r+d,l(p,0))}else n=0==a(s.getCursor("to"),t),r=!s.somethingSelected(),s.replaceRange(u,t),n&&s.setSelection(r?t:s.getCursor("from"),t),s.replaceRange(c,e)})}});e.defineExtension("uncomment",function(e,t,i){i||(i=r);var a=this,s=n(a,e),f=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,a.lastLine()),c=Math.min(e.line,f),u=i.lineComment||s.lineComment,h=[],d=null==i.padding?" ":i.padding,p;e:if(u){for(var m=c;m<=f;++m){var g=a.getLine(m),v=g.indexOf(u);-1i||(t.slice(n,n+d.length)==d&&(n+=d.length),p=!0,a.replaceRange("",l(e,i),l(e,n)))}});if(p)return!0}var y=i.blockCommentStart||s.blockCommentStart,x=i.blockCommentEnd||s.blockCommentEnd;if(!y||!x)return!1;var b=i.blockCommentLead||s.blockCommentLead,w=a.getLine(c),C=w.indexOf(y);if(-1==C)return!1;var S=f==c?w:a.getLine(f),k=S.indexOf(x,f==c?C+y.length:0);i=l(c,C+1);s=l(f,k+1);if(-1==k||!/comment/.test(a.getTokenTypeAt(i))||!/comment/.test(a.getTokenTypeAt(s))||-1=d.length&&-1<(h=p.lastIndexOf(d,f.ch-d.length))&&h>m)if(i(0,p)>=h)u=p.slice(0,h);else{u=t.options.tabSize;var g;h=e.countColumn(p,h,u);u=t.options.indentWithTabs?o.call("\t",g=Math.floor(h/u))+o.call(" ",h-u*g):o.call(" ",h)}else-1<(h=p.indexOf(l.blockCommentContinue))&&h<=f.ch&&h<=i(0,p)&&(u=p.slice(0,h));null!=u&&(u+=l.blockCommentContinue)}null==u&&c&&n(t)&&((null==p&&(p=t.getLine(f.line)),h=p.indexOf(c),f.ch||h)?-1=h&&(u=-1=u||null),u&&(u=p.slice(0,h)+c+p.slice(h+c.length).match(/^\s*/)[0])):u="");if(null==u)return e.Pass;a[s]="\n"+u}t.operation(function(){for(var e=r.length-1;0<=e;e--)t.replaceRange(a[e],r[e].from(),r[e].to(),"+insert")})}function i(e,t){r.lastIndex=e;var i=r.exec(t);return i?i.index:-1}function n(e){return(e=e.getOption("continueComments"))&&"object"==typeof e?!1!==e.continueLineComment:!0}var r=/\S/g,o=String.prototype.repeat||function(e){return Array(e+1).join(this)};e.defineOption("continueComments",null,function(i,n,r){r&&r!=e.Init&&i.removeKeyMap("continueComment");n&&(r="Enter","string"==typeof n?r=n:"object"==typeof n&&n.key&&(r=n.key),n={name:"continueComment"},n[r]=t,i.addKeyMap(n))})});(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){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function i(e){t(e);var i=e.state.placeholder=document.createElement("pre");i.style.cssText="height: 0; overflow: visible";i.style.direction=e.getOption("direction");i.className="CodeMirror-placeholder CodeMirror-line-like";var n=e.getOption("placeholder");"string"==typeof n&&(n=document.createTextNode(n));i.appendChild(n);e.display.lineSpace.insertBefore(i,e.display.lineSpace.firstChild)}function n(e){setTimeout(function(){var n=!1;1==e.lineCount()&&(n=e.getInputField(),n="TEXTAREA"==n.nodeName?!e.getLine(0).length:!/[^\u200b]/.test(n.querySelector(".CodeMirror-line").textContent));n?i(e):t(e)},20)}function r(e){l(e)&&i(e)}function o(e){var n=e.getWrapperElement(),r=l(e);n.className=n.className.replace(" CodeMirror-empty","")+(r?" CodeMirror-empty":"");r?i(e):t(e)}function l(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(i,l,a){a=a&&a!=e.Init;l&&!a?(i.on("blur",r),i.on("change",o),i.on("swapDoc",o),e.on(i.getInputField(),"compositionupdate",i.state.placeholderCompose=function(){n(i)}),o(i)):!l&&a&&(i.off("blur",r),i.off("change",o),i.off("swapDoc",o),e.off(i.getInputField(),"compositionupdate",i.state.placeholderCompose),t(i),a=i.getWrapperElement(),a.className=a.className.replace(" CodeMirror-empty",""));l&&!i.hasFocus()&&r(i)})});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../lib/codemirror"],e);else e(CodeMirror)})(function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["cgi","pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var t=0;t-1&&t.substring(r+1,t.length);if(o)return e.findModeByExtension(o)};e.findModeByName=function(t){t=t.toLowerCase();for(var i=0;i2);var v=/Android/.test(e);var y=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e);var x=g||/Mac/.test(t);var b=/\bCrOS\b/.test(e);var w=/win/i.test(t);var C=h&&e.match(/Version\/(\d*\.\d*)/);if(C){C=Number(C[1])}if(C&&C>=15){h=false;s=true}var S=x&&(f||h&&(C==null||C<12.11));var k=i||l&&a>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var M=function(e,t){var i=e.className;var n=L(t).exec(i);if(n){var r=i.slice(n.index+n[0].length);e.className=i.slice(0,n.index)+(r?n[1]+r:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t){e.removeChild(e.firstChild)}return e}function O(e,t){return T(e).appendChild(t)}function A(e,t,i,n){var r=document.createElement(e);if(i){r.className=i}if(n){r.style.cssText=n}if(typeof t=="string"){r.appendChild(document.createTextNode(t))}else if(t){for(var o=0;o=t){return l+(t-o)}l+=a-o;l+=i-l%i;o=a+1}}var G=function(){this.id=null;this.f=null;this.time=0;this.handler=z(this.onTimeout,this)};G.prototype.onTimeout=function(e){e.id=0;if(e.time<=+new Date){e.f()}else{setTimeout(e.handler,e.time-+new Date)}};G.prototype.set=function(e,t){this.f=t;var i=+new Date+e;if(!this.id||i=t){return n+Math.min(l,t-r)}r+=o-n;r+=i-r%i;n=o+1;if(r>=t){return n}}}var Q=[""];function Z(e){while(Q.length<=e){Q.push(ee(Q)+" ")}return Q[e]}function ee(e){return e[e.length-1]}function te(e,t){var i=[];for(var n=0;n"€"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function ae(e,t){if(!t){return le(e)}if(t.source.indexOf("\\w")>-1&&le(e)){return true}return t.test(e)}function se(e){for(var t in e){if(e.hasOwnProperty(t)&&e[t]){return false}}return true}var fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ce(e){return e.charCodeAt(0)>=768&&fe.test(e)}function ue(e,t,i){while((i<0?t>0:ti?-1:1;for(;;){if(t==i){return t}var r=(t+i)/2,o=n<0?Math.ceil(r):Math.floor(r);if(o==t){return e(o)?t:i}if(e(o)){i=o}else{t=o+n}}}function de(e,t,i,n){if(!e){return n(t,i,"ltr",0)}var r=false;for(var o=0;ot||t==i&&l.to==t){n(Math.max(l.from,t),Math.min(l.to,i),l.level==1?"rtl":"ltr",o);r=true}}if(!r){n(t,i,"ltr")}}var pe=null;function me(e,t,i){var n;pe=null;for(var r=0;rt){return r}if(o.to==t){if(o.from!=o.to&&i=="before"){n=r}else{pe=r}}if(o.from==t){if(o.from!=o.to&&i!="before"){n=r}else{pe=r}}}return n!=null?n:pe}var ge=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(i){if(i<=247){return e.charAt(i)}else if(1424<=i&&i<=1524){return"R"}else if(1536<=i&&i<=1785){return t.charAt(i-1536)}else if(1774<=i&&i<=2220){return"r"}else if(8192<=i&&i<=8203){return"w"}else if(i==8204){return"b"}else{return"L"}}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var r=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(e,t,i){this.level=e;this.from=t;this.to=i}return function(e,t){var f=t=="ltr"?"L":"R";if(e.length==0||t=="ltr"&&!n.test(e)){return false}var c=e.length,u=[];for(var h=0;h-1){n[t]=r.slice(0,o).concat(r.slice(o+1))}}}}function Ce(e,t){var i=be(e,t);if(!i.length){return}var n=Array.prototype.slice.call(arguments,2);for(var r=0;r0}function Me(e){e.prototype.on=function(e,t){xe(this,e,t)};e.prototype.off=function(e,t){we(this,e,t)}}function Te(e){if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}}function Oe(e){if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}}function Ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==false}function Ne(e){Te(e);Oe(e)}function Pe(e){return e.target||e.srcElement}function Fe(e){var t=e.which;if(t==null){if(e.button&1){t=1}else if(e.button&2){t=3}else if(e.button&4){t=2}}if(x&&e.ctrlKey&&t==1){t=3}return t}var De=function(){if(l&&a<9){return false}var e=A("div");return"draggable"in e||"dragDrop"in e}();var He;function Ee(e){if(He==null){var t=A("span","​");O(e,A("span",[t,document.createTextNode("x")]));if(e.firstChild.offsetHeight!=0){He=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&a<8)}}var i=He?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");i.setAttribute("cm-text","");return i}var We;function Ie(e){if(We!=null){return We}var t=O(e,document.createTextNode("AخA"));var i=P(t,0,1).getBoundingClientRect();var n=P(t,1,2).getBoundingClientRect();T(e);if(!i||i.left==i.right){return false}return We=n.right-i.right<3}var Re="\n\nb".split(/\n/).length!=3?function(e){var t=0,i=[],n=e.length;while(t<=n){var r=e.indexOf("\n",t);if(r==-1){r=e.length}var o=e.slice(t,e.charAt(r-1)=="\r"?r-1:r);var l=o.indexOf("\r");if(l!=-1){i.push(o.slice(0,l));t+=l+1}else{i.push(o);t=r+1}}return i}:function(e){return e.split(/\r\n?|\n/)};var Be=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return false}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}if(!t||t.parentElement()!=e){return false}return t.compareEndPoints("StartToEnd",t)!=0};var je=function(){var e=A("div");if("oncopy"in e){return true}e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}();var ze=null;function qe(e){if(ze!=null){return ze}var t=O(e,A("span","x"));var i=t.getBoundingClientRect();var n=P(t,0,1).getBoundingClientRect();return ze=Math.abs(i.left-n.left)>1}var Ue={},Ge={};function Ve(e,t){if(arguments.length>2){t.dependencies=Array.prototype.slice.call(arguments,2)}Ue[e]=t}function Ke(e,t){Ge[e]=t}function $e(e){if(typeof e=="string"&&Ge.hasOwnProperty(e)){e=Ge[e]}else if(e&&typeof e.name=="string"&&Ge.hasOwnProperty(e.name)){var t=Ge[e.name];if(typeof t=="string"){t={name:t}}e=re(t,e);e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e)){return $e("application/xml")}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e)){return $e("application/json")}if(typeof e=="string"){return{name:e}}else{return e||{name:"null"}}}function Xe(e,t){t=$e(t);var i=Ue[t.name];if(!i){return Xe(e,"text/plain")}var n=i(e,t);if(_e.hasOwnProperty(t.name)){var r=_e[t.name];for(var o in r){if(!r.hasOwnProperty(o)){continue}if(n.hasOwnProperty(o)){n["_"+o]=n[o]}n[o]=r[o]}}n.name=t.name;if(t.helperType){n.helperType=t.helperType}if(t.modeProps){for(var l in t.modeProps){n[l]=t.modeProps[l]}}return n}var _e={};function Ye(e,t){var i=_e.hasOwnProperty(e)?_e[e]:_e[e]={};q(t,i)}function Je(e,t){if(t===true){return t}if(e.copyState){return e.copyState(t)}var i={};for(var n in t){var r=t[n];if(r instanceof Array){r=r.concat([])}i[n]=r}return i}function Qe(e,t){var i;while(e.innerMode){i=e.innerMode(t);if(!i||i.mode==e){break}t=i.state;e=i.mode}return i||{mode:e,state:t}}function Ze(e,t,i){return e.startState?e.startState(t,i):true}var et=function(e,t,i){this.pos=this.start=0;this.string=e;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=i};et.prototype.eol=function(){return this.pos>=this.string.length};et.prototype.sol=function(){return this.pos==this.lineStart};et.prototype.peek=function(){return this.string.charAt(this.pos)||undefined};et.prototype.next=function(){if(this.post};et.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>e};et.prototype.skipToEnd=function(){this.pos=this.string.length};et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}};et.prototype.backUp=function(e){this.pos-=e};et.prototype.column=function(){if(this.lastColumnPos0){return null}if(o&&t!==false){this.pos+=o[0].length}return o}};et.prototype.current=function(){return this.string.slice(this.start,this.pos)};et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}};et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)};et.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function tt(e,t){t-=e.first;if(t<0||t>=e.size){throw new Error("There is no line "+(t+e.first)+" in the document.")}var i=e;while(!i.lines){for(var n=0;;++n){var r=i.children[n],o=r.chunkSize();if(t=e.first&&ti){return ft(i,tt(e,i).text.length)}return vt(t,tt(e,t.line).text.length)}function vt(e,t){var i=e.ch;if(i==null||i>t){return ft(e.line,t)}else if(i<0){return ft(e.line,0)}else{return e}}function yt(e,t){var i=[];for(var n=0;nthis.maxLookAhead){this.maxLookAhead=e}return t};bt.prototype.baseToken=function(e){if(!this.baseTokens){return null}while(this.baseTokens[this.baseTokenPos]<=e){this.baseTokenPos+=2}var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}};bt.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0){this.maxLookAhead--}};bt.fromSaved=function(e,t,i){if(t instanceof xt){return new bt(e,Je(e.mode,t.state),i,t.lookAhead)}else{return new bt(e,Je(e.mode,t),i)}};bt.prototype.save=function(e){var t=e!==false?Je(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new xt(t,this.maxLookAhead):t};function wt(e,t,i,n){var r=[e.state.modeGen],o={};Nt(e,t.text,e.doc.mode,i,function(e,t){return r.push(e,t)},o,n);var l=i.state;var a=function(n){i.baseTokens=r;var a=e.state.overlays[n],s=1,f=0;i.state=true;Nt(e,t.text,a.mode,i,function(e,t){var i=s;while(fe){r.splice(s,1,e,r[s+1],n)}s+=2;f=Math.min(e,n)}if(!t){return}if(a.opaque){r.splice(i,s-i,e,"overlay "+t);s=i+2}else{for(;ie.options.maxHighlightLength&&Je(e.doc.mode,n.state);var o=wt(e,t,n);if(r){n.state=r}t.stateAfter=n.save(!r);t.styles=o.styles;if(o.classes){t.styleClasses=o.classes}else if(t.styleClasses){t.styleClasses=null}if(i===e.doc.highlightFrontier){e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier)}}return t.styles}function St(e,t,i){var n=e.doc,r=e.display;if(!n.mode.startState){return new bt(n,true,t)}var o=Pt(e,t,i);var l=o>n.first&&tt(n,o-1).stateAfter;var a=l?bt.fromSaved(n,l,o):new bt(n,Ze(n.mode),o);n.iter(o,t,function(i){kt(e,i.text,a);var n=a.line;i.stateAfter=n==t-1||n%5==0||n>=r.viewFrom&&nt.start){return o}}throw new Error("Mode "+e.name+" failed to advance stream.")}var Tt=function(e,t,i){this.start=e.start;this.end=e.pos;this.string=e.current();this.type=t||null;this.state=i};function Ot(e,t,i,n){var r=e.doc,o=r.mode,l;t=gt(r,t);var a=tt(r,t.line),s=St(e,t.line,i);var f=new et(a.text,e.options.tabSize,s),c;if(n){c=[]}while((n||f.pose.options.maxHighlightLength){a=false;if(l){kt(e,t,n,c.pos)}c.pos=t.length;u=null}else{u=At(Mt(i,c,n.state,h),o)}if(h){var d=h[0].name;if(d){u="m-"+(u?d+" "+u:d)}}if(!a||f!=u){while(sl;--a){if(a<=o.first){return o.first}var s=tt(o,a-1),f=s.stateAfter;if(f&&(!i||a+(f instanceof xt?f.lookAhead:0)<=o.modeFrontier)){return a}var c=U(s.text,null,e.options.tabSize);if(r==null||n>c){r=a-1;n=c}}return r}function Ft(e,t){e.modeFrontier=Math.min(e.modeFrontier,t);if(e.highlightFrontieri;n--){var r=tt(e,n).stateAfter;if(r&&(!(r instanceof xt)||n+r.lookAhead=t:o.to>t);(n||(n=[])).push(new It(l,o.from,s?null:o.to))}}}return n}function qt(e,t,i){var n;if(e){for(var r=0;r=t:o.to>t);if(a||o.from==t&&l.type=="bookmark"&&(!i||o.marker.insertLeft)){var s=o.from==null||(l.inclusiveLeft?o.from<=t:o.from0&&a){for(var b=0;b0){continue}var c=[s,1],u=ct(f.from,a.from),h=ct(f.to,a.to);if(u<0||!l.inclusiveLeft&&!u){c.push({from:f.from,to:a.from})}if(h>0||!l.inclusiveRight&&!h){c.push({from:a.to,to:f.to})}r.splice.apply(r,c);s+=c.length-3}}return r}function Kt(e){var t=e.markedSpans;if(!t){return}for(var i=0;it)&&(!n||Yt(n,o.marker)<0)){n=o.marker}}}return n}function ti(e,t,i,n,r){var o=tt(e,t);var l=Ht&&o.markedSpans;if(l){for(var a=0;a=0&&u<=0||c<=0&&u>=0){continue}if(c<=0&&(s.marker.inclusiveRight&&r.inclusiveLeft?ct(f.to,i)>=0:ct(f.to,i)>0)||c>=0&&(s.marker.inclusiveRight&&r.inclusiveLeft?ct(f.from,n)<=0:ct(f.from,n)<0)){return true}}}}function ii(e){var t;while(t=Qt(e)){e=t.find(-1,true).line}return e}function ni(e){var t;while(t=Zt(e)){e=t.find(1,true).line}return e}function ri(e){var t,i;while(t=Zt(e)){e=t.find(1,true).line;(i||(i=[])).push(e)}return i}function oi(e,t){var i=tt(e,t),n=ii(i);if(i==n){return t}return ot(n)}function li(e,t){if(t>e.lastLine()){return t}var i=tt(e,t),n;if(!ai(e,i)){return t}while(n=Zt(i)){i=n.find(1,true).line}return ot(i)+1}function ai(e,t){var i=Ht&&t.markedSpans;if(i){for(var n=void 0,r=0;rt.maxLineLength){t.maxLineLength=i;t.maxLine=e}})}var hi=function(e,t,i){this.text=e;$t(this,t);this.height=i?i(this):1};hi.prototype.lineNo=function(){return ot(this)};Me(hi);function di(e,t,i,n){e.text=t;if(e.stateAfter){e.stateAfter=null}if(e.styles){e.styles=null}if(e.order!=null){e.order=null}Kt(e);$t(e,i);var r=n?n(e):1;if(r!=e.height){rt(e,r)}}function pi(e){e.parent=null;Kt(e)}var mi={},gi={};function vi(e,t){if(!e||/^\s*$/.test(e)){return null}var i=t.addModeClass?gi:mi;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function yi(e,t){var i=N("span",null,null,s?"padding-right: .1px":null);var n={pre:N("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:false,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var o=r?t.rest[r-1]:t.line,l=void 0;n.pos=0;n.addToken=bi;if(Ie(e.display.measure)&&(l=ve(o,e.doc.direction))){n.addToken=Ci(n.addToken,l)}n.map=[];var a=t!=e.display.externalMeasured&&ot(o);ki(o,n,Ct(e,o,a));if(o.styleClasses){if(o.styleClasses.bgClass){n.bgClass=E(o.styleClasses.bgClass,n.bgClass||"")}if(o.styleClasses.textClass){n.textClass=E(o.styleClasses.textClass,n.textClass||"")}}if(n.map.length==0){n.map.push(0,0,n.content.appendChild(Ee(e.display.measure)))}if(r==0){t.measure.map=n.map;t.measure.cache={}}else{(t.measure.maps||(t.measure.maps=[])).push(n.map);(t.measure.caches||(t.measure.caches=[])).push({})}}if(s){var f=n.content.lastChild;if(/\bcm-tab\b/.test(f.className)||f.querySelector&&f.querySelector(".cm-tab")){n.content.className="cm-tab-wrap-hack"}}Ce(e,"renderLine",e,t.line,n.pre);if(n.pre.className){n.textClass=E(n.pre.className,n.textClass||"")}return n}function xi(e){var t=A("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);t.setAttribute("aria-label",t.title);return t}function bi(e,t,i,n,r,o,s){if(!t){return}var f=e.splitSpaces?wi(t,e.trailingSpace):t;var c=e.cm.state.specialChars,u=false;var h;if(!c.test(t)){e.col+=t.length;h=document.createTextNode(f);e.map.push(e.pos,e.pos+t.length,h);if(l&&a<9){u=true}e.pos+=t.length}else{h=document.createDocumentFragment();var d=0;while(true){c.lastIndex=d;var p=c.exec(t);var m=p?p.index-d:t.length-d;if(m){var g=document.createTextNode(f.slice(d,d+m));if(l&&a<9){h.appendChild(A("span",[g]))}else{h.appendChild(g)}e.map.push(e.pos,e.pos+m,g);e.col+=m;e.pos+=m}if(!p){break}d+=m+1;var v=void 0;if(p[0]=="\t"){var y=e.cm.options.tabSize,x=y-e.col%y;v=h.appendChild(A("span",Z(x),"cm-tab"));v.setAttribute("role","presentation");v.setAttribute("cm-text","\t");e.col+=x}else if(p[0]=="\r"||p[0]=="\n"){v=h.appendChild(A("span",p[0]=="\r"?"␍":"␤","cm-invalidchar"));v.setAttribute("cm-text",p[0]);e.col+=1}else{v=e.cm.options.specialCharPlaceholder(p[0]);v.setAttribute("cm-text",p[0]);if(l&&a<9){h.appendChild(A("span",[v]))}else{h.appendChild(v)}e.col+=1}e.map.push(e.pos,e.pos+1,v);e.pos++}}e.trailingSpace=f.charCodeAt(t.length-1)==32;if(i||n||r||u||o||s){var b=i||"";if(n){b+=n}if(r){b+=r}var w=A("span",[h],b,o);if(s){for(var C in s){if(s.hasOwnProperty(C)&&C!="style"&&C!="class"){w.setAttribute(C,s[C])}}}return e.content.appendChild(w)}e.content.appendChild(h)}function wi(e,t){if(e.length>1&&!/ /.test(e)){return e}var i=t,n="";for(var r=0;rf&&u.from<=f){break}}if(u.to>=c){return e(i,n,r,o,l,a,s)}e(i,n.slice(0,u.to-f),r,o,null,a,s);o=null;n=n.slice(u.to-f);f=u.to}}}function Si(e,t,i,n){var r=!n&&i.widgetNode;if(r){e.map.push(e.pos,e.pos+t,r)}if(!n&&e.cm.display.input.needsContentAttribute){if(!r){r=e.content.appendChild(document.createElement("span"))}r.setAttribute("cm-marker",i.id)}if(r){e.cm.display.input.setUneditable(r);e.content.appendChild(r)}e.pos+=t;e.trailingSpace=false}function ki(e,t,i){var n=e.markedSpans,r=e.text,o=0;if(!n){for(var l=1;ls||S.collapsed&&C.to==s&&C.from==s)){if(C.to!=null&&C.to!=s&&d>C.to){d=C.to;m=""}if(S.className){p+=" "+S.className}if(S.css){h=(h?h+";":"")+S.css}if(S.startStyle&&C.from==s){g+=" "+S.startStyle}if(S.endStyle&&C.to==d){(b||(b=[])).push(S.endStyle,C.to)}if(S.title){(y||(y={})).title=S.title}if(S.attributes){for(var k in S.attributes){(y||(y={}))[k]=S.attributes[k]}}if(S.collapsed&&(!v||Yt(v.marker,S)<0)){v=C}}else if(C.from>s&&d>C.from){d=C.from}}if(b){for(var L=0;L=a){break}var T=Math.min(a,d);while(true){if(c){var O=s+c.length;if(!v){var A=O>T?c.slice(0,T-s):c;t.addToken(t,A,u?u+p:p,g,s+A.length==d?m:"",h,y)}if(O>=T){c=c.slice(T-s);s=T;break}s=O;g=""}c=r.slice(o,o=i[f++]);u=vi(i[f++],t.cm.options)}}}function Li(e,t,i){this.line=t;this.rest=ri(t);this.size=this.rest?ot(ee(this.rest))-i+1:1;this.node=this.text=null;this.hidden=ai(e,t)}function Mi(e,t,i){var n=[],r;for(var o=t;o2){o.push((s.bottom+f.top)/2-i.top)}}}o.push(i.bottom-i.top)}}function tn(e,t,i){if(e.line==t){return{map:e.measure.map,cache:e.measure.cache}}if(e.rest){for(var n=0;ni){return{map:e.measure.maps[r],cache:e.measure.caches[r],before:true}}}}}function nn(e,t){t=ii(t);var i=ot(t);var n=e.display.externalMeasured=new Li(e.doc,t,i);n.lineN=i;var r=n.built=yi(e,n);n.text=r.pre;O(e.display.lineMeasure,r.pre);return n}function rn(e,t,i,n){return an(e,ln(e,t),i,n)}function on(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt){o=s-a;r=o-1;if(t>=s){l="right"}}if(r!=null){n=e[f+2];if(a==s&&i==(n.insertLeft?"left":"right")){l=i}if(i=="left"&&r==0){while(f&&e[f-2]==e[f-3]&&e[f-1].insertLeft){n=e[(f-=3)+2];l="left"}}if(i=="right"&&r==s-a){while(f=0;r--){if((i=e[r]).left!=i.right){break}}}return i}function un(e,t,i,n){var r=fn(t.map,i,n);var o=r.node,s=r.start,f=r.end,c=r.collapse;var u;if(o.nodeType==3){for(var h=0;h<4;h++){while(s&&ce(t.line.text.charAt(r.coverStart+s))){--s}while(r.coverStart+f0){c=n="right"}var d;if(e.options.lineWrapping&&(d=o.getClientRects()).length>1){u=d[n=="right"?d.length-1:0]}else{u=o.getBoundingClientRect()}}if(l&&a<9&&!s&&(!u||!u.left&&!u.right)){var p=o.parentNode.getClientRects()[0];if(p){u={left:p.left,right:p.left+Hn(e.display),top:p.top,bottom:p.bottom}}else{u=sn}}var m=u.top-t.rect.top,g=u.bottom-t.rect.top;var v=(m+g)/2;var y=t.view.measure.heights;var x=0;for(;x=n.text.length){s=n.text.length;f="before"}else if(s<=0){s=0;f="after"}if(!a){return l(f=="before"?s-1:s,f=="before")}function c(e,t,i){var n=a[t],r=n.level==1;return l(i?e-1:e,r!=i)}var u=me(a,s,f);var h=pe;var d=c(s,u,f=="before");if(h!=null){d.other=c(s,h,f!="before")}return d}function Sn(e,t){var i=0;t=gt(e.doc,t);if(!e.options.lineWrapping){i=Hn(e.display)*t.ch}var n=tt(e.doc,t.line);var r=fi(n)+Xi(e.display);return{left:i,right:i,top:r,bottom:r+n.height}}function kn(e,t,i,n,r){var o=ft(e,t,i);o.xRel=r;if(n){o.outside=n}return o}function Ln(e,t,i){var n=e.doc;i+=e.display.viewOffset;if(i<0){return kn(n.first,0,null,-1,-1)}var r=lt(n,i),o=n.first+n.size-1;if(r>o){return kn(n.first+n.size-1,tt(n,o).text.length,null,1,1)}if(t<0){t=0}var l=tt(n,r);for(;;){var a=An(e,l,r,t,i);var s=ei(l,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s){return a}var f=s.find(1);if(f.line==r){return f}l=tt(n,r=f.line)}}function Mn(e,t,i,n){n-=yn(t);var r=t.text.length;var o=he(function(t){return an(e,i,t-1).bottom<=n},r,0);r=he(function(t){return an(e,i,t).top>n},o,r);return{begin:o,end:r}}function Tn(e,t,i,n){if(!i){i=ln(e,t)}var r=xn(e,t,an(e,i,n),"line").top;return Mn(e,t,i,r)}function On(e,t,i,n){return e.bottom<=i?false:e.top>i?true:(n?e.left:e.right)>t}function An(e,t,i,n,r){r-=fi(t);var o=ln(e,t);var l=yn(t);var a=0,s=t.text.length,f=true;var c=ve(t,e.doc.direction);if(c){var u=(e.options.lineWrapping?Pn:Nn)(e,t,i,o,c,n,r);f=u.level!=1;a=f?u.from:u.to-1;s=f?u.to:u.from-1}var h=null,d=null;var p=he(function(t){var i=an(e,o,t);i.top+=l;i.bottom+=l;if(!On(i,n,r,false)){return false}if(i.top<=r&&i.left<=n){h=t;d=i}return true},a,s);var m,g,v=false;if(d){var y=n-d.left=b.bottom?1:0}p=ue(t.text,p,1);return kn(i,p,g,v,n-m)}function Nn(e,t,i,n,r,o,l){var a=he(function(a){var s=r[a],f=s.level!=1;return On(Cn(e,ft(i,f?s.to:s.from,f?"before":"after"),"line",t,n),o,l,true)},0,r.length-1);var s=r[a];if(a>0){var f=s.level!=1;var c=Cn(e,ft(i,f?s.from:s.to,f?"after":"before"),"line",t,n);if(On(c,o,l,true)&&c.top>l){s=r[a-1]}}return s}function Pn(e,t,i,n,r,o,l){var a=Mn(e,t,n,l);var s=a.begin;var f=a.end;if(/\s/.test(t.text.charAt(f-1))){f--}var c=null,u=null;for(var h=0;h=f||d.to<=s){continue}var p=d.level!=1;var m=an(e,n,p?Math.min(f,d.to)-1:Math.max(s,d.from)).right;var g=mg){c=d;u=g}}if(!c){c=r[r.length-1]}if(c.fromf){c={from:c.from,to:f,level:c.level}}return c}var Fn;function Dn(e){if(e.cachedTextHeight!=null){return e.cachedTextHeight}if(Fn==null){Fn=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t){Fn.appendChild(document.createTextNode("x"));Fn.appendChild(A("br"))}Fn.appendChild(document.createTextNode("x"))}O(e.measure,Fn);var i=Fn.offsetHeight/50;if(i>3){e.cachedTextHeight=i}T(e.measure);return i||1}function Hn(e){if(e.cachedCharWidth!=null){return e.cachedCharWidth}var t=A("span","xxxxxxxxxx");var i=A("pre",[t],"CodeMirror-line-like");O(e.measure,i);var n=t.getBoundingClientRect(),r=(n.right-n.left)/10;if(r>2){e.cachedCharWidth=r}return r||10}function En(e){var t=e.display,i={},n={};var r=t.gutters.clientLeft;for(var o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;i[a]=o.offsetLeft+o.clientLeft+r;n[a]=o.clientWidth}return{fixedPos:Wn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Wn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function In(e){var t=Dn(e.display),i=e.options.lineWrapping;var n=i&&Math.max(5,e.display.scroller.clientWidth/Hn(e.display)-3);return function(r){if(ai(e.doc,r)){return 0}var o=0;if(r.widgets){for(var l=0;l0&&(f=tt(e.doc,s.line).text).length==s.ch){var c=U(f,f.length,e.options.tabSize)-f.length;s=ft(s.line,Math.max(0,Math.round((o-Yi(e.display).left)/Hn(e.display))-c))}return s}function jn(e,t){if(t>=e.display.viewTo){return null}t-=e.display.viewFrom;if(t<0){return null}var i=e.display.view;for(var n=0;nt)){r.updateLineNumbers=t}e.curOp.viewChanged=true;if(t>=r.viewTo){if(Ht&&oi(e.doc,t)r.viewFrom){Un(e)}else{r.viewFrom+=n;r.viewTo+=n}}else if(t<=r.viewFrom&&i>=r.viewTo){Un(e)}else if(t<=r.viewFrom){var o=Gn(e,i,i+n,1);if(o){r.view=r.view.slice(o.index);r.viewFrom=o.lineN;r.viewTo+=n}else{Un(e)}}else if(i>=r.viewTo){var l=Gn(e,t,t,-1);if(l){r.view=r.view.slice(0,l.index);r.viewTo=l.lineN}else{Un(e)}}else{var a=Gn(e,t,t,-1);var s=Gn(e,i,i+n,1);if(a&&s){r.view=r.view.slice(0,a.index).concat(Mi(e,a.lineN,s.lineN)).concat(r.view.slice(s.index));r.viewTo+=n}else{Un(e)}}var f=r.externalMeasured;if(f){if(i=r.lineN&&t=n.viewTo){return}var o=n.view[jn(e,t)];if(o.node==null){return}var l=o.changes||(o.changes=[]);if(V(l,i)==-1){l.push(i)}}function Un(e){e.display.viewFrom=e.display.viewTo=e.doc.first;e.display.view=[];e.display.viewOffset=0}function Gn(e,t,i,n){var r=jn(e,t),o,l=e.display.view;if(!Ht||i==e.doc.first+e.doc.size){return{index:r,lineN:i}}var a=e.display.viewFrom;for(var s=0;s0){if(r==l.length-1){return null}o=a+l[r].size-t;r++}else{o=a-t}t+=o;i+=o}while(oi(e.doc,i)!=i){if(r==(n<0?0:l.length-1)){return null}i+=n*l[r-(n<0?1:0)].size;r+=n}return{index:r,lineN:i}}function Vn(e,t,i){var n=e.display,r=n.view;if(r.length==0||t>=n.viewTo||i<=n.viewFrom){n.view=Mi(e,t,i);n.viewFrom=t}else{if(n.viewFrom>t){n.view=Mi(e,t,n.viewFrom).concat(n.view)}else if(n.viewFromi){n.view=n.view.slice(0,jn(e,i))}}n.viewTo=i}function Kn(e){var t=e.display.view,i=0;for(var n=0;n=e.display.viewTo||s.to().line0?l:e.defaultCharWidth())+"px"}if(n.other){var a=i.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="";a.style.left=n.other.left+"px";a.style.top=n.other.top+"px";a.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function Yn(e,t){return e.top-t.top||e.left-t.left}function Jn(e,t,i){var n=e.display,r=e.doc;var o=document.createDocumentFragment();var l=Yi(e.display),a=l.left;var s=Math.max(n.sizerWidth,Qi(e)-n.sizer.offsetLeft)-l.right;var f=r.direction=="ltr";function c(e,t,i,n){if(t<0){t=0}t=Math.round(t);n=Math.round(n);o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(i==null?s-e:i)+"px;\n height: "+(n-t)+"px"))}function u(t,i,n){var o=tt(r,t);var l=o.text.length;var u,h;function d(i,n){return wn(e,ft(t,i),"div",o,n)}function p(t,i,n){var r=Tn(e,o,null,t);var l=i=="ltr"==(n=="after")?"left":"right";var a=n=="after"?r.begin:r.end-(/\s/.test(o.text.charAt(r.end-1))?2:1);return d(a,l)[l]}var m=ve(o,r.direction);de(m,i||0,n==null?l:n,function(e,t,r,o){var g=r=="ltr";var v=d(e,g?"left":"right");var y=d(t-1,g?"right":"left");var x=i==null&&e==0,b=n==null&&t==l;var w=o==0,C=!m||o==m.length-1;if(y.top-v.top<=3){var S=(f?x:b)&&w;var k=(f?b:x)&&C;var L=S?a:(g?v:y).left;var M=k?s:(g?y:v).right;c(L,v.top,M-L,v.bottom)}else{var T,O,A,N;if(g){T=f&&x&&w?a:v.left;O=f?s:p(e,r,"before");A=f?a:p(t,r,"after");N=f&&b&&C?s:y.right}else{T=!f?a:p(e,r,"before");O=!f&&x&&w?s:v.right;A=!f&&b&&C?a:y.left;N=!f?s:p(t,r,"after")}c(T,v.top,O-T,v.bottom);if(v.bottom0){t.blinker=setInterval(function(){if(!e.hasFocus()){ir(e)}t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate)}else if(e.options.cursorBlinkRate<0){t.cursorDiv.style.visibility="hidden"}}function Zn(e){if(!e.hasFocus()){e.display.input.focus();if(!e.state.focused){tr(e)}}}function er(e){e.state.delayingBlurEvent=true;setTimeout(function(){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false;if(e.state.focused){ir(e)}}},100)}function tr(e,t){if(e.state.delayingBlurEvent&&!e.state.draggingText){e.state.delayingBlurEvent=false}if(e.options.readOnly=="nocursor"){return}if(!e.state.focused){Ce(e,"focus",e,t);e.state.focused=true;H(e.display.wrapper,"CodeMirror-focused");if(!e.curOp&&e.display.selForContextMenu!=e.doc.sel){e.display.input.reset();if(s){setTimeout(function(){return e.display.input.reset(true)},20)}}e.display.input.receivedFocus()}Qn(e)}function ir(e,t){if(e.state.delayingBlurEvent){return}if(e.state.focused){Ce(e,"blur",e,t);e.state.focused=false;M(e.display.wrapper,"CodeMirror-focused")}clearInterval(e.display.blinker);setTimeout(function(){if(!e.state.focused){e.display.shift=false}},150)}function nr(e){var t=e.display;var i=t.lineDiv.offsetTop;var n=Math.max(0,t.scroller.getBoundingClientRect().top);var r=t.lineDiv.getBoundingClientRect().top;var o=0;for(var s=0;s.005||m<-.005){if(re.display.sizerWidth){var v=Math.ceil(h/Hn(e.display));if(v>e.display.maxLineLength){e.display.maxLineLength=v;e.display.maxLine=f.line;e.display.maxLineChanged=true}}}if(Math.abs(o)>2){t.scroller.scrollTop+=o}}function rr(e){if(e.widgets){for(var t=0;t=l){o=lt(t,fi(tt(t,s))-e.wrapper.clientHeight);l=s}}return{from:o,to:Math.max(l,o+1)}}function lr(e,t){if(Se(e,"scrollCursorIntoView")){return}var i=e.display,n=i.sizer.getBoundingClientRect(),r=null;var o=i.wrapper.ownerDocument;if(t.top+n.top<0){r=true}else if(t.bottom+n.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)){r=false}if(r!=null&&!m){var l=A("div","​",null,"position: absolute;\n top: "+(t.top-i.viewOffset-Xi(e.display))+"px;\n height: "+(t.bottom-t.top+Ji(e)+i.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l);l.scrollIntoView(r);e.display.lineSpace.removeChild(l)}}function ar(e,t,i,n){if(n==null){n=0}var r;if(!e.options.lineWrapping&&t==i){i=t.sticky=="before"?ft(t.line,t.ch+1,"before"):t;t=t.ch?ft(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t}for(var o=0;o<5;o++){var l=false;var a=Cn(e,t);var s=!i||i==t?a:Cn(e,i);r={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-n,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+n};var f=fr(e,r);var c=e.doc.scrollTop,u=e.doc.scrollLeft;if(f.scrollTop!=null){gr(e,f.scrollTop);if(Math.abs(e.doc.scrollTop-c)>1){l=true}}if(f.scrollLeft!=null){yr(e,f.scrollLeft);if(Math.abs(e.doc.scrollLeft-u)>1){l=true}}if(!l){break}}return r}function sr(e,t){var i=fr(e,t);if(i.scrollTop!=null){gr(e,i.scrollTop)}if(i.scrollLeft!=null){yr(e,i.scrollLeft)}}function fr(e,t){var i=e.display,n=Dn(e.display);if(t.top<0){t.top=0}var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop;var o=Zi(e),l={};if(t.bottom-t.top>o){t.bottom=t.top+o}var a=e.doc.height+_i(i);var s=t.topa-n;if(t.topr+o){var c=Math.min(t.top,(f?a:t.bottom)-o);if(c!=r){l.scrollTop=c}}var u=e.options.fixedGutter?0:i.gutters.offsetWidth;var h=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-u;var d=Qi(e)-i.gutters.offsetWidth;var p=t.right-t.left>d;if(p){t.right=t.left+d}if(t.left<10){l.scrollLeft=0}else if(t.leftd+h-3){l.scrollLeft=t.right+(p?0:10)-d}return l}function cr(e,t){if(t==null){return}pr(e);e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ur(e){pr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hr(e,t,i){if(t!=null||i!=null){pr(e)}if(t!=null){e.curOp.scrollLeft=t}if(i!=null){e.curOp.scrollTop=i}}function dr(e,t){pr(e);e.curOp.scrollToPos=t}function pr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Sn(e,t.from),n=Sn(e,t.to);mr(e,i,n,t.margin)}}function mr(e,t,i,n){var r=fr(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});hr(e,r.scrollLeft,r.scrollTop)}function gr(e,t){if(Math.abs(e.doc.scrollTop-t)<2){return}if(!i){$r(e,{top:t})}vr(e,t,true);if(i){$r(e)}Br(e,100)}function vr(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t));if(e.display.scroller.scrollTop==t&&!i){return}e.doc.scrollTop=t;e.display.scrollbars.setScrollTop(t);if(e.display.scroller.scrollTop!=t){e.display.scroller.scrollTop=t}}function yr(e,t,i,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth));if((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n){return}e.doc.scrollLeft=t;Jr(e);if(e.display.scroller.scrollLeft!=t){e.display.scroller.scrollLeft=t}e.display.scrollbars.setScrollLeft(t)}function xr(e){var t=e.display,i=t.gutters.offsetWidth;var n=Math.round(e.doc.height+_i(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:n,scrollHeight:n+Ji(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var br=function(e,t,i){this.cm=i;var n=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var r=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=r.tabIndex=-1;e(n);e(r);xe(n,"scroll",function(){if(n.clientHeight){t(n.scrollTop,"vertical")}});xe(r,"scroll",function(){if(r.clientWidth){t(r.scrollLeft,"horizontal")}});this.checkedZeroWidth=false;if(l&&a<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}};br.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1;var i=e.scrollHeight>e.clientHeight+1;var n=e.nativeBarWidth;if(i){this.vert.style.display="block";this.vert.style.bottom=t?n+"px":"0";var r=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else{this.vert.scrollTop=0;this.vert.style.display="";this.vert.firstChild.style.height="0"}if(t){this.horiz.style.display="block";this.horiz.style.right=i?n+"px":"0";this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&e.clientHeight>0){if(n==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{right:i?n:0,bottom:t?n:0}};br.prototype.setScrollLeft=function(e){if(this.horiz.scrollLeft!=e){this.horiz.scrollLeft=e}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}};br.prototype.setScrollTop=function(e){if(this.vert.scrollTop!=e){this.vert.scrollTop=e}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}};br.prototype.zeroWidthHack=function(){var e=x&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e;this.horiz.style.visibility=this.vert.style.visibility="hidden";this.disableHoriz=new G;this.disableVert=new G};br.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function n(){var r=e.getBoundingClientRect();var o=i=="vert"?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);if(o!=e){e.style.visibility="hidden"}else{t.set(1e3,n)}}t.set(1e3,n)};br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz);e.removeChild(this.vert)};var wr=function(){};wr.prototype.update=function(){return{bottom:0,right:0}};wr.prototype.setScrollLeft=function(){};wr.prototype.setScrollTop=function(){};wr.prototype.clear=function(){};function Cr(e,t){if(!t){t=xr(e)}var i=e.display.barWidth,n=e.display.barHeight;Sr(e,t);for(var r=0;r<4&&i!=e.display.barWidth||n!=e.display.barHeight;r++){if(i!=e.display.barWidth&&e.options.lineWrapping){nr(e)}Sr(e,xr(e));i=e.display.barWidth;n=e.display.barHeight}}function Sr(e,t){var i=e.display;var n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px";i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px";i.heightForcer.style.borderBottom=n.bottom+"px solid transparent";if(n.right&&n.bottom){i.scrollbarFiller.style.display="block";i.scrollbarFiller.style.height=n.bottom+"px";i.scrollbarFiller.style.width=n.right+"px"}else{i.scrollbarFiller.style.display=""}if(n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter){i.gutterFiller.style.display="block";i.gutterFiller.style.height=n.bottom+"px";i.gutterFiller.style.width=t.gutterWidth+"px"}else{i.gutterFiller.style.display=""}}var kr={native:br,null:wr};function Lr(e){if(e.display.scrollbars){e.display.scrollbars.clear();if(e.display.scrollbars.addClass){M(e.display.wrapper,e.display.scrollbars.addClass)}}e.display.scrollbars=new kr[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller);xe(t,"mousedown",function(){if(e.state.focused){setTimeout(function(){return e.display.input.focus()},0)}});t.setAttribute("cm-not-content","true")},function(t,i){if(i=="horizontal"){yr(e,t)}else{gr(e,t)}},e);if(e.display.scrollbars.addClass){H(e.display.wrapper,e.display.scrollbars.addClass)}}var Mr=0;function Tr(e){e.curOp={cm:e,viewChanged:false,startHeight:e.doc.height,forceUpdate:false,updateInput:0,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++Mr,markArrays:null};Oi(e.curOp)}function Or(e){var t=e.curOp;if(t){Ni(t,function(e){for(var t=0;t=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping;e.update=e.mustUpdate&&new zr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Pr(e){e.updatedDisplay=e.mustUpdate&&Vr(e.cm,e.update)}function Fr(e){var t=e.cm,i=t.display;if(e.updatedDisplay){nr(t)}e.barMeasure=xr(t);if(i.maxLineChanged&&!t.options.lineWrapping){e.adjustWidthTo=rn(t,i.maxLine,i.maxLine.text.length).left+3;t.display.sizerWidth=e.adjustWidthTo;e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Ji(t)+t.display.barWidth);e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Qi(t))}if(e.updatedDisplay||e.selectionChanged){e.preparedSelection=i.input.prepareSelection()}}function Dr(e){var t=e.cm;if(e.adjustWidthTo!=null){t.display.sizer.style.minWidth=e.adjustWidthTo+"px";if(e.maxScrollLeft=e.display.viewTo){return}var i=+new Date+e.options.workTime;var n=St(e,t.highlightFrontier);var r=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles;var a=o.text.length>e.options.maxHighlightLength?Je(t.mode,n.state):null;var s=wt(e,o,n,true);if(a){n.state=a}o.styles=s.styles;var f=o.styleClasses,c=s.classes;if(c){o.styleClasses=c}else if(f){o.styleClasses=null}var u=!l||l.length!=o.styles.length||f!=c&&(!f||!c||f.bgClass!=c.bgClass||f.textClass!=c.textClass);for(var h=0;!u&&hi){Br(e,e.options.workDelay);return true}});t.highlightFrontier=n.line;t.modeFrontier=Math.max(t.modeFrontier,n.line);if(r.length){Er(e,function(){for(var t=0;t=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Kn(e)==0){return false}if(Qr(e)){Un(e);t.dims=En(e)}var r=n.first+n.size;var o=Math.max(t.visible.from-e.options.viewportMargin,n.first);var l=Math.min(r,t.visible.to+e.options.viewportMargin);if(i.viewFroml&&i.viewTo-l<20){l=Math.min(r,i.viewTo)}if(Ht){o=oi(e.doc,o);l=li(e.doc,l)}var a=o!=i.viewFrom||l!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vn(e,o,l);i.viewOffset=fi(tt(e.doc,i.viewFrom));e.display.mover.style.top=i.viewOffset+"px";var s=Kn(e);if(!a&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)){return false}var f=Ur(e);if(s>4){i.lineDiv.style.display="none"}Xr(e,i.updateLineNumbers,t.dims);if(s>4){i.lineDiv.style.display=""}i.renderedView=i.view;Gr(f);T(i.cursorDiv);T(i.selectionDiv);i.gutters.style.height=i.sizer.style.minHeight=0;if(a){i.lastWrapHeight=t.wrapperHeight;i.lastWrapWidth=t.wrapperWidth;Br(e,400)}i.updateLineNumbers=null;return true}function Kr(e,t){var i=t.viewport;for(var n=true;;n=false){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Qi(e)){if(i&&i.top!=null){i={top:Math.min(e.doc.height+_i(e.display)-Zi(e),i.top)}}t.visible=or(e.display,e.doc,i);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo){break}}else if(n){t.visible=or(e.display,e.doc,i)}if(!Vr(e,t)){break}nr(e);var r=xr(e);$n(e);Cr(e,r);Yr(e,r);t.force=false}t.signal(e,"update",e);if(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 $r(e,t){var i=new zr(e,t);if(Vr(e,i)){nr(e);Kr(e,i);var n=xr(e);$n(e);Cr(e,n);Yr(e,n);i.finish()}}function Xr(e,t,i){var n=e.display,r=e.options.lineNumbers;var o=n.lineDiv,l=o.firstChild;function a(t){var i=t.nextSibling;if(s&&x&&e.display.currentWheelTarget==t){t.style.display="none"}else{t.parentNode.removeChild(t)}return i}var f=n.view,c=n.viewFrom;for(var u=0;u-1){p=false}Hi(e,h,c,i)}if(p){T(h.lineNumber);h.lineNumber.appendChild(document.createTextNode(st(e.options,c)))}l=h.node.nextSibling}c+=h.size}while(l){l=a(l)}}function _r(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px";Fi(e,"gutterChanged",e)}function Yr(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+Ji(e)+"px"}function Jr(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter)){return}var n=Wn(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var r=t.gutters.offsetWidth,o=n+"px";for(var l=0;l=105){o.wrapper.style.clipPath="inset(0px)"}o.wrapper.setAttribute("translate","no");if(l&&a<8){o.gutters.style.zIndex=-1;o.scroller.style.paddingRight=0}if(!s&&!(i&&y)){o.scroller.draggable=true}if(e){if(e.appendChild){e.appendChild(o.wrapper)}else{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=false;o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null;o.alignWidgets=false;o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null;o.maxLine=null;o.maxLineLength=0;o.maxLineChanged=false;o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null;o.shift=false;o.selForContextMenu=null;o.activeTouch=null;o.gutterSpecs=Zr(r.gutters,r.lineNumbers);eo(o);n.init(o)}var no=0,ro=null;if(l){ro=-.53}else if(i){ro=15}else if(c){ro=-.7}else if(d){ro=-1/3}function oo(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;if(t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS){t=e.detail}if(i==null&&e.detail&&e.axis==e.VERTICAL_AXIS){i=e.detail}else if(i==null){i=e.wheelDelta}return{x:t,y:i}}function lo(e){var t=oo(e);t.x*=ro;t.y*=ro;return t}function ao(e,t){if(c&&u==102){if(e.display.chromeScrollHack==null){e.display.sizer.style.pointerEvents="none"}else{clearTimeout(e.display.chromeScrollHack)}e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null;e.display.sizer.style.pointerEvents=""},100)}var n=oo(t),r=n.x,o=n.y;var l=ro;if(t.deltaMode===0){r=t.deltaX;o=t.deltaY;l=1}var a=e.display,f=a.scroller;var d=f.scrollWidth>f.clientWidth;var p=f.scrollHeight>f.clientHeight;if(!(r&&d||o&&p)){return}if(o&&x&&s){e:for(var m=t.target,g=a.view;m!=f;m=m.parentNode){for(var v=0;v=0&&ct(e,n.to())<=0){return i}}return-1};var fo=function(e,t){this.anchor=e;this.head=t};fo.prototype.from=function(){return pt(this.anchor,this.head)};fo.prototype.to=function(){return dt(this.anchor,this.head)};fo.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function co(e,t,i){var n=e&&e.options.selectionsMayTouch;var r=t[i];t.sort(function(e,t){return ct(e.from(),t.from())});i=V(t,r);for(var o=1;o0:s>=0){var f=pt(a.from(),l.from()),c=dt(a.to(),l.to());var u=a.empty()?l.from()==l.head:a.from()==a.head;if(o<=i){--i}t.splice(--o,2,new fo(u?c:f,u?f:c))}}return new so(t,i)}function uo(e,t){return new so([new fo(e,t||e)],0)}function ho(e){if(!e.text){return e.to}return ft(e.from.line+e.text.length-1,ee(e.text).length+(e.text.length==1?e.from.ch:0))}function po(e,t){if(ct(e,t.from)<0){return e}if(ct(e,t.to)<=0){return ho(t)}var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;if(e.line==t.to.line){n+=ho(t).ch-t.to.ch}return ft(i,n)}function mo(e,t){var i=[];for(var n=0;n1){e.remove(a.line+1,p-1)}e.insert(a.line+1,v)}Fi(e,"change",e,t)}function Co(e,t,i){function n(e,r,o){if(e.linked){for(var l=0;l1&&!e.done[e.done.length-2].ranges){e.done.pop();return ee(e.done)}}function No(e,t,i,n){var r=e.history;r.undone.length=0;var o=+new Date,l;var a;if((r.lastOp==n||r.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&r.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(l=Ao(r,r.lastOp==n))){a=ee(l.changes);if(ct(t.from,t.to)==0&&ct(t.from,a.to)==0){a.to=ho(t)}else{l.changes.push(To(e,t))}}else{var s=ee(r.done);if(!s||!s.ranges){Do(e.sel,r.done)}l={changes:[To(e,t)],generation:r.generation};r.done.push(l);while(r.done.length>r.undoDepth){r.done.shift();if(!r.done[0].ranges){r.done.shift()}}}r.done.push(i);r.generation=++r.maxGeneration;r.lastModTime=r.lastSelTime=o;r.lastOp=r.lastSelOp=n;r.lastOrigin=r.lastSelOrigin=t.origin;if(!a){Ce(e,"historyAdded")}}function Po(e,t,i,n){var r=t.charAt(0);return r=="*"||r=="+"&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Fo(e,t,i,n){var r=e.history,o=n&&n.origin;if(i==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||Po(e,o,ee(r.done),t))){r.done[r.done.length-1]=t}else{Do(t,r.done)}r.lastSelTime=+new Date;r.lastSelOrigin=o;r.lastSelOp=i;if(n&&n.clearRedo!==false){Oo(r.undone)}}function Do(e,t){var i=ee(t);if(!(i&&i.ranges&&i.equals(e))){t.push(e)}}function Ho(e,t,i,n){var r=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,n),function(i){if(i.markedSpans){(r||(r=t["spans_"+e.id]={}))[o]=i.markedSpans}++o})}function Eo(e){if(!e){return null}var t;for(var i=0;i-1){ee(a)[u]=f[u];delete f[u]}}}}}}return n}function Bo(e,t,i,n){if(n){var r=e.anchor;if(i){var o=ct(t,r)<0;if(o!=ct(i,r)<0){r=t;t=i}else if(o!=ct(t,i)<0){t=i}}return new fo(r,t)}else{return new fo(i||t,t)}}function jo(e,t,i,n,r){if(r==null){r=e.cm&&(e.cm.display.shift||e.extend)}Ko(e,new so([Bo(e.sel.primary(),t,i,r)],0),n)}function zo(e,t,i){var n=[];var r=e.cm&&(e.cm.display.shift||e.extend);for(var o=0;o=t.ch:a.to>t.ch))){if(r){Ce(s,"beforeCursorEnter");if(s.explicitlyCleared){if(!o.markedSpans){break}else{--l;continue}}}if(!s.atomic){continue}if(i){var u=s.find(n<0?1:-1),h=void 0;if(n<0?c:f){u=Zo(e,u,-n,u&&u.line==t.line?o:null)}if(u&&u.line==t.line&&(h=ct(u,i))&&(n<0?h<0:h>0)){return Jo(e,u,t,n,r)}}var d=s.find(n<0?-1:1);if(n<0?f:c){d=Zo(e,d,n,d.line==t.line?o:null)}return d?Jo(e,d,t,n,r):null}}}return t}function Qo(e,t,i,n,r){var o=n||1;var l=Jo(e,t,i,o,r)||!r&&Jo(e,t,i,o,true)||Jo(e,t,i,-o,r)||!r&&Jo(e,t,i,-o,true);if(!l){e.cantEdit=true;return ft(e.first,0)}return l}function Zo(e,t,i,n){if(i<0&&t.ch==0){if(t.line>e.first){return gt(e,ft(t.line-1))}else{return null}}else if(i>0&&t.ch==(n||tt(e,t.line)).text.length){if(t.line=0;--r){nl(e,{from:n[r].from,to:n[r].to,text:r?[""]:t.text,origin:t.origin})}}else{nl(e,t)}}function nl(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0){return}var i=mo(e,t);No(e,t,i,e.cm?e.cm.curOp.id:NaN);ll(e,t,i,Ut(e,t));var n=[];Co(e,function(e,i){if(!i&&V(n,e.history)==-1){ul(e.history,t);n.push(e.history)}ll(e,t,null,Ut(e,t))})}function rl(e,t,i){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!i){return}var r=e.history,o,l=e.sel;var a=t=="undo"?r.done:r.undone,s=t=="undo"?r.undone:r.done;var f=0;for(;f=0;--d){var p=h(d);if(p)return p.v}}function ol(e,t){if(t==0){return}e.first+=t;e.sel=new so(te(e.sel.ranges,function(e){return new fo(ft(e.anchor.line+t,e.anchor.ch),ft(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){zn(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,n=i.viewFrom;ne.lastLine()){return}if(t.from.lineo){t={from:t.from,to:ft(o,tt(e,o).text.length),text:[t.text[0]],origin:t.origin}}t.removed=it(e,t.from,t.to);if(!i){i=mo(e,t)}if(e.cm){al(e.cm,t,n)}else{wo(e,t,n)}$o(e,i,X);if(e.cantEdit&&Qo(e,ft(e.firstLine(),0))){e.cantEdit=false}}function al(e,t,i){var n=e.doc,r=e.display,o=t.from,l=t.to;var a=false,s=o.line;if(!e.options.lineWrapping){s=ot(ii(tt(n,o.line)));n.iter(s,l.line+1,function(e){if(e==r.maxLine){a=true;return true}})}if(n.sel.contains(t.from,t.to)>-1){ke(e)}wo(n,t,i,In(e));if(!e.options.lineWrapping){n.iter(s,o.line+t.text.length,function(e){var t=ci(e);if(t>r.maxLineLength){r.maxLine=e;r.maxLineLength=t;r.maxLineChanged=true;a=false}});if(a){e.curOp.updateMaxLine=true}}Ft(n,o.line);Br(e,400);var f=t.text.length-(l.line-o.line)-1;if(t.full){zn(e)}else if(o.line==l.line&&t.text.length==1&&!bo(e.doc,t)){qn(e,o.line,"text")}else{zn(e,o.line,l.line+1,f)}var c=Le(e,"changes"),u=Le(e,"change");if(u||c){var h={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};if(u){Fi(e,"change",e,h)}if(c){(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}}e.display.selForContextMenu=null}function sl(e,t,i,n,r){var o;if(!n){n=i}if(ct(n,i)<0){o=[n,i],i=o[0],n=o[1]}if(typeof t=="string"){t=e.splitLines(t)}il(e,{from:i,to:n,text:t,origin:r})}function fl(e,t,i,n){if(i1||!(this.children[0]instanceof dl))){var a=[];this.collapse(a);this.children=[new dl(a)];this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){var l=r.lines.length%25+25;for(var a=l;a10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var n=0;ne.display.maxLineLength){e.display.maxLine=f;e.display.maxLineLength=c;e.display.maxLineChanged=true}}}if(n!=null&&e&&this.collapsed){zn(e,n,r+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(e){_o(e.doc)}}if(e){Fi(e,"markerCleared",e,this,n,r)}if(t){Or(e)}if(this.parent){this.parent.clear()}};xl.prototype.find=function(e,t){if(e==null&&this.type=="bookmark"){e=1}var i,n;for(var r=0;r0||l==0&&o.clearWhenEmpty!==false){return o}if(o.replacedWith){o.collapsed=true;o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget");if(!n.handleMouseEvents){o.widgetNode.setAttribute("cm-ignore-events","true")}if(n.insertLeft){o.widgetNode.insertLeft=true}}if(o.collapsed){if(ti(e,t.line,t,i,o)||t.line!=i.line&&ti(e,i.line,t,i,o)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}Wt()}if(o.addToHistory){No(e,{from:t,to:i,origin:"markText"},e.sel,NaN)}var a=t.line,s=e.cm,f;e.iter(a,i.line+1,function(n){if(s&&o.collapsed&&!s.options.lineWrapping&&ii(n)==s.display.maxLine){f=true}if(o.collapsed&&a!=t.line){rt(n,0)}jt(n,new It(o,a==t.line?t.ch:null,a==i.line?i.ch:null),e.cm&&e.cm.curOp);++a});if(o.collapsed){e.iter(t.line,i.line+1,function(t){if(ai(e,t)){rt(t,0)}})}if(o.clearOnEnter){xe(o,"beforeCursorEnter",function(){return o.clear()})}if(o.readOnly){Et();if(e.history.done.length||e.history.undone.length){e.clearHistory()}}if(o.collapsed){o.id=++yl;o.atomic=true}if(s){if(f){s.curOp.updateMaxLine=true}if(o.collapsed){zn(s,t.line,i.line+1)}else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title){for(var c=t.line;c<=i.line;c++){qn(s,c,"text")}}if(o.atomic){_o(s.doc)}Fi(s,"markerAdded",s,o)}return o}var wl=function(e,t){this.markers=e;this.primary=t;for(var i=0;i=0;s--){il(this,n[s])}if(a){Vo(this,a)}else if(this.cm){ur(this.cm)}}),undo:Rr(function(){rl(this,"undo")}),redo:Rr(function(){rl(this,"redo")}),undoSelection:Rr(function(){rl(this,"undo",true)}),redoSelection:Rr(function(){rl(this,"redo",true)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,i=0;for(var n=0;n=e.ch)){t.push(r.marker.parent||r.marker)}}}return t},findMarks:function(e,t,i){e=gt(this,e);t=gt(this,t);var n=[],r=e.line;this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l){for(var a=0;a=s.to||s.from==null&&r!=e.line||s.from!=null&&r==t.line&&s.from>=t.ch)&&(!i||i(s.marker))){n.push(s.marker.parent||s.marker)}}}++r});return n},getAllMarks:function(){var e=[];this.iter(function(t){var i=t.markedSpans;if(i){for(var n=0;ne){t=e;return true}e-=o;++i});return gt(this,ft(i,t))},indexFromPos:function(e){e=gt(this,e);var t=e.ch;if(e.linet){t=e.from}if(e.to!=null&&e.to-1){t.state.draggingText(e);setTimeout(function(){return t.display.input.focus()},20);return}try{var u=e.dataTransfer.getData("Text");if(u){var h;if(t.state.draggingText&&!t.state.draggingText.copy){h=t.listSelections()}$o(t.doc,uo(i,i));if(h){for(var d=0;d=0;t--){sl(e.doc,"",n[t].from,n[t].to,"+delete")}ur(e)})}function Jl(e,t,i){var n=ue(e.text,t+i,i);return n<0||n>e.text.length?null:n}function Ql(e,t,i){var n=Jl(e,t.ch,i);return n==null?null:new ft(t.line,n,i<0?"after":"before")}function Zl(e,t,i,n,r){if(e){if(t.doc.direction=="rtl"){r=-r}var o=ve(i,t.doc.direction);if(o){var l=r<0?ee(o):o[0];var a=r<0==(l.level==1);var s=a?"after":"before";var f;if(l.level>0||t.doc.direction=="rtl"){var c=ln(t,i);f=r<0?i.text.length-1:0;var u=an(t,c,f).top;f=he(function(e){return an(t,c,e).top==u},r<0==(l.level==1)?l.from:l.to-1,f);if(s=="before"){f=Jl(i,f,1)}}else{f=r<0?l.to:l.from}return new ft(n,f,s)}}return new ft(n,r<0?i.text.length:0,r<0?"before":"after")}function ea(e,t,i,n){var r=ve(t,e.doc.direction);if(!r){return Ql(t,i,n)}if(i.ch>=t.text.length){i.ch=t.text.length;i.sticky="before"}else if(i.ch<=0){i.ch=0;i.sticky="after"}var o=me(r,i.ch,i.sticky),l=r[o];if(e.doc.direction=="ltr"&&l.level%2==0&&(n>0?l.to>i.ch:l.from=l.from&&h>=c.begin:h<=l.to&&h<=c.end)){var d=u?"before":"after";return new ft(i.line,h,d)}}var p=function(e,t,n){var o=function(e,t){return t?new ft(i.line,a(e,1),"before"):new ft(i.line,e,"after")};for(;e>=0&&e0==(l.level!=1);var f=s?n.begin:a(n.end,-1);if(l.from<=f&&f0?c.end:a(c.begin,-1);if(g!=null&&!(n>0&&g==t.text.length)){m=p(n>0?0:r.length-1,n,f(g));if(m){return m}}return null}var ta={selectAll:el,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),X)},killLine:function(e){return Yl(e,function(t){if(t.empty()){var i=tt(e.doc,t.head.line).text.length;if(t.head.ch==i&&t.head.line0){r=new ft(r.line,r.ch+1);e.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),ft(r.line,r.ch-2),r,"+transpose")}else if(r.line>e.doc.first){var l=tt(e.doc,r.line-1).text;if(l){r=new ft(r.line,1);e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ft(r.line-1,l.length-1),r,"+transpose")}}}i.push(new fo(r,r))}e.setSelections(i)})},newlineAndIndent:function(e){return Er(e,function(){var t=e.listSelections();for(var i=t.length-1;i>=0;i--){e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input")}t=e.listSelections();for(var n=0;ne&&ct(t,this.pos)==0&&i==this.button};var xa,ba;function wa(e,t){var i=+new Date;if(ba&&ba.compare(i,e,t)){xa=ba=null;return"triple"}else if(xa&&xa.compare(i,e,t)){ba=new ya(i,e,t);xa=null;return"double"}else{xa=new ya(i,e,t);ba=null;return"single"}}function Ca(e){var t=this,i=t.display;if(Se(t,e)||i.activeTouch&&i.input.supportsTouch()){return}i.input.ensurePolled();i.shift=e.shiftKey;if($i(i,e)){if(!s){i.scroller.draggable=false;setTimeout(function(){return i.scroller.draggable=true},100)}return}if(Pa(t,e)){return}var n=Bn(t,e),r=Fe(e),o=n?wa(n,r):"single";j(t).focus();if(r==1&&t.state.selectingText){t.state.selectingText(e)}if(n&&Sa(t,r,n,o,e)){return}if(r==1){if(n){La(t,n,o,e)}else if(Pe(e)==i.scroller){Te(e)}}else if(r==2){if(n){jo(t.doc,n)}setTimeout(function(){return i.input.focus()},20)}else if(r==3){if(k){t.display.input.onContextMenu(e)}else{er(t)}}}function Sa(e,t,i,n,r){var o="Click";if(n=="double"){o="Double"+o}else if(n=="triple"){o="Triple"+o}o=(t==1?"Left":t==2?"Middle":"Right")+o;return sa(e,$l(o,r),r,function(t){if(typeof t=="string"){t=ta[t]}if(!t){return false}var n=false;try{if(e.isReadOnly()){e.state.suppressEdits=true}n=t(e,i)!=$}finally{e.state.suppressEdits=false}return n})}function ka(e,t,i){var n=e.getOption("configureMouse");var r=n?n(e,t,i):{};if(r.unit==null){var o=b?i.shiftKey&&i.metaKey:i.altKey;r.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}if(r.extend==null||e.doc.extend){r.extend=e.doc.extend||i.shiftKey}if(r.addNew==null){r.addNew=x?i.metaKey:i.ctrlKey}if(r.moveOnDrag==null){r.moveOnDrag=!(x?i.altKey:i.ctrlKey)}return r}function La(e,t,i,n){if(l){setTimeout(z(Zn,e),0)}else{e.curOp.focus=D(R(e))}var r=ka(e,i,n);var o=e.doc.sel,a;if(e.options.dragDrop&&De&&!e.isReadOnly()&&i=="single"&&(a=o.contains(t))>-1&&(ct((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(ct(a.to(),t)>0||t.xRel<0)){Ma(e,n,t,r)}else{Oa(e,n,t,r)}}function Ma(e,t,i,n){var r=e.display,o=false;var f=Wr(e,function(t){if(s){r.scroller.draggable=false}e.state.draggingText=false;if(e.state.delayingBlurEvent){if(e.hasFocus()){e.state.delayingBlurEvent=false}else{er(e)}}we(r.wrapper.ownerDocument,"mouseup",f);we(r.wrapper.ownerDocument,"mousemove",c);we(r.scroller,"dragstart",u);we(r.scroller,"drop",f);if(!o){Te(t);if(!n.addNew){jo(e.doc,i,null,null,n.extend)}if(s&&!d||l&&a==9){setTimeout(function(){r.wrapper.ownerDocument.body.focus({preventScroll:true});r.input.focus()},20)}else{r.input.focus()}}});var c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10};var u=function(){return o=true};if(s){r.scroller.draggable=true}e.state.draggingText=f;f.copy=!n.moveOnDrag;xe(r.wrapper.ownerDocument,"mouseup",f);xe(r.wrapper.ownerDocument,"mousemove",c);xe(r.scroller,"dragstart",u);xe(r.scroller,"drop",f);e.state.delayingBlurEvent=true;setTimeout(function(){return r.input.focus()},20);if(r.scroller.dragDrop){r.scroller.dragDrop()}}function Ta(e,t,i){if(i=="char"){return new fo(t,t)}if(i=="word"){return e.findWordAt(t)}if(i=="line"){return new fo(ft(t.line,0),gt(e.doc,ft(t.line+1,0)))}var n=i(e,t);return new fo(n.from,n.to)}function Oa(e,t,i,n){if(l){er(e)}var r=e.display,o=e.doc;Te(t);var a,s,f=o.sel,c=f.ranges;if(n.addNew&&!n.extend){s=o.sel.contains(i);if(s>-1){a=c[s]}else{a=new fo(i,i)}}else{a=o.sel.primary();s=o.sel.primIndex}if(n.unit=="rectangle"){if(!n.addNew){a=new fo(i,i)}i=Bn(e,t,true,true);s=-1}else{var u=Ta(e,i,n.unit);if(n.extend){a=Bo(a,u.anchor,u.head,n.extend)}else{a=u}}if(!n.addNew){s=0;Ko(o,new so([a],0),_);f=o.sel}else if(s==-1){s=c.length;Ko(o,co(e,c.concat([a]),s),{scroll:false,origin:"*mouse"})}else if(c.length>1&&c[s].empty()&&n.unit=="char"&&!n.extend){Ko(o,co(e,c.slice(0,s).concat(c.slice(s+1)),0),{scroll:false,origin:"*mouse"});f=o.sel}else{qo(o,s,a,_)}var h=i;function d(t){if(ct(h,t)==0){return}h=t;if(n.unit=="rectangle"){var r=[],l=e.options.tabSize;var c=U(tt(o,i.line).text,i.ch,l);var u=U(tt(o,t.line).text,t.ch,l);var d=Math.min(c,u),p=Math.max(c,u);for(var m=Math.min(i.line,t.line),g=Math.min(e.lastLine(),Math.max(i.line,t.line));m<=g;m++){var v=tt(o,m).text,y=J(v,d,l);if(d==p){r.push(new fo(ft(m,y),ft(m,y)))}else if(v.length>y){r.push(new fo(ft(m,y),ft(m,J(v,p,l))))}}if(!r.length){r.push(new fo(i,i))}Ko(o,co(e,f.ranges.slice(0,s).concat(r),s),{origin:"*mouse",scroll:false});e.scrollIntoView(t)}else{var x=a;var b=Ta(e,t,n.unit);var w=x.anchor,C;if(ct(b.anchor,w)>0){C=b.head;w=pt(x.from(),b.anchor)}else{C=b.anchor;w=dt(x.to(),b.head)}var S=f.ranges.slice(0);S[s]=Aa(e,new fo(gt(o,w),C));Ko(o,co(e,S,s),_)}}var p=r.wrapper.getBoundingClientRect();var m=0;function g(t){var i=++m;var l=Bn(e,t,true,n.unit=="rectangle");if(!l){return}if(ct(l,h)!=0){e.curOp.focus=D(R(e));d(l);var a=or(r,o);if(l.line>=a.to||l.linep.bottom?20:0;if(s){setTimeout(Wr(e,function(){if(m!=i){return}r.scroller.scrollTop+=s;g(t)}),50)}}}function v(t){e.state.selectingText=false;m=Infinity;if(t){Te(t);r.input.focus()}we(r.wrapper.ownerDocument,"mousemove",y);we(r.wrapper.ownerDocument,"mouseup",x);o.history.lastSelOrigin=null}var y=Wr(e,function(e){if(e.buttons===0||!Fe(e)){v(e)}else{g(e)}});var x=Wr(e,v);e.state.selectingText=x;xe(r.wrapper.ownerDocument,"mousemove",y);xe(r.wrapper.ownerDocument,"mouseup",x)}function Aa(e,t){var i=t.anchor;var n=t.head;var r=tt(e.doc,i.line);if(ct(i,n)==0&&i.sticky==n.sticky){return t}var o=ve(r);if(!o){return t}var l=me(o,i.ch,i.sticky),a=o[l];if(a.from!=i.ch&&a.to!=i.ch){return t}var s=l+(a.from==i.ch==(a.level!=1)?0:1);if(s==0||s==o.length){return t}var f;if(n.line!=i.line){f=(n.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0}else{var c=me(o,n.ch,n.sticky);var u=c-l||(n.ch-i.ch)*(a.level==1?-1:1);if(c==s-1||c==s){f=u<0}else{f=u>0}}var h=o[s+(f?-1:0)];var d=f==(h.level==1);var p=d?h.from:h.to,m=d?"after":"before";return i.ch==p&&i.sticky==m?t:new fo(new ft(i.line,p,m),n)}function Na(e,t,i,n){var r,o;if(t.touches){r=t.touches[0].clientX;o=t.touches[0].clientY}else{try{r=t.clientX;o=t.clientY}catch(e){return false}}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right)){return false}if(n){Te(t)}var l=e.display;var a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!Le(e,i)){return Ae(t)}o-=a.top-l.viewOffset;for(var s=0;s=r){var c=lt(e.doc,o);var u=e.display.gutterSpecs[s];Ce(e,i,e,c,u.className,t);return Ae(t)}}}function Pa(e,t){return Na(e,t,"gutterClick",true)}function Fa(e,t){if($i(e.display,t)||Da(e,t)){return}if(Se(e,t,"contextmenu")){return}if(!k){e.display.input.onContextMenu(t)}}function Da(e,t){if(!Le(e,"gutterContextMenu")){return false}return Na(e,t,"gutterContextMenu",false)}function Ha(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");mn(e)}var Ea={toString:function(){return"CodeMirror.Init"}};var Wa={};var Ia={};function Ra(e){var t=e.optionHandlers;function i(i,n,r,o){e.defaults[i]=n;if(r){t[i]=o?function(e,t,i){if(i!=Ea){r(e,t,i)}}:r}}e.defineOption=i;e.Init=Ea;i("value","",function(e,t){return e.setValue(t)},true);i("mode",null,function(e,t){e.doc.modeOption=t;yo(e)},true);i("indentUnit",2,yo,true);i("indentWithTabs",false);i("smartIndent",true);i("tabSize",4,function(e){xo(e);mn(e);zn(e)},true);i("lineSeparator",null,function(e,t){e.doc.lineSep=t;if(!t){return}var i=[],n=e.doc.first;e.doc.iter(function(e){for(var r=0;;){var o=e.text.indexOf(t,r);if(o==-1){break}r=o+t.length;i.push(ft(n,o))}n++});for(var r=i.length-1;r>=0;r--){sl(e.doc,t,i[r],ft(i[r].line,i[r].ch+t.length))}});i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(e,t,i){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");if(i!=Ea){e.refresh()}});i("specialCharPlaceholder",xi,function(e){return e.refresh()},true);i("electricChars",true);i("inputStyle",y?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);i("spellcheck",false,function(e,t){return e.getInputField().spellcheck=t},true);i("autocorrect",false,function(e,t){return e.getInputField().autocorrect=t},true);i("autocapitalize",false,function(e,t){return e.getInputField().autocapitalize=t},true);i("rtlMoveVisually",!w);i("wholeLineUpdateBefore",true);i("theme","default",function(e){Ha(e);to(e)},true);i("keyMap","default",function(e,t,i){var n=_l(t);var r=i!=Ea&&_l(i);if(r&&r.detach){r.detach(e,n)}if(n.attach){n.attach(e,r||null)}});i("extraKeys",null);i("configureMouse",null);i("lineWrapping",false,ja,true);i("gutters",[],function(e,t){e.display.gutterSpecs=Zr(t,e.options.lineNumbers);to(e)},true);i("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?Wn(e.display)+"px":"0";e.refresh()},true);i("coverGutterNextToScrollbar",false,function(e){return Cr(e)},true);i("scrollbarStyle","native",function(e){Lr(e);Cr(e);e.display.scrollbars.setScrollTop(e.doc.scrollTop);e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},true);i("lineNumbers",false,function(e,t){e.display.gutterSpecs=Zr(e.options.gutters,t);to(e)},true);i("firstLineNumber",1,to,true);i("lineNumberFormatter",function(e){return e},to,true);i("showCursorWhenSelecting",false,$n,true);i("resetSelectionOnContextMenu",true);i("lineWiseCopyCut",true);i("pasteLinesPerSelection",true);i("selectionsMayTouch",false);i("readOnly",false,function(e,t){if(t=="nocursor"){ir(e);e.display.input.blur()}e.display.input.readOnlyChanged(t)});i("screenReaderLabel",null,function(e,t){t=t===""?null:t;e.display.input.screenReaderLabelChanged(t)});i("disableInput",false,function(e,t){if(!t){e.display.input.reset()}},true);i("dragDrop",true,Ba);i("allowDropFileTypes",null);i("cursorBlinkRate",530);i("cursorScrollMargin",0);i("cursorHeight",1,$n,true);i("singleCursorHeightPerLine",true,$n,true);i("workTime",100);i("workDelay",100);i("flattenSpans",true,xo,true);i("addModeClass",false,xo,true);i("pollInterval",100);i("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t});i("historyEventDelay",1250);i("viewportMargin",10,function(e){return e.refresh()},true);i("maxHighlightLength",1e4,xo,true);i("moveInputWithCursor",true,function(e,t){if(!t){e.display.input.resetPosition()}});i("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""});i("autofocus",null);i("direction","ltr",function(e,t){return e.doc.setDirection(t)},true);i("phrases",null)}function Ba(e,t,i){var n=i&&i!=Ea;if(!t!=!n){var r=e.display.dragFunctions;var o=t?xe:we;o(e.display.scroller,"dragstart",r.start);o(e.display.scroller,"dragenter",r.enter);o(e.display.scroller,"dragover",r.over);o(e.display.scroller,"dragleave",r.leave);o(e.display.scroller,"drop",r.drop)}}function ja(e){if(e.options.lineWrapping){H(e.display.wrapper,"CodeMirror-wrap");e.display.sizer.style.minWidth="";e.display.sizerWidth=null}else{M(e.display.wrapper,"CodeMirror-wrap");ui(e)}Rn(e);zn(e);mn(e);setTimeout(function(){return Cr(e)},100)}function za(e,t){var i=this;if(!(this instanceof za)){return new za(e,t)}this.options=t=t?q(t):{};q(Wa,t,false);var n=t.value;if(typeof n=="string"){n=new Tl(n,t.mode,null,t.lineSeparator,t.direction)}else if(t.mode){n.modeOption=t.mode}this.doc=n;var r=new za.inputStyles[t.inputStyle](this);var o=this.display=new io(e,n,r,t);o.wrapper.CodeMirror=this;Ha(this);if(t.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}Lr(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:-1,cutIncoming:-1,selectingText:false,draggingText:false,highlight:new G,keySeq:null,specialChars:null};if(t.autofocus&&!y){o.input.focus()}if(l&&a<11){setTimeout(function(){return i.display.input.reset(true)},20)}qa(this);El();Tr(this);this.curOp.forceUpdate=true;So(this,n);if(t.autofocus&&!y||this.hasFocus()){setTimeout(function(){if(i.hasFocus()&&!i.state.focused){tr(i)}},20)}else{ir(this)}for(var f in Ia){if(Ia.hasOwnProperty(f)){Ia[f](this,t[f],Ea)}}Qr(this);if(t.finishInit){t.finishInit(this)}for(var c=0;c20*20}xe(t.scroller,"touchstart",function(r){if(!Se(e,r)&&!o(r)&&!Pa(e,r)){t.input.ensurePolled();clearTimeout(i);var l=+new Date;t.activeTouch={start:l,moved:false,prev:l-n.end<=300?n:null};if(r.touches.length==1){t.activeTouch.left=r.touches[0].pageX;t.activeTouch.top=r.touches[0].pageY}}});xe(t.scroller,"touchmove",function(){if(t.activeTouch){t.activeTouch.moved=true}});xe(t.scroller,"touchend",function(i){var n=t.activeTouch;if(n&&!$i(t,i)&&n.left!=null&&!n.moved&&new Date-n.start<300){var o=e.coordsChar(t.activeTouch,"page"),l;if(!n.prev||s(n,n.prev)){l=new fo(o,o)}else if(!n.prev.prev||s(n,n.prev.prev)){l=e.findWordAt(o)}else{l=new fo(ft(o.line,0),gt(e.doc,ft(o.line+1,0)))}e.setSelection(l.anchor,l.head);e.focus();Te(i)}r()});xe(t.scroller,"touchcancel",r);xe(t.scroller,"scroll",function(){if(t.scroller.clientHeight){gr(e,t.scroller.scrollTop);yr(e,t.scroller.scrollLeft,true);Ce(e,"scroll",e)}});xe(t.scroller,"mousewheel",function(t){return ao(e,t)});xe(t.scroller,"DOMMouseScroll",function(t){return ao(e,t)});xe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0});t.dragFunctions={enter:function(t){if(!Se(e,t)){Ne(t)}},over:function(t){if(!Se(e,t)){Pl(e,t);Ne(t)}},start:function(t){return Nl(e,t)},drop:Wr(e,Al),leave:function(t){if(!Se(e,t)){Fl(e)}}};var f=t.input.getField();xe(f,"keyup",function(t){return ma.call(e,t)});xe(f,"keydown",Wr(e,da));xe(f,"keypress",Wr(e,ga));xe(f,"focus",function(t){return tr(e,t)});xe(f,"blur",function(t){return ir(e,t)})}var Ua=[];za.defineInitHook=function(e){return Ua.push(e)};function Ga(e,t,i,n){var r=e.doc,o;if(i==null){i="add"}if(i=="smart"){if(!r.mode.indent){i="prev"}else{o=St(e,t).state}}var l=e.options.tabSize;var a=tt(r,t),s=U(a.text,null,l);if(a.stateAfter){a.stateAfter=null}var f=a.text.match(/^\s*/)[0],c;if(!n&&!/\S/.test(a.text)){c=0;i="not"}else if(i=="smart"){c=r.mode.indent(o,a.text.slice(f.length),a.text);if(c==$||c>150){if(!n){return}i="prev"}}if(i=="prev"){if(t>r.first){c=U(tt(r,t-1).text,null,l)}else{c=0}}else if(i=="add"){c=s+e.options.indentUnit}else if(i=="subtract"){c=s-e.options.indentUnit}else if(typeof i=="number"){c=s+i}c=Math.max(0,c);var u="",h=0;if(e.options.indentWithTabs){for(var d=Math.floor(c/l);d;--d){h+=l;u+="\t"}}if(hl;var s=Re(t),f=null;if(a&&n.ranges.length>1){if(Va&&Va.text.join("\n")==t){if(n.ranges.length%Va.text.length==0){f=[];for(var c=0;c=0;h--){var d=n.ranges[h];var p=d.from(),m=d.to();if(d.empty()){if(i&&i>0){p=ft(p.line,p.ch-i)}else if(e.state.overwrite&&!a){m=ft(m.line,Math.min(tt(o,m.line).text.length,m.ch+ee(s).length))}else if(a&&Va&&Va.lineWise&&Va.text.join("\n")==s.join("\n")){p=m=ft(p.line,0)}}var g={from:p,to:m,text:f?f[h%f.length]:s,origin:r||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};il(e.doc,g);Fi(e,"inputRead",e,g)}if(t&&!a){_a(e,t)}ur(e);if(e.curOp.updateInput<2){e.curOp.updateInput=u}e.curOp.typing=true;e.state.pasteIncoming=e.state.cutIncoming=-1}function Xa(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i){e.preventDefault();if(!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()){Er(t,function(){return $a(t,i,0,null,"paste")})}return true}}function _a(e,t){if(!e.options.electricChars||!e.options.smartIndent){return}var i=e.doc.sel;for(var n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line){continue}var o=e.getModeAt(r.head);var l=false;if(o.electricChars){for(var a=0;a-1){l=Ga(e,r.head.line,"smart");break}}}else if(o.electricInput){if(o.electricInput.test(tt(e.doc,r.head.line).text.slice(0,r.head.ch))){l=Ga(e,r.head.line,"smart")}}if(l){Fi(e,"electricInput",e,r.head.line)}}}function Ya(e){var t=[],i=[];for(var n=0;n0){qo(this.doc,n,new fo(o,f[n].to()),X)}}else if(r.head.line>i){Ga(this,r.head.line,e,true);i=r.head.line;if(n==this.doc.sel.primIndex){ur(this)}}}}),getTokenAt:function(e,t){return Ot(this,e,t)},getLineTokens:function(e,t){return Ot(this,ft(e),t,true)},getTokenTypeAt:function(e){e=gt(this.doc,e);var t=Ct(this,tt(this.doc,e.line));var i=0,n=(t.length-1)/2,r=e.ch;var o;if(r==0){o=t[2]}else{for(;;){var l=i+n>>1;if((l?t[l*2-1]:0)>=r){n=l}else if(t[l*2+1]o){e=o;n=true}r=tt(this.doc,e)}else{r=e}return xn(this,r,{top:0,left:0},t||"page",i||n).top+(n?this.doc.height-fi(r):0)},defaultTextHeight:function(){return Dn(this.display)},defaultCharWidth:function(){return Hn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,n,r){var o=this.display;e=Cn(this,gt(this.doc,e));var l=e.bottom,a=e.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);o.sizer.appendChild(t);if(n=="over"){l=e.top}else if(n=="above"||n=="near"){var s=Math.max(o.wrapper.clientHeight,this.doc.height),f=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);if((n=="above"||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight){l=e.top-t.offsetHeight}else if(e.bottom+t.offsetHeight<=s){l=e.bottom}if(a+t.offsetWidth>f){a=f-t.offsetWidth}}t.style.top=l+"px";t.style.left=t.style.right="";if(r=="right"){a=o.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{if(r=="left"){a=0}else if(r=="middle"){a=(o.sizer.clientWidth-t.offsetWidth)/2}t.style.left=a+"px"}if(i){sr(this,{left:a,top:l,right:a+t.offsetWidth,bottom:l+t.offsetHeight})}},triggerOnKeyDown:Ir(da),triggerOnKeyPress:Ir(ga),triggerOnKeyUp:ma,triggerOnMouseDown:Ir(Ca),execCommand:function(e){if(ta.hasOwnProperty(e)){return ta[e].call(null,this)}},triggerElectric:Ir(function(e){_a(this,e)}),findPosH:function(e,t,i,n){var r=1;if(t<0){r=-1;t=-t}var o=gt(this.doc,e);for(var l=0;l0&&a(i.charAt(n-1))){--n}while(r.5||this.options.lineWrapping){Rn(this)}Ce(this,"refresh",this)}),swapDoc:Ir(function(e){var t=this.doc;t.cm=null;if(this.state.selectingText){this.state.selectingText()}So(this,e);mn(this);this.display.input.reset();hr(this,e.scrollLeft,e.scrollTop);this.curOp.forceScroll=true;Fi(this,"swapDoc",this,t);return 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}};Me(e);e.registerHelper=function(t,n,r){if(!i.hasOwnProperty(t)){i[t]=e[t]={_global:[]}}i[t][n]=r};e.registerGlobalHelper=function(t,n,r,o){e.registerHelper(t,n,o);i[t]._global.push({pred:r,val:o})}}function es(e,t,i,n,r){var o=t;var l=i;var a=tt(e,t.line);var s=r&&e.direction=="rtl"?-i:i;function f(){var i=t.line+s;if(i=e.first+e.size){return false}t=new ft(i,t.ch,t.sticky);return a=tt(e,i)}function c(o){var l;if(n=="codepoint"){var c=a.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(c)){l=null}else{var u=i>0?c>=55296&&c<56320:c>=56320&&c<57343;l=new ft(t.line,Math.max(0,Math.min(a.text.length,t.ch+i*(u?2:1))),-i)}}else if(r){l=ea(e.cm,a,t,i)}else{l=Ql(a,t,i)}if(l==null){if(!o&&f()){t=Zl(r,e.cm,a,t.line,s)}else{return false}}else{t=l}return true}if(n=="char"||n=="codepoint"){c()}else if(n=="column"){c(true)}else if(n=="word"||n=="group"){var u=null,h=n=="group";var d=e.cm&&e.cm.getHelper(t,"wordChars");for(var p=true;;p=false){if(i<0&&!c(!p)){break}var m=a.text.charAt(t.ch)||"\n";var g=ae(m,d)?"w":h&&m=="\n"?"n":!h||/\s/.test(m)?null:"p";if(h&&!p&&!g){g="s"}if(u&&u!=g){if(i<0){i=1;c();t.sticky="after"}break}if(g){u=g}if(i>0&&!c(!p)){break}}}var v=Qo(e,t,o,l,true);if(ut(o,v)){v.hitSide=true}return v}function ts(e,t,i,n){var r=e.doc,o=t.left,l;if(n=="page"){var a=Math.min(e.display.wrapper.clientHeight,j(e).innerHeight||r(e).documentElement.clientHeight);var s=Math.max(a-.5*Dn(e.display),3);l=(i>0?t.bottom:t.top)+i*s}else if(n=="line"){l=i>0?t.bottom+3:t.top-3}var f;for(;;){f=Ln(e,o,l);if(!f.outside){break}if(i<0?l<=0:l>=r.height){f.hitSide=true;break}l+=i*5}return f}var is=function(e){this.cm=e;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new G;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};is.prototype.init=function(e){var t=this;var i=this,n=i.cm;var r=i.div=e.lineDiv;r.contentEditable=true;Ja(r,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function o(e){for(var t=e.target;t;t=t.parentNode){if(t==r){return true}if(/\bCodeMirror-(?:line)?widget\b/.test(t.className)){break}}return false}xe(r,"paste",function(e){if(!o(e)||Se(n,e)||Xa(e,n)){return}if(a<=11){setTimeout(Wr(n,function(){return t.updateFromDOM()}),20)}});xe(r,"compositionstart",function(e){t.composing={data:e.data,done:false}});xe(r,"compositionupdate",function(e){if(!t.composing){t.composing={data:e.data,done:false}}});xe(r,"compositionend",function(e){if(t.composing){if(e.data!=t.composing.data){t.readFromDOMSoon()}t.composing.done=true}});xe(r,"touchstart",function(){return i.forceCompositionEnd()});xe(r,"input",function(){if(!t.composing){t.readFromDOMSoon()}});function l(e){if(!o(e)||Se(n,e)){return}if(n.somethingSelected()){Ka({lineWise:false,text:n.getSelections()});if(e.type=="cut"){n.replaceSelection("",null,"cut")}}else if(!n.options.lineWiseCopyCut){return}else{var t=Ya(n);Ka({lineWise:true,text:t.text});if(e.type=="cut"){n.operation(function(){n.setSelections(t.ranges,0,X);n.replaceSelection("",null,"cut")})}}if(e.clipboardData){e.clipboardData.clearData();var l=Va.text.join("\n");e.clipboardData.setData("Text",l);if(e.clipboardData.getData("Text")==l){e.preventDefault();return}}var a=Qa(),s=a.firstChild;Ja(s);n.display.lineSpace.insertBefore(a,n.display.lineSpace.firstChild);s.value=Va.text.join("\n");var f=D(B(r));W(s);setTimeout(function(){n.display.lineSpace.removeChild(a);f.focus();if(f==r){i.showPrimarySelection()}},50)}xe(r,"copy",l);xe(r,"cut",l)};is.prototype.screenReaderLabelChanged=function(e){if(e){this.div.setAttribute("aria-label",e)}else{this.div.removeAttribute("aria-label")}};is.prototype.prepareSelection=function(){var e=Xn(this.cm,false);e.focus=D(B(this.div))==this.div;return e};is.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length){return}if(e.focus||t){this.showPrimarySelection()}this.showMultipleSelections(e)};is.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};is.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary();var r=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||o.line=t.display.viewFrom&&ns(t,r)||{node:s[0].measure.map[2],offset:0};var c=o.linee.firstLine()){n=ft(n.line-1,tt(e.doc,n.line-1).length)}if(r.ch==tt(e.doc,r.line).text.length&&r.linet.viewTo-1){return false}var o,l,a;if(n.line==t.viewFrom||(o=jn(e,n.line))==0){l=ot(t.view[0].line);a=t.view[0].node}else{l=ot(t.view[o].line);a=t.view[o-1].node.nextSibling}var s=jn(e,r.line);var f,c;if(s==t.view.length-1){f=t.viewTo-1;c=t.lineDiv.lastChild}else{f=ot(t.view[s+1].line)-1;c=t.view[s+1].node.previousSibling}if(!a){return false}var u=e.doc.splitLines(ls(e,a,c,l,f));var h=it(e.doc,ft(l,0),ft(f,tt(e.doc,f).text.length));while(u.length>1&&h.length>1){if(ee(u)==ee(h)){u.pop();h.pop();f--}else if(u[0]==h[0]){u.shift();h.shift();l++}else{break}}var d=0,p=0;var m=u[0],g=h[0],v=Math.min(m.length,g.length);while(dn.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1)){d--;p++}}u[u.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,"");u[0]=u[0].slice(d).replace(/\u200b+$/,"");var w=ft(l,d);var C=ft(f,h.length?ee(h).length-p:0);if(u.length>1||u[0]||ct(w,C)){sl(e.doc,u,w,C,"+input");return true}};is.prototype.ensurePolled=function(){this.forceCompositionEnd()};is.prototype.reset=function(){this.forceCompositionEnd()};is.prototype.forceCompositionEnd=function(){if(!this.composing){return}clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()};is.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null){return}this.readDOMTimeout=setTimeout(function(){e.readDOMTimeout=null;if(e.composing){if(e.composing.done){e.composing=null}else{return}}e.updateFromDOM()},80)};is.prototype.updateFromDOM=function(){var e=this;if(this.cm.isReadOnly()||!this.pollContent()){Er(this.cm,function(){return zn(e.cm)})}};is.prototype.setUneditable=function(e){e.contentEditable="false"};is.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing){return}e.preventDefault();if(!this.cm.isReadOnly()){Wr(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)}};is.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")};is.prototype.onContextMenu=function(){};is.prototype.resetPosition=function(){};is.prototype.needsContentAttribute=true;function ns(e,t){var i=on(e,t.line);if(!i||i.hidden){return null}var n=tt(e.doc,t.line);var r=tn(i,n,t.line);var o=ve(n,e.doc.direction),l="left";if(o){var a=me(o,t.ch);l=a%2?"right":"left"}var s=fn(r.map,t.ch,l);s.offset=s.collapse=="right"?s.end:s.start;return s}function rs(e){for(var t=e;t;t=t.parentNode){if(/CodeMirror-gutter-wrapper/.test(t.className)){return true}}return false}function os(e,t){if(t){e.bad=true}return e}function ls(e,t,i,n,r){var o="",l=false,a=e.doc.lineSeparator(),s=false;function f(e){return function(t){return t.id==e}}function c(){if(l){o+=a;if(s){o+=a}l=s=false}}function u(e){if(e){c();o+=e}}function h(t){if(t.nodeType==1){var i=t.getAttribute("cm-text");if(i){u(i);return}var o=t.getAttribute("cm-marker"),d;if(o){var p=e.findMarks(ft(n,0),ft(r+1,0),f(+o));if(p.length&&(d=p[0].find(0))){u(it(e.doc,d.from,d.to).join(a))}return}if(t.getAttribute("contenteditable")=="false"){return}var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&t.textContent.length==0){return}if(m){c()}for(var g=0;g=9&&t.hasSelection){t.hasSelection=null}i.poll()});xe(r,"paste",function(e){if(Se(n,e)||Xa(e,n)){return}n.state.pasteIncoming=+new Date;i.fastPoll()});function o(e){if(Se(n,e)){return}if(n.somethingSelected()){Ka({lineWise:false,text:n.getSelections()})}else if(!n.options.lineWiseCopyCut){return}else{var t=Ya(n);Ka({lineWise:true,text:t.text});if(e.type=="cut"){n.setSelections(t.ranges,null,X)}else{i.prevInput="";r.value=t.text.join("\n");W(r)}}if(e.type=="cut"){n.state.cutIncoming=+new Date}}xe(r,"cut",o);xe(r,"copy",o);xe(e.scroller,"paste",function(t){if($i(e,t)||Se(n,t)){return}if(!r.dispatchEvent){n.state.pasteIncoming=+new Date;i.focus();return}var o=new Event("paste");o.clipboardData=t.clipboardData;r.dispatchEvent(o)});xe(e.lineSpace,"selectstart",function(t){if(!$i(e,t)){Te(t)}});xe(r,"compositionstart",function(){var e=n.getCursor("from");if(i.composing){i.composing.range.clear()}i.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}});xe(r,"compositionend",function(){if(i.composing){i.poll();i.composing.range.clear();i.composing=null}})};fs.prototype.createField=function(e){this.wrapper=Qa();this.textarea=this.wrapper.firstChild;var t=this.cm.options;Ja(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)};fs.prototype.screenReaderLabelChanged=function(e){if(e){this.textarea.setAttribute("aria-label",e)}else{this.textarea.removeAttribute("aria-label")}};fs.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc;var n=Xn(e);if(e.options.moveInputWithCursor){var r=Cn(e,i.sel.primary().head,"div");var o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+l.top-o.top));n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+l.left-o.left))}return n};fs.prototype.showSelection=function(e){var t=this.cm,i=t.display;O(i.cursorDiv,e.cursors);O(i.selectionDiv,e.selection);if(e.teTop!=null){this.wrapper.style.top=e.teTop+"px";this.wrapper.style.left=e.teLeft+"px"}};fs.prototype.reset=function(e){if(this.contextMenuPending||this.composing&&e){return}var t=this.cm;this.resetting=true;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i;if(t.state.focused){W(this.textarea)}if(l&&a>=9){this.hasSelection=i}}else if(!e){this.prevInput=this.textarea.value="";if(l&&a>=9){this.hasSelection=null}}this.resetting=false};fs.prototype.getField=function(){return this.textarea};fs.prototype.supportsTouch=function(){return false};fs.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!y||D(B(this.textarea))!=this.textarea)){try{this.textarea.focus()}catch(e){}}};fs.prototype.blur=function(){this.textarea.blur()};fs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};fs.prototype.receivedFocus=function(){this.slowPoll()};fs.prototype.slowPoll=function(){var e=this;if(this.pollingFast){return}this.polling.set(this.cm.options.pollInterval,function(){e.poll();if(e.cm.state.focused){e.slowPoll()}})};fs.prototype.fastPoll=function(){var e=false,t=this;t.pollingFast=true;function i(){var n=t.poll();if(!n&&!e){e=true;t.polling.set(60,i)}else{t.pollingFast=false;t.slowPoll()}}t.polling.set(20,i)};fs.prototype.poll=function(){var e=this;var t=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Be(i)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq){return false}var r=i.value;if(r==n&&!t.somethingSelected()){return false}if(l&&a>=9&&this.hasSelection===r||x&&/[\uf700-\uf7ff]/.test(r)){t.display.input.reset();return false}if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(o==8203&&!n){n="​"}if(o==8666){this.reset();return this.cm.execCommand("undo")}}var s=0,f=Math.min(n.length,r.length);while(s1e3||r.indexOf("\n")>-1){i.value=e.prevInput=""}else{e.prevInput=r}if(e.composing){e.composing.range.clear();e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"})}});return true};fs.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}};fs.prototype.onKeyPress=function(){if(l&&a>=9){this.hasSelection=null}this.fastPoll()};fs.prototype.onContextMenu=function(e){var t=this,i=t.cm,n=i.display,r=t.textarea;if(t.contextMenuPending){t.contextMenuPending()}var o=Bn(i,e),f=n.scroller.scrollTop;if(!o||h){return}var c=i.options.resetSelectionOnContextMenu;if(c&&i.doc.sel.contains(o)==-1){Wr(i,Ko)(i.doc,uo(o),X)}var u=r.style.cssText,d=t.wrapper.style.cssText;var p=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static";r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var m;if(s){m=r.ownerDocument.defaultView.scrollY}n.input.focus();if(s){r.ownerDocument.defaultView.scrollTo(null,m)}n.input.reset();if(!i.somethingSelected()){r.value=t.prevInput=" "}t.contextMenuPending=v;n.selForContextMenu=i.doc.sel;clearTimeout(n.detectingSelectAll);function g(){if(r.selectionStart!=null){var e=i.somethingSelected();var o="​"+(e?r.value:"");r.value="⇚";r.value=o;t.prevInput=e?"":"​";r.selectionStart=1;r.selectionEnd=o.length;n.selForContextMenu=i.doc.sel}}function v(){if(t.contextMenuPending!=v){return}t.contextMenuPending=false;t.wrapper.style.cssText=d;r.style.cssText=u;if(l&&a<9){n.scrollbars.setScrollTop(n.scroller.scrollTop=f)}if(r.selectionStart!=null){if(!l||l&&a<9){g()}var e=0,o=function(){if(n.selForContextMenu==i.doc.sel&&r.selectionStart==0&&r.selectionEnd>0&&t.prevInput=="​"){Wr(i,el)(i)}else if(e++<10){n.detectingSelectAll=setTimeout(o,500)}else{n.selForContextMenu=null;n.input.reset()}};n.detectingSelectAll=setTimeout(o,200)}}if(l&&a>=9){g()}if(k){Ne(e);var y=function(){we(window,"mouseup",y);setTimeout(v,20)};xe(window,"mouseup",y)}else{setTimeout(v,50)}};fs.prototype.readOnlyChanged=function(e){if(!e){this.reset()}this.textarea.disabled=e=="nocursor";this.textarea.readOnly=!!e};fs.prototype.setUneditable=function(){};fs.prototype.needsContentAttribute=false;function cs(e,t){t=t?q(t):{};t.value=e.value;if(!t.tabindex&&e.tabIndex){t.tabindex=e.tabIndex}if(!t.placeholder&&e.placeholder){t.placeholder=e.placeholder}if(t.autofocus==null){var i=D(B(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function n(){e.value=a.getValue()}var r;if(e.form){xe(e.form,"submit",n);if(!t.leaveSubmitMethodAlone){var o=e.form;r=o.submit;try{var l=o.submit=function(){n();o.submit=r;o.submit();o.submit=l}}catch(e){}}}t.finishInit=function(i){i.save=n;i.getTextArea=function(){return e};i.toTextArea=function(){i.toTextArea=isNaN;n();e.parentNode.removeChild(i.getWrapperElement());e.style.display="";if(e.form){we(e.form,"submit",n);if(!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"){e.form.submit=r}}}};e.style.display="none";var a=za(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return a}function us(e){e.off=we;e.on=xe;e.wheelEventPixels=lo;e.Doc=Tl;e.splitLines=Re;e.countColumn=U;e.findColumn=J;e.isWordChar=le;e.Pass=$;e.signal=Ce;e.Line=hi;e.changeEnd=ho;e.scrollbarModel=kr;e.Pos=ft;e.cmpPos=ct;e.modes=Ue;e.mimeModes=Ge;e.resolveMode=$e;e.getMode=Xe;e.modeExtensions=_e;e.extendMode=Ye;e.copyState=Je;e.startState=Ze;e.innerMode=Qe;e.commands=ta;e.keyMap=ql;e.keyName=Xl;e.isModifierKey=Kl;e.lookupKey=Vl;e.normalizeKeyMap=Gl;e.StringStream=et;e.SharedTextMarker=wl;e.TextMarker=xl;e.LineWidget=ml;e.e_preventDefault=Te;e.e_stopPropagation=Oe;e.e_stop=Ne;e.addClass=H;e.contains=F;e.rmClass=M;e.keyNames=Rl}Ra(za);Za(za);var hs="iter insert remove copy getEditor constructor".split(" ");for(var ds in Tl.prototype){if(Tl.prototype.hasOwnProperty(ds)&&V(hs,ds)<0){za.prototype[ds]=function(e){return function(){return e.apply(this.doc,arguments)}}(Tl.prototype[ds])}}Me(Tl);za.inputStyles={textarea:fs,contenteditable:is};za.defineMode=function(e){if(!za.defaults.mode&&e!="null"){za.defaults.mode=e}Ve.apply(this,arguments)};za.defineMIME=Ke;za.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}});za.defineMIME("text/plain","null");za.defineExtension=function(e,t){za.prototype[e]=t};za.defineDocExtension=function(e,t){Tl.prototype[e]=t};za.fromTextArea=cs;us(za);za.version="5.65.18";return za});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],e);else e(CodeMirror)})(function(e){"use strict";e.defineMode("rpm-changes",function(){var e=/^-+$/;var t=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;var i=/^[\w+.-]+@[\w.-]+/;return{token:function(n){if(n.sol()){if(n.match(e)){return"tag"}if(n.match(t)){return"tag"}}if(n.match(i)){return"string"}n.next();return null}}});e.defineMIME("text/x-rpm-changes","rpm-changes");e.defineMode("rpm-spec",function(){var e=/^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;var t=/^[a-zA-Z0-9()]+:/;var i=/^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/;var n=/^%(ifnarch|ifarch|if)/;var r=/^%(else|endif)/;var o=/^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/;return{startState:function(){return{controlFlow:false,macroParameters:false,section:false}},token:function(l,a){if(l.string.trim().startsWith("#"))return l.skipToEnd(),"comment";if(l.string.trim().match(//))return l.skipToEnd(),"header";if(l.string.trim().match(/|||/))return l.skipToEnd(),"keyword";if(l.string.trim().match(/|/))return l.skipToEnd(),"def";var s=l.peek();if(s=="#"){l.skipToEnd();return"comment"}if(l.sol()){if(l.match(t)){return"header"}if(l.match(i)){return"atom"}}if(l.match(/^\$\w+/)){return"def"}if(l.match(/^\$\{\w+\}/)){return"def"}if(l.match(r)){return"keyword"}if(l.match(n)){a.controlFlow=true;return"keyword"}if(a.controlFlow){if(l.match(o)){return"operator"}if(l.match(/^(\d+)/)){return"number"}if(l.eol()){a.controlFlow=false}}if(l.match(e)){if(l.eol()){a.controlFlow=false}return"number"}if(l.match(/^%[\w]+/)){if(l.match("(")){a.macroParameters=true}return"keyword"}if(a.macroParameters){if(l.match(/^\d+/)){return"number"}if(l.match(")")){a.macroParameters=false;return"keyword"}}if(l.match(/^%\{\??[\w \-\:\!]+\}/)){if(l.eol()){a.controlFlow=false}return"def"}l.next();return null}}});e.defineMIME("text/x-rpm-spec","rpm-spec")});(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){function t(t,i,n){t=t.getWrapperElement();var r=t.appendChild(document.createElement("div"));r.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top";"string"==typeof i?r.innerHTML=i:r.appendChild(i);e.addClass(t,"dialog-opened");return r}function i(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose();e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(n,r,o){function l(t){if("string"==typeof t)c.value=t;else if(!s&&(s=!0,e.rmClass(a.parentNode,"dialog-opened"),a.parentNode.removeChild(a),f.focus(),o.onClose))o.onClose(a)}o||(o={});i(this,null);var a=t(this,n,o.bottom),s=!1,f=this,c=a.getElementsByTagName("input")[0];if(c){c.focus();o.value&&(c.value=o.value,!1!==o.selectValueOnOpen&&c.select());if(o.onInput)e.on(c,"input",function(e){o.onInput(e,c.value,l)});if(o.onKeyUp)e.on(c,"keyup",function(e){o.onKeyUp(e,c.value,l)});e.on(c,"keydown",function(t){if(!(o&&o.onKeyDown&&o.onKeyDown(t,c.value,l))){if(27==t.keyCode||!1!==o.closeOnEnter&&13==t.keyCode)c.blur(),e.e_stop(t),l();13==t.keyCode&&r(c.value,t)}});if(!1!==o.closeOnBlur)e.on(a,"focusout",function(e){null!==e.relatedTarget&&l()})}else if(n=a.getElementsByTagName("button")[0]){e.on(n,"click",function(){l();f.focus()});if(!1!==o.closeOnBlur)e.on(n,"blur",l);n.focus()}return l});e.defineExtension("openConfirm",function(n,r,o){function l(){s||(s=!0,e.rmClass(a.parentNode,"dialog-opened"),a.parentNode.removeChild(a),f.focus())}i(this,null);var a=t(this,n,o&&o.bottom);n=a.getElementsByTagName("button");var s=!1,f=this,c=1;n[0].focus();for(o=0;o=c&&l()},200)});e.on(u,"focus",function(){++c})}});e.defineExtension("openNotification",function(n,r){function o(){a||(a=!0,clearTimeout(s),e.rmClass(l.parentNode,"dialog-opened"),l.parentNode.removeChild(l))}i(this,o);var l=t(this,n,r&&r.bottom),a=!1,s,f=r&&"undefined"!==typeof r.duration?r.duration:5e3;e.on(l,"click",function(t){e.e_preventDefault(t);o()});f&&(s=setTimeout(o,f));return o})});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e);else e(CodeMirror)})(function(e){"use strict";e.defineOption("search",{bottom:false});function t(e,t){if(typeof e=="string")e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g");else if(!e.global)e=new RegExp(e.source,e.ignoreCase?"gi":"g");return{token:function(t){e.lastIndex=t.pos;var i=e.exec(t.string);if(i&&i.index==t.pos){t.pos+=i[0].length||1;return"searching"}else if(i){t.pos=i.index}else{t.skipToEnd()}}}}function i(){this.posFrom=this.posTo=this.lastQuery=this.query=null;this.overlay=null}function n(e){return e.state.search||(e.state.search=new i)}function r(e){return typeof e=="string"&&e==e.toLowerCase()}function o(e,t,i){return e.getSearchCursor(t,i,{caseFold:r(t),multiline:true})}function l(e,t,i,n,r){e.openDialog(t,n,{value:i,selectValueOnOpen:true,closeOnEnter:false,onClose:function(){p(e)},onKeyDown:r,bottom:e.options.search.bottom})}function a(e,t,i,n,r){if(e.openDialog)e.openDialog(t,r,{value:n,selectValueOnOpen:true,bottom:e.options.search.bottom});else r(prompt(i,n))}function s(e,t,i,n){if(e.openConfirm)e.openConfirm(t,n);else if(confirm(i))n[0]()}function f(e){return e.replace(/\\([nrt\\])/g,function(e,t){if(t=="n")return"\n";if(t=="r")return"\r";if(t=="t")return"\t";if(t=="\\")return"\\";return e})}function c(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t){try{e=new RegExp(t[1],t[2].indexOf("i")==-1?"":"i")}catch(e){}}else{e=f(e)}if(typeof e=="string"?e=="":e.test(""))e=/x^/;return e}function u(e,i,n){i.queryText=n;i.query=c(n);e.removeOverlay(i.overlay,r(i.query));i.overlay=t(i.query,r(i.query));e.addOverlay(i.overlay);if(e.showMatchesOnScrollbar){if(i.annotate){i.annotate.clear();i.annotate=null}i.annotate=e.showMatchesOnScrollbar(i.query,r(i.query))}}function h(t,i,r,o){var s=n(t);if(s.query)return d(t,i);var f=t.getSelection()||s.lastQuery;if(f instanceof RegExp&&f.source=="x^")f=null;if(r&&t.openDialog){var c=null;var h=function(i,n){e.e_stop(n);if(!i)return;if(i!=s.queryText){u(t,s,i);s.posFrom=s.posTo=t.getCursor()}if(c)c.style.opacity=1;d(t,n.shiftKey,function(e,i){var n;if(i.line<3&&document.querySelector&&(n=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>t.cursorCoords(i,"window").top)(c=n).style.opacity=.4})};l(t,g(t),f,h,function(i,r){var o=e.keyName(i);var l=t.getOption("extraKeys"),a=l&&l[o]||e.keyMap[t.getOption("keyMap")][o];if(a=="findNext"||a=="findPrev"||a=="findPersistentNext"||a=="findPersistentPrev"){e.e_stop(i);u(t,n(t),r);t.execCommand(a)}else if(a=="find"||a=="findPersistent"){e.e_stop(i);h(r,i)}});if(o&&f){u(t,s,f);d(t,i)}}else{a(t,g(t),"Search for:",f,function(e){if(e&&!s.query)t.operation(function(){u(t,s,e);s.posFrom=s.posTo=t.getCursor();d(t,i)})})}}function d(t,i,r){t.operation(function(){var l=n(t);var a=o(t,l.query,i?l.posFrom:l.posTo);if(!a.find(i)){a=o(t,l.query,i?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0));if(!a.find(i))return}t.setSelection(a.from(),a.to());t.scrollIntoView({from:a.from(),to:a.to()},20);l.posFrom=a.from();l.posTo=a.to();if(r)r(a.from(),a.to())})}function p(e){e.operation(function(){var t=n(e);t.lastQuery=t.query;if(!t.query)return;t.query=t.queryText=null;e.removeOverlay(t.overlay);if(t.annotate){t.annotate.clear();t.annotate=null}})}function m(e,t){var i=e?document.createElement(e):document.createDocumentFragment();for(var n in t){i[n]=t[n]}for(var r=2;rc)break;var h=e.getLine(f++);a=a==null?h:a+"\n"+h}s=s*2;i.lastIndex=l.ch;var d=i.exec(a);if(d){var p=a.slice(0,d.index).split("\n"),m=d[0].split("\n");var g=l.line+p.length-1,v=p[p.length-1].length;return{from:t(g,v),to:t(g+m.length-1,m.length==1?v+m[0].length:m[m.length-1].length),match:d}}}}function a(e,t,i){var n,r=0;while(r<=e.length){t.lastIndex=r;var o=t.exec(e);if(!o)break;var l=o.index+o[0].length;if(l>e.length-i)break;if(!n||l>n.index+n[0].length)n=o;r=o.index+1}return n}function s(e,i,r){i=n(i,"g");for(var o=r.line,l=r.ch,s=e.firstLine();o>=s;o--,l=-1){var f=e.getLine(o);var c=a(f,i,l<0?0:f.length-l);if(c)return{from:t(o,c.index),to:t(o,c.index+c[0].length),match:c}}}function f(e,i,o){if(!r(i))return s(e,i,o);i=n(i,"gm");var l,f=1,c=e.getLine(o.line).length-o.ch;for(var u=o.line,h=e.firstLine();u>=h;){for(var d=0;d=h;d++){var p=e.getLine(u--);l=l==null?p:p+"\n"+l}f*=2;var m=a(l,i,c);if(m){var g=l.slice(0,m.index).split("\n"),v=m[0].split("\n");var y=u+g.length,x=g[g.length-1].length;return{from:t(y,x),to:t(y+v.length-1,v.length==1?x+v[0].length:v[v.length-1].length),match:m}}}}var c,u;if(String.prototype.normalize){c=function(e){return e.normalize("NFD").toLowerCase()};u=function(e){return e.normalize("NFD")}}else{c=function(e){return e.toLowerCase()};u=function(e){return e}}function h(e,t,i,n){if(e.length==t.length)return i;for(var r=0,o=i+Math.max(0,e.length-t.length);;){if(r==o)return r;var l=r+o>>1;var a=n(e.slice(0,l)).length;if(a==i)return l;else if(a>i)o=l;else r=l+1}}function d(e,i,n,r){if(!i.length)return null;var o=r?c:u;var l=o(i).split(/\r|\n\r?/);e:for(var a=n.line,s=n.ch,f=e.lastLine()+1-l.length;a<=f;a++,s=0){var d=e.getLine(a).slice(s),p=o(d);if(l.length==1){var m=p.indexOf(l[0]);if(m==-1)continue e;var n=h(d,p,m,o)+s;return{from:t(a,h(d,p,m,o)+s),to:t(a,h(d,p,m+l[0].length,o)+s)}}else{var g=p.length-l[0].length;if(p.slice(g)!=l[0])continue e;for(var v=1;v=f;a--,s=-1){var d=e.getLine(a);if(s>-1)d=d.slice(0,s);var p=o(d);if(l.length==1){var m=p.lastIndexOf(l[0]);if(m==-1)continue e;return{from:t(a,h(d,p,m,o)),to:t(a,h(d,p,m+l[0].length,o))}}else{var g=l[l.length-1];if(p.slice(0,g.length)!=g)continue e;for(var v=1,n=a-l.length+1;v(this.doc.getLine(n.line)||"").length){n.ch=0;n.line++}}if(e.cmpPos(n,this.doc.clipPos(n))!=0){return this.atOccurrence=false}}var r=this.matches(i,n);this.afterEmptyMatch=r&&e.cmpPos(r.from,r.to)==0;if(r){this.pos=r;this.atOccurrence=true;return this.pos.match||true}else{var o=t(i?this.doc.firstLine():this.doc.lastLine()+1,0);this.pos={from:o,to:o};return this.atOccurrence=false}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(i,n){if(!this.atOccurrence)return;var r=e.splitLines(i);this.doc.replaceRange(r,this.pos.from,this.pos.to,n);this.pos.to=t(this.pos.from.line+r.length-1,r[r.length-1].length+(r.length==1?this.pos.from.ch:0))}};e.defineExtension("getSearchCursor",function(e,t,i){return new m(this.doc,e,t,i)});e.defineDocExtension("getSearchCursor",function(e,t,i){return new m(this,e,t,i)});e.defineExtension("selectMatches",function(t,i){var n=[];var r=this.getSearchCursor(t,this.getCursor("from"),i);while(r.findNext()){if(e.cmpPos(r.to(),this.getCursor("to"))>0)break;n.push({anchor:r.from(),head:r.to()})}if(n.length)this.setSelections(n,0)})});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"),require("../dialog/dialog"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","../dialog/dialog"],e);else e(CodeMirror)})(function(e){"use strict";e.defineOption("search",{bottom:false});function t(e,t,i,n,r){if(e.openDialog)e.openDialog(t,r,{value:n,selectValueOnOpen:true,bottom:e.options.search.bottom});else r(prompt(i,n))}function i(e){return e.phrase("Jump to line:")+' '+e.phrase("(Use line:column or scroll% syntax)")+""}function n(e,t){var i=Number(t);if(/^[-+]/.test(t))return e.getCursor().line+i;else return i-1}e.commands.jumpToLine=function(e){var r=e.getCursor();t(e,i(e),e.phrase("Jump to line:"),r.line+1+":"+r.ch,function(t){if(!t)return;var i;if(i=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t)){e.setCursor(n(e,i[1]),Number(i[2]))}else if(i=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var o=Math.round(e.lineCount()*Number(i[1])/100);if(/^[-+]/.test(i[1]))o=r.line+o+1;e.setCursor(o-1,r.ch)}else if(i=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t)){e.setCursor(n(e,i[1]),r.ch)}})};e.keyMap["default"]["Alt-G"]="jumpToLine"});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e);else e(CodeMirror)})(function(e){"use strict";e.defineExtension("showMatchesOnScrollbar",function(e,i,n){if(typeof n=="string")n={className:n};if(!n)n={};return new t(this,e,i,n)});function t(e,t,i,n){this.cm=e;this.options=n;var r={listenForChanges:false};for(var o in n)r[o]=n[o];if(!r.className)r.className="CodeMirror-search-match";this.annotation=e.annotateScrollbar(r);this.query=t;this.caseFold=i;this.gap={from:e.firstLine(),to:e.lastLine()+1};this.matches=[];this.update=null;this.findMatches();this.annotation.update(this.matches);var l=this;e.on("change",this.changeHandler=function(e,t){l.onChange(t)})}var i=1e3;t.prototype.findMatches=function(){if(!this.gap)return;for(var t=0;t=this.gap.to)break;if(n.to.line>=this.gap.from)this.matches.splice(t--,1)}var r=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),{caseFold:this.caseFold,multiline:this.options.multiline});var o=this.options&&this.options.maxMatches||i;while(r.findNext()){var n={from:r.from(),to:r.to()};if(n.from.line>=this.gap.to)break;this.matches.splice(t++,0,n);if(this.matches.length>o)break}this.gap=null};function n(e,t,i){if(e<=t)return e;return Math.max(t,e+i)}t.prototype.onChange=function(t){var i=t.from.line;var r=e.changeEnd(t).line;var o=r-t.to.line;if(this.gap){this.gap.from=Math.min(n(this.gap.from,i,o),t.from.line);this.gap.to=Math.max(n(this.gap.to,i,o),t.from.line)}else{this.gap={from:t.from.line,to:r+1}}if(o)for(var l=0;l=t.options.minChars)l(e,h,false,t.options.style)})}function f(e,t,i){var n=e.getRange(t,i);if(n.match(/^\w+$/)!==null){if(t.ch>0){var r={line:t.line,ch:t.ch-1};var o=e.getRange(r,t);if(o.match(/\W/)===null)return false}if(i.cho?0:n.indent[o]}}e.defineSimpleMode=function(t,i){e.defineMode(t,function(t){return e.simpleMode(t,i)})};e.simpleMode=function(i,n){t(n,"start");var l={},s=n.meta||{},f=!1,c;for(c in n)if(c!=s&&n.hasOwnProperty(c))for(var u=l[c]=[],h=n[c],d=0;dr.start&&(o.startingInner=!1);c==r.pos&&l.parseDelimiters&&(o.innerActive=o.inner=null);l.innerStyle&&(a=a?a+" "+l.innerStyle:l.innerStyle);return a}a=Infinity;for(var s=r.string,f=0;fl?i.charCoords(e,"local")[t?"top":"bottom"]:i.heightAtLine(s,"local")+(t?0:s.height)}!1!==e&&this.computeScale();var i=this.cm;e=this.hScale;var n=document.createDocumentFragment(),r=this.annotations,o=i.getOption("lineWrapping"),l=o&&1.5*i.defaultTextHeight(),a=null,s=null,f=i.lastLine();if(i.display.barWidth)for(var c=0,u;cf)){for(var d=u||t(h.from,!0)*e,p=t(h.to,!1)*e;cf);){u=t(r[c+1].from,!0)*e;if(u>p+.9)break;h=r[++c];p=t(h.to,!1)*e}if(p!=d){p=Math.max(p-d,3);var m=n.appendChild(document.createElement("div"));m.style.cssText="position: absolute; right: 0px; width: "+Math.max(i.display.barWidth-1,2)+"px; top: "+(d+this.buttonHeight)+"px; height: "+p+"px";m.className=this.options.className;h.id&&m.setAttribute("annotation-id",h.id)}}}this.div.textContent="";this.div.appendChild(n)};t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler);this.cm.off("markerAdded",this.resizeHandler);this.cm.off("markerCleared",this.resizeHandler);this.changeHandler&&this.cm.off("changes",this.changeHandler);this.div.parentNode.removeChild(this.div)}});!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,n){if(0>n&&0==i.ch)return t.clipPos(h(i.line-1));var r=t.getLine(i.line);if(n>0&&i.ch>=r.length)return t.clipPos(h(i.line+1,0));for(var o,l="start",a=i.ch,s=0>n?0:r.length,f=0;a!=s;a+=n,f++){var c=r.charAt(0>n?a-1:a),u="_"!=c&&e.isWordChar(c)?"w":"o";if("w"==u&&c.toUpperCase()==c&&(u="W"),"start"==l)"o"!=u&&(l="in",o=u);else if("in"==l&&o!=u){if("w"==o&&"W"==u&&0>n&&a--,"W"==o&&"w"==u&&n>0){o="w";continue}break}}return h(i.line,a)}function i(e,i){e.extendSelectionsBy(function(n){return e.display.shift||e.doc.extend||n.empty()?t(e.doc,n.head,i):0>i?n.from():n.to()})}function n(t,i){for(var n=i.ch,r=n,o=t.getLine(i.line);n&&e.isWordChar(o.charAt(n-1));)--n;for(;re?-1:e==t?0:1}),t.replaceRange(c,s,f),n&&e.push({anchor:s,head:h(a+1,0)})}n&&t.setSelections(e,0)})}function a(t,i){t.operation(function(){for(var r=t.listSelections(),o=[],l=[],a=0;a=0;a--){var s=r[o[a]];if(!(f&&e.cmpPos(s.head,f)>0)){var c=n(t,s.head);f=c.from,t.replaceRange(i(c.word),c.from,c.to)}}})}function s(t){var i=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(i,r)){var o=n(t,i);if(!o.word)return;i=o.from,r=o.to}return{from:i,to:r,query:t.getRange(i,r),word:o}}function f(e,t){var i=s(e);if(i){var n=i.query,r=e.getSearchCursor(n,t?i.to:i.from);(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):(r=e.getSearchCursor(n,t?h(e.firstLine(),0):e.clipPos(h(e.lastLine()))),(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):i.word&&e.setSelection(i.from,i.to))}}var c=e.keyMap.sublime={fallthrough:"default"},u=e.commands,h=e.Pos,d=e.keyMap["default"]==e.keyMap.macDefault,p=d?"Cmd-":"Ctrl-",m=d?"Ctrl-":"Alt-";u[c[m+"Left"]="goSubwordLeft"]=function(e){i(e,-1)},u[c[m+"Right"]="goSubwordRight"]=function(e){i(e,1)},d&&(c["Cmd-Left"]="goLineStartSmart");var g=d?"Ctrl-Alt-":"Ctrl-";u[c[g+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var i=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=i&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},u[c[g+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var i=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=i&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},u[c["Shift-"+p+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),i=[],n=0;nr.line&&l==o.line&&0==o.ch||i.push({anchor:l==r.line?r:h(l,0),head:l==o.line?o:h(l)});e.setSelections(i,0)},c["Shift-Tab"]="indentLess",u[c.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},u[c[p+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),i=[],n=0;nr?n.push(s,f):n.length&&(n[n.length-1]=f),r=f}t.operation(function(){for(var e=0;et.lastLine()?t.replaceRange("\n"+l,h(t.lastLine()),null,"+swapLine"):t.replaceRange(l+"\n",h(r,0),null,"+swapLine")}t.setSelections(o),t.scrollIntoView()})},u[c[y+"Down"]="swapLineDown"]=function(t){if(t.isReadOnly())return e.Pass;for(var i=t.listSelections(),n=[],r=t.lastLine()+1,o=i.length-1;o>=0;o--){var l=i[o],a=l.to().line+1,s=l.from().line;0!=l.to().ch||l.empty()||a--,r>a?n.push(a,s):n.length&&(n[n.length-1]=s),r=s}t.operation(function(){for(var e=n.length-2;e>=0;e-=2){var i=n[e],r=n[e+1],o=t.getLine(i);i==t.lastLine()?t.replaceRange("",h(i-1),h(i),"+swapLine"):t.replaceRange("",h(i,0),h(i+1,0),"+swapLine"),t.replaceRange(o+"\n",h(r,0),null,"+swapLine")}t.scrollIntoView()})},u[c[p+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},u[c[p+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),i=[],n=0;ni;i++){var n=e.listSelections()[i];n.empty()?e.replaceRange(e.getLine(n.head.line)+"\n",h(n.head.line,0)):e.replaceRange(e.getRange(n.from(),n.to()),n.from())}e.scrollIntoView()})},d||(c[p+"T"]="transposeChars"),u[c.F9="sortLines"]=function(e){l(e,!0)},u[c[p+"F9"]="sortLinesInsensitive"]=function(e){l(e,!1)},u[c.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var i=t.shift(),n=i.find();if(n)return t.push(i),e.setSelection(n.from,n.to)}},u[c["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var i=t[t.length-1].find();if(i)return e.setSelection(i.from,i.to);t.pop()}},u[c[p+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),i=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),n=0;n=0;r--){var o=i[r].head,l=t.getRange({line:o.line,ch:0},o),a=e.countColumn(l,null,t.getOption("tabSize")),s=t.findPosH(o,-1,"char",!1);if(l&&!/\S/.test(l)&&a%n==0){var f=new h(o.line,e.findColumn(l,a-n,n));f.ch!=o.ch&&(s=f)}t.replaceRange("",s,o,"+delete")}})},u[c[x+p+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange("",t[i].anchor,h(t[i].to().line),"+delete");e.scrollIntoView()})},u[c[x+p+"U"]="upcaseAtCursor"]=function(e){a(e,function(e){return e.toUpperCase()})},u[c[x+p+"L"]="downcaseAtCursor"]=function(e){a(e,function(e){return e.toLowerCase()})},u[c[x+p+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},u[c[x+p+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},u[c[x+p+"W"]="deleteToSublimeMark"]=function(t){var i=t.state.sublimeMark&&t.state.sublimeMark.find();if(i){var n=t.getCursor(),r=i;if(e.cmpPos(n,r)>0){var o=r;r=n,n=o}t.state.sublimeKilled=t.getRange(n,r),t.replaceRange("",n,r)}},u[c[x+p+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},u[c[x+p+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},c[x+p+"G"]="clearBookmarks",u[c[x+p+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)};var b=d?"Ctrl-Shift-":"Ctrl-Alt-";u[c[b+"Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),i=0;ie.firstLine()&&e.addSelection(h(n.head.line-1,n.head.ch))}})},u[c[b+"Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),i=0;io))for(c==t.line&&(h=t.ch-(0>i?1:0));h!=d;h+=i){var p=u.charAt(h);if(r.test(p)&&(void 0===n||(e.getTokenTypeAt(a(c,h+1))||"")==(n||""))){var m=s[p];if(m&&">"==m.charAt(1)==0document.documentMode),a=e.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};e.defineOption("matchBrackets",!1,function(t,i,n){n&&n!=e.Init&&(t.off("cursorActivity",r),t.off("focus",r),t.off("blur",o),o(t));i&&(t.state.matchBrackets="object"==typeof i?i:{},t.on("cursorActivity",r),t.on("focus",r),t.on("blur",o))});e.defineExtension("matchBrackets",function(){n(this,!0)});e.defineExtension("findMatchingBracket",function(e,i,n){if(n||"boolean"==typeof i)n?(n.strict=i,i=n):i=i?{strict:!0}:null;return t(this,e,i)});e.defineExtension("scanForBracket",function(e,t,n,r){return i(this,e,t,n,r)})});(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){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:f[t]}function i(e){for(var t=0;t",triples:"",explode:"[]{}"},c=e.Pos;e.defineOption("autoCloseBrackets",!1,function(n,r,o){o&&o!=e.Init&&(n.removeKeyMap(u),n.state.closeBrackets=null);r&&(i(t(r,"pairs")),n.state.closeBrackets=r,n.addKeyMap(u))});var u={Backspace:function(i){var n=r(i);if(!n||i.getOption("disableInput"))return e.Pass;var o=t(n,"pairs");n=i.listSelections();for(var l=0;l=a?-1:o.lastIndexOf(n,a-1),-1==a){if(1==s)break;s=1;a=o.length}else{if(1==s&&aa)){var f=a;a="{";s="}"}else if(null!=s)f=s,a="[",s="]";else return;var c=1,u=t.lastLine(),h=r;e:for(;h<=u;++h)for(var d=t.getLine(h),p=h==r?f:0;;){var m=d.indexOf(a,p);p=d.indexOf(s,p);0>m&&(m=d.length);0>p&&(p=d.length);p=Math.min(m,p);if(p==d.length)break;if(t.getTokenTypeAt(e.Pos(h,p+1))==l)if(p==m)++c;else if(!--c){var g=h;var v=p;break e}++p}if(null!=g&&r!=g)return{from:e.Pos(r,f),to:e.Pos(g,v)}});e.registerHelper("fold","import",function(t,i){function n(i){if(it.lastLine())return null;var n=t.getTokenAt(e.Pos(i,1));/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(i,n.end+1)));if("keyword"!=n.type||"import"!=n.string)return null;var r=i;for(i=Math.min(t.lastLine(),i+10);r<=i;++r){var o=t.getLine(r).indexOf(";");if(-1!=o)return{startCh:n.end,end:e.Pos(r,o)}}}var r=i.line,o=n(r),l;if(!o||n(r-1)||(l=n(r-2))&&l.end.line==r-1)return null;for(l=o.end;;){var a=n(l.line+1);if(null==a)break;l=a.end}return{from:t.clipPos(e.Pos(r,o.startCh+1)),to:l}});e.registerHelper("fold","include",function(t,i){function n(i){if(it.lastLine())return null;var n=t.getTokenAt(e.Pos(i,1));/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(i,n.end+1)));if("meta"==n.type&&"#include"==n.string.slice(0,8))return n.start+8}var r=i.line,o=n(r);if(null==o||null!=n(r-1))return null;for(var l=r;null!=n(l+1);)++l;return{from:e.Pos(r,o+1),to:t.clipPos(e.Pos(l))}})});(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){e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,i){var n=t.getModeAt(i),r=n.blockCommentStart;n=n.blockCommentEnd;if(r&&n){for(var o=i.line,l=t.getLine(o),a=i.ch,s=0;;)if(a=0>=a?-1:l.lastIndexOf(r,a-1),-1==a){if(1==s)return;s=1;a=l.length}else{if(1==s&&ah&&(h=c.length);0>u&&(u=c.length);u=Math.min(h,u);if(u==c.length)break;if(u==h)++s;else if(!--s){var d=f;var p=u;break e}++u}if(null!=d&&(o!=d||p!=l))return{from:e.Pos(o,l),to:e.Pos(d,p)}}})});(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){function t(t,r,o,l){function a(e){var i=s(t,r);if(!i||i.to.line-i.from.linet.firstLine();)r=e.Pos(r.line-1,0),c=a(!1);if(c&&!c.cleared&&"unfold"!==l){var u=i(t,o,c);e.on(u,"mousedown",function(t){h.clear();e.e_preventDefault(t)});var h=t.markText(c.from,c.to,{replacedWith:u,clearOnEnter:n(t,o,"clearOnEnter"),__isFold:!0});h.on("clear",function(i,n){e.signal(t,"unfold",t,i,n)});e.signal(t,"fold",t,c.from,c.to)}}function i(e,t,i){e=n(e,t,"widget");"function"==typeof e&&(e=e(i.from,i.to));"string"==typeof e?(i=document.createTextNode(e),e=document.createElement("span"),e.appendChild(i),e.className="CodeMirror-foldmarker"):e&&(e=e.cloneNode(!0));return e}function n(e,t,i){return t&&void 0!==t[i]?t[i]:(e=e.options.foldOptions)&&void 0!==e[i]?e[i]:r[i]}e.newFoldFunction=function(e,i){return function(n,r){t(n,r,{rangeFinder:e,widget:i})}};e.defineExtension("foldCode",function(e,i,n){t(this,e,i,n)});e.defineExtension("isFolded",function(e){e=this.findMarksAt(e);for(var t=0;t=a){if(u&&h&&u.test(h.className))return;r=n(o.indicatorOpen)}}(r||h)&&e.setGutterMarker(t,o.gutter,r)})}function o(e){var t=e.getViewport(),i=e.state.foldGutter;i&&(e.operation(function(){r(e,t.from,t.to)}),i.from=t.from,i.to=t.to)}function l(e,t,n){var r=e.state.foldGutter;r&&(r=r.options,n==r.gutter&&((n=i(e,t))?n.clear():e.foldCode(c(t,0),r)))}function a(e){var t=e.state.foldGutter;if(t){var i=t.options;t.from=t.to=0;clearTimeout(t.changeUpdate);t.changeUpdate=setTimeout(function(){o(e)},i.foldOnChangeTimeSpan||600)}}function s(e){var t=e.state.foldGutter;if(t){var i=t.options;clearTimeout(t.changeUpdate);t.changeUpdate=setTimeout(function(){var i=e.getViewport();t.from==t.to||20t.to&&(r(e,t.to,i.to),t.to=i.to)})},i.updateViewportTimeSpan||400)}}function f(e,t){var i=e.state.foldGutter;if(i){var n=t.line;n>=i.from&&nr)){for(var o=null,l=n.line+1,a=i.lastLine();l<=a;++l){var s=t(i,l);if(-1!=s)if(s>r)o=l;else break}if(o)return{from:e.Pos(n.line,i.getLine(n.line).length),to:e.Pos(o,i.getLine(o).length)}}})});(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){e.registerHelper("fold","markdown",function(t,i){function n(i){return(i=t.getTokenTypeAt(e.Pos(i,0)))&&/\bheader\b/.test(i)}function r(e,t,i){return(t=t&&t.match(/^#+/))&&n(e)?t[0].length:(t=i&&i.match(/^[=\-]+\s*$/))&&n(e+1)?"="==i[0]?1:2:100}var o=t.getLine(i.line),l=t.getLine(i.line+1),a=r(i.line,o,l);if(100!==a){for(var s=t.lastLine(),f=i.line,c=t.getLine(f+2);f=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function r(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function o(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t)if(n(e))continue;else break;if(i(e,t+1)){var r=e.text.lastIndexOf("/",t);r=-1f&&(!t||t==n[2]))return{tag:n[2],from:c(l,s),to:c(e.line,e.ch)}}else i.push(n[2])}}function f(e,t){for(var n=[];;){var o;e:for(o=e;;){var a=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(-1==a)if(r(o))continue;else{o=void 0;break e}if(i(o,a+1)){var s=o.text.lastIndexOf("/",a);s=-1f&&(!t||t==s[2]))return{tag:s[2],from:c(e.line,e.ch),to:c(o,a)}}}}}var c=e.Pos,u=RegExp("<(/?)([A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");e.registerHelper("fold","xml",function(e,i){for(var n=new t(e,i.line,0);;){var r=a(n);if(!r||n.line!=i.line)break;var l=o(n);if(!l)break;if(!r[1]&&"selfClose"!=l){l=c(n.line,n.ch);if(r=n=s(n,r[2]))r=n.from,r=0<(r.line-l.line||r.ch-l.ch);return r?{from:l,to:n.from}:null}}});e.findMatchingTag=function(e,i,n){var r=new t(e,i.line,i.ch,n);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var a=o(r),u=a&&c(r.line,r.ch),h=a&&l(r);if(a&&h&&!(0<(r.line-i.line||r.ch-i.ch))){i={from:c(r.line,r.ch),to:u,tag:h[2]};if("selfClose"==a)return{open:i,close:null,at:"open"};if(h[1])return{open:f(r,h[2]),close:i,at:"close"};r=new t(e,u.line,u.ch,n);return{open:i,close:s(r,h[2]),at:"open"}}}};e.findEnclosingTag=function(e,i,n,r){for(var o=new t(e,i.line,i.ch,n);;){var l=f(o,r);if(!l)break;var a=new t(e,i.line,i.ch,n);if(a=s(a,l.tag))return{open:l,close:a}}};e.scanForClosingTag=function(e,i,n,r){e=new t(e,i.line,i.ch,r?{from:0,to:r}:null);return s(e,n)}});(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){function t(e,t){this.cm=e;this.options=t;this.widget=null;this.tick=this.debounce=0;this.startPos=this.cm.getCursor("start");this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;if(this.options.updateOnCursorActivity){var i=this;e.on("cursorActivity",this.activityFunc=function(){i.cursorActivity()})}}function i(e,t){function i(e,i){var r="string"!=typeof i?function(e){return i(e,t)}:n.hasOwnProperty(i)?n[i]:i;o[e]=r}var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close};/Mac/.test(navigator.platform)&&(n["Ctrl-P"]=function(){t.moveFocus(-1)},n["Ctrl-N"]=function(){t.moveFocus(1)});var r=e.options.customKeys,o=r?{}:n;if(r)for(var l in r)r.hasOwnProperty(l)&&i(l,r[l]);if(r=e.options.extraKeys)for(l in r)r.hasOwnProperty(l)&&i(l,r[l]);return o}function n(e,t){for(;t&&t!=e;){if("LI"===t.nodeName.toUpperCase()&&t.parentNode==e)return t;t=t.parentNode}}function r(t,r){this.id="cm-complete-"+Math.floor(Math.random(1e6));this.completion=t;this.data=r;this.picked=!1;var o=this,l=t.cm,a=l.getInputField().ownerDocument,s=a.defaultView||a.parentWindow,f=this.hints=a.createElement("ul");f.setAttribute("role","listbox");f.setAttribute("aria-expanded","true");f.id=this.id;f.className="CodeMirror-hints "+t.cm.options.theme;this.selectedHint=r.selectedHint||0;for(var c=r.list,u=0;uf.clientHeight+1:!1,w;setTimeout(function(){w=l.getScrollInfo()});if(0S&&(f.style.height=(C=S)+"px"),f.style.top=(v=u.top-C)+p+"px",y=!1):f.style.height=x-m.top-2+"px"}p=m.right-d;b&&(p+=l.display.nativeBarWidth);0d&&(f.style.width=d-5+"px",p-=m.right-m.left-d),f.style.left=(g=Math.max(u.left-p-h,0))+"px");if(b)for(u=f.firstChild;u;u=u.nextSibling)u.style.paddingRight=l.display.nativeBarWidth+"px";l.addKeyMap(this.keyMap=i(t,{moveFocus:function(e,t){o.changeActive(o.selectedHint+e,t)},setFocus:function(e){o.changeActive(e)},menuSize:function(){return o.screenAmount()},length:c.length,close:function(){t.close()},pick:function(){o.pick()},data:r}));if(t.options.closeOnUnfocus){var k;l.on("blur",this.onBlur=function(){k=setTimeout(function(){t.close()},100)});l.on("focus",this.onFocus=function(){clearTimeout(k)})}l.on("scroll",this.onScroll=function(){var e=l.getScrollInfo(),i=l.getWrapperElement().getBoundingClientRect();w||(w=l.getScrollInfo());var n=v+w.top-e.top,r=n-(s.pageYOffset||(a.documentElement||a.body).scrollTop);y||(r+=f.offsetHeight);if(r<=i.top||r>=i.bottom)return t.close();f.style.top=n+"px";f.style.left=g+w.left-e.left+"px"});e.on(f,"dblclick",function(e){(e=n(f,e.target||e.srcElement))&&null!=e.hintId&&(o.changeActive(e.hintId),o.pick())});e.on(f,"click",function(e){(e=n(f,e.target||e.srcElement))&&null!=e.hintId&&(o.changeActive(e.hintId),t.options.completeOnSingleClick&&o.pick())});e.on(f,"mousedown",function(){setTimeout(function(){l.focus()},20)});u=this.getSelectedHintRange();0===u.from&&0===u.to||this.scrollToActive();e.signal(r,"select",c[this.selectedHint],f.childNodes[this.selectedHint]);return!0}function o(e,t){if(!e.somethingSelected())return t;for(var i=[],n=0;n=this.data.list.length?t=i?this.data.list.length-1:0:0>t&&(t=i?0:this.data.list.length-1);if(this.selectedHint!=t){var n=this.hints.childNodes[this.selectedHint];n&&(n.className=n.className.replace(" CodeMirror-hint-active",""),n.removeAttribute("aria-selected"));n=this.hints.childNodes[this.selectedHint=t];n.className+=" CodeMirror-hint-active";n.setAttribute("aria-selected","true");this.completion.cm.getInputField().setAttribute("aria-activedescendant",n.id);this.scrollToActive();e.signal(this.data,"select",this.data.list[this.selectedHint],n)}},scrollToActive:function(){var e=this.getSelectedHintRange(),t=this.hints.childNodes[e.from];e=this.hints.childNodes[e.to];var i=this.hints.firstChild;t.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=e.offsetTop+e.offsetHeight-this.hints.clientHeight+i.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var e=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-e),to:Math.min(this.data.list.length-1,this.selectedHint+e)}}};e.registerHelper("hint","auto",{resolve:function(t,i){var n=t.getHelpers(i,"hint"),r;if(n.length){var a=function(e,t,i){function r(n){if(n==a.length)return t(null);l(a[n],e,i,function(e){e&&0,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};e.defineOption("hintOptions",null)});(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){var t=/[\w$]+/;e.registerHelper("hint","anyword",function(i,n){for(var r=n&&n.word||t,o=n&&n.range||500,l=i.getCursor(),a=i.getLine(l.line),s=l.ch,f=s;f&&r.test(a.charAt(f-1));)--f;a=f!=s&&a.slice(f,s);var c=n&&n.list||[],u={};r=new RegExp(r.source,"g");for(var h=-1;1>=h;h+=2)for(var d=l.line,p=Math.min(Math.max(d+h*o,i.firstLine()),i.lastLine())+h;d!=p;d+=h)for(var m=i.getLine(d),g;g=r.exec(m);)d==l.line&&g[0]===a||a&&0!=g[0].lastIndexOf(a,0)||Object.prototype.hasOwnProperty.call(u,g[0])||(u[g[0]]=!0,c.push(g[0]));return{list:c,from:e.Pos(l.line,f),to:e.Pos(l.line,s)}})});(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){function t(e){for(var t=0;t=t||(s.line>=t&&(s=l(t,0)),t=a.line,null==n?this.uncomment(a,s,e)?n="un":(this.lineComment(a,s,e),n="line"):"un"==n?this.uncomment(a,s,e):this.lineComment(a,s,e))}});e.defineExtension("lineComment",function(e,a,s){s||(s=r);var f=this,c=n(f,e),u=f.getLine(e.line);if(null!=u&&!i(f,e,u)){var h=s.lineComment||c.lineComment;if(h){var d=Math.min(0!=a.ch||a.line==e.line?a.line+1:a.line,f.lastLine()+1),p=null==s.padding?" ":s.padding,m=s.commentBlankLines||e.line==a.line;f.operation(function(){if(s.indent){for(var i=null,n=e.line;nr.length)i=r}for(n=e.line;nh||s.operation(function(){if(0!=i.fullLines){var n=o.test(s.getLine(h));s.replaceRange(d+u,l(h));s.replaceRange(c+d,l(e.line,0));var r=i.blockCommentLead||f.blockCommentLead;if(null!=r)for(var p=e.line+1;p<=h;++p)(p!=h||n)&&s.replaceRange(r+d,l(p,0))}else n=0==a(s.getCursor("to"),t),r=!s.somethingSelected(),s.replaceRange(u,t),n&&s.setSelection(r?t:s.getCursor("from"),t),s.replaceRange(c,e)})}});e.defineExtension("uncomment",function(e,t,i){i||(i=r);var a=this,s=n(a,e),f=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,a.lastLine()),c=Math.min(e.line,f),u=i.lineComment||s.lineComment,h=[],d=null==i.padding?" ":i.padding,p;e:if(u){for(var m=c;m<=f;++m){var g=a.getLine(m),v=g.indexOf(u);-1i||(t.slice(n,n+d.length)==d&&(n+=d.length),p=!0,a.replaceRange("",l(e,i),l(e,n)))}});if(p)return!0}var y=i.blockCommentStart||s.blockCommentStart,x=i.blockCommentEnd||s.blockCommentEnd;if(!y||!x)return!1;var b=i.blockCommentLead||s.blockCommentLead,w=a.getLine(c),C=w.indexOf(y);if(-1==C)return!1;var S=f==c?w:a.getLine(f),k=S.indexOf(x,f==c?C+y.length:0);i=l(c,C+1);s=l(f,k+1);if(-1==k||!/comment/.test(a.getTokenTypeAt(i))||!/comment/.test(a.getTokenTypeAt(s))||-1=d.length&&-1<(h=p.lastIndexOf(d,f.ch-d.length))&&h>m)if(i(0,p)>=h)u=p.slice(0,h);else{u=t.options.tabSize;var g;h=e.countColumn(p,h,u);u=t.options.indentWithTabs?o.call("\t",g=Math.floor(h/u))+o.call(" ",h-u*g):o.call(" ",h)}else-1<(h=p.indexOf(l.blockCommentContinue))&&h<=f.ch&&h<=i(0,p)&&(u=p.slice(0,h));null!=u&&(u+=l.blockCommentContinue)}null==u&&c&&n(t)&&((null==p&&(p=t.getLine(f.line)),h=p.indexOf(c),f.ch||h)?-1=h&&(u=-1=u||null),u&&(u=p.slice(0,h)+c+p.slice(h+c.length).match(/^\s*/)[0])):u="");if(null==u)return e.Pass;a[s]="\n"+u}t.operation(function(){for(var e=r.length-1;0<=e;e--)t.replaceRange(a[e],r[e].from(),r[e].to(),"+insert")})}function i(e,t){r.lastIndex=e;var i=r.exec(t);return i?i.index:-1}function n(e){return(e=e.getOption("continueComments"))&&"object"==typeof e?!1!==e.continueLineComment:!0}var r=/\S/g,o=String.prototype.repeat||function(e){return Array(e+1).join(this)};e.defineOption("continueComments",null,function(i,n,r){r&&r!=e.Init&&i.removeKeyMap("continueComment");n&&(r="Enter","string"==typeof n?r=n:"object"==typeof n&&n.key&&(r=n.key),n={name:"continueComment"},n[r]=t,i.addKeyMap(n))})});(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){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function i(e){t(e);var i=e.state.placeholder=document.createElement("pre");i.style.cssText="height: 0; overflow: visible";i.style.direction=e.getOption("direction");i.className="CodeMirror-placeholder CodeMirror-line-like";var n=e.getOption("placeholder");"string"==typeof n&&(n=document.createTextNode(n));i.appendChild(n);e.display.lineSpace.insertBefore(i,e.display.lineSpace.firstChild)}function n(e){setTimeout(function(){var n=!1;1==e.lineCount()&&(n=e.getInputField(),n="TEXTAREA"==n.nodeName?!e.getLine(0).length:!/[^\u200b]/.test(n.querySelector(".CodeMirror-line").textContent));n?i(e):t(e)},20)}function r(e){l(e)&&i(e)}function o(e){var n=e.getWrapperElement(),r=l(e);n.className=n.className.replace(" CodeMirror-empty","")+(r?" CodeMirror-empty":"");r?i(e):t(e)}function l(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(i,l,a){a=a&&a!=e.Init;l&&!a?(i.on("blur",r),i.on("change",o),i.on("swapDoc",o),e.on(i.getInputField(),"compositionupdate",i.state.placeholderCompose=function(){n(i)}),o(i)):!l&&a&&(i.off("blur",r),i.off("change",o),i.off("swapDoc",o),e.off(i.getInputField(),"compositionupdate",i.state.placeholderCompose),t(i),a=i.getWrapperElement(),a.className=a.className.replace(" CodeMirror-empty",""));l&&!i.hasFocus()&&r(i)})});(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../lib/codemirror"],e);else e(CodeMirror)})(function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["cgi","pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var t=0;t-1&&t.substring(r+1,t.length);if(o)return e.findModeByExtension(o)};e.findModeByName=function(t){t=t.toLowerCase();for(var i=0;i]{2})/,a=/^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/,u=/^(?:\[\][?=]?)/,i=/^(?:\.(?:\.{2})?|->|[?:])/,o=/^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,c=/^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,s=t(["abstract","alias","as","asm","begin","break","case","class","def","do","else","elsif","end","ensure","enum","extend","for","fun","if","include","instance_sizeof","lib","macro","module","next","of","out","pointerof","private","protected","rescue","return","require","select","sizeof","struct","super","then","type","typeof","uninitialized","union","unless","until","when","while","with","yield","__DIR__","__END_LINE__","__FILE__","__LINE__"]),f=t(["true","false","nil","self"]),l=t(["def","fun","macro","class","module","struct","lib","enum","union","do","for"]),m=t(["if","unless","case","while","until","begin","then"]),h=["end","else","elsif","rescue","ensure"],p=t(h),d=["\\)","\\}","\\]"],k=new RegExp("^(?:"+d.join("|")+")$"),F={def:y,fun:y,macro:function(e,t){if(e.eatSpace())return null;var n;if(n=e.match(o)){if("def"==n)return"keyword";e.eat(/[?!]/)}return t.tokenize.pop(),"def"},class:g,module:g,struct:g,lib:g,enum:g,union:g},z={"[":"]","{":"}","(":")","<":">"};function _(e,t){if(e.eatSpace())return null;if("\\"!=t.lastToken&&e.match("{%",!1))return n(x("%","%"),e,t);if("\\"!=t.lastToken&&e.match("{{",!1))return n(x("{","}"),e,t);if("#"==e.peek())return e.skipToEnd(),"comment";var h;if(e.match(o))return e.eat(/[?!]/),h=e.current(),e.eat(":")?"atom":"."==t.lastToken?"property":s.test(h)?(l.test(h)?"fun"==h&&t.blocks.indexOf("lib")>=0||"def"==h&&"abstract"==t.lastToken||(t.blocks.push(h),t.currentIndent+=1):"operator"!=t.lastStyle&&t.lastStyle||!m.test(h)?"end"==h&&(t.blocks.pop(),t.currentIndent-=1):(t.blocks.push(h),t.currentIndent+=1),F.hasOwnProperty(h)&&t.tokenize.push(F[h]),"keyword"):f.test(h)?"atom":"variable";if(e.eat("@"))return"["==e.peek()?n(b("[","]","meta"),e,t):(e.eat("@"),e.match(o)||e.match(c),"variable-2");if(e.match(c))return"tag";if(e.eat(":"))return e.eat('"')?n(I('"',"atom",!1),e,t):e.match(o)||e.match(c)||e.match(r)||e.match(a)||e.match(u)?"atom":(e.eat(":"),"operator");if(e.eat('"'))return n(I('"',"string",!0),e,t);if("%"==e.peek()){var p,d="string",k=!0;if(e.match("%r"))d="string-2",p=e.next();else if(e.match("%w"))k=!1,p=e.next();else if(e.match("%q"))k=!1,p=e.next();else if(p=e.match(/^%([^\w\s=])/))p=p[1];else{if(e.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/))return"meta";if(e.eat("%"))return"operator"}return z.hasOwnProperty(p)&&(p=z[p]),n(I(p,d,k),e,t)}return(h=e.match(/^<<-('?)([A-Z]\w*)\1/))?n(function(e,t){return function(n,r){if(n.sol()&&(n.eatSpace(),n.match(e)))return r.tokenize.pop(),"string";for(var a=!1;n.peek();)if(a)n.next(),a=!1;else{if(n.match("{%",!1))return r.tokenize.push(x("%","%")),"string";if(n.match("{{",!1))return r.tokenize.push(x("{","}")),"string";if(t&&n.match("#{",!1))return r.tokenize.push(b("#{","}","meta")),"string";a=t&&"\\"==n.next()}return"string"}}(h[2],!h[1]),e,t):e.eat("'")?(e.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/),e.eat("'"),"atom"):e.eat("0")?(e.eat("x")?e.match(/^[0-9a-fA-F_]+/):e.eat("o")?e.match(/^[0-7_]+/):e.eat("b")&&e.match(/^[01_]+/),"number"):e.eat(/^\d/)?(e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/),"number"):e.match(r)?(e.eat("="),"operator"):e.match(a)||e.match(i)?"operator":(h=e.match(/[({[]/,!1))?n(b(h=h[0],z[h],null),e,t):e.eat("\\")?(e.next(),"meta"):(e.next(),null)}function b(e,t,n,r){return function(a,u){if(!r&&a.match(e))return u.tokenize[u.tokenize.length-1]=b(e,t,n,!0),u.currentIndent+=1,n;var i=_(a,u);return a.current()===t&&(u.tokenize.pop(),u.currentIndent-=1,i=n),i}}function x(e,t,n){return function(r,a){return!n&&r.match("{"+e)?(a.currentIndent+=1,a.tokenize[a.tokenize.length-1]=x(e,t,!0),"meta"):r.match(t+"}")?(a.currentIndent-=1,a.tokenize.pop(),"meta"):_(r,a)}}function y(e,t){return e.eatSpace()?null:(e.match(o)?e.eat(/[!?]/):e.match(r)||e.match(a)||e.match(u),t.tokenize.pop(),"def")}function g(e,t){return e.eatSpace()?null:(e.match(c),t.tokenize.pop(),"def")}function I(e,t,n){return function(r,a){for(var u=!1;r.peek();)if(u)r.next(),u=!1;else{if(r.match("{%",!1))return a.tokenize.push(x("%","%")),t;if(r.match("{{",!1))return a.tokenize.push(x("{","}")),t;if(n&&r.match("#{",!1))return a.tokenize.push(b("#{","}","meta")),t;var i=r.next();if(i==e)return a.tokenize.pop(),t;u=n&&"\\"==i}return t}}return{startState:function(){return{tokenize:[_],currentIndent:0,lastToken:null,lastStyle:null,blocks:[]}},token:function(e,t){var n=t.tokenize[t.tokenize.length-1](e,t),r=e.current();return n&&"comment"!=n&&(t.lastToken=r,t.lastStyle=n),n},indent:function(t,n){return n=n.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g,""),p.test(n)||k.test(n)?e.indentUnit*(t.currentIndent-1):e.indentUnit*t.currentIndent},fold:"indent",electricInput:t(d.concat(h),!0),lineComment:"#"}}),e.defineMIME("text/x-crystal","crystal")}); \ No newline at end of file +!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.defineMode("crystal",function(e){function t(e,t){return new RegExp((t?"":"^")+"(?:"+e.join("|")+")"+(t?"$":"\\b"))}function n(e,t,n){return n.tokenize.push(e),e(t,n)}var r=/^(?:[-+/%|&^]|\*\*?|[<>]{2})/,a=/^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/,u=/^(?:\[\][?=]?)/,i=/^(?:\.(?:\.{2})?|->|[?:])/,o=/^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,c=/^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,s=t(["abstract","alias","as","asm","begin","break","case","class","def","do","else","elsif","end","ensure","enum","extend","for","fun","if","include","instance_sizeof","lib","macro","module","next","of","out","pointerof","private","protected","rescue","return","require","select","sizeof","struct","super","then","type","typeof","uninitialized","union","unless","until","when","while","with","yield","__DIR__","__END_LINE__","__FILE__","__LINE__"]),f=t(["true","false","nil","self"]),l=t(["def","fun","macro","class","module","struct","lib","enum","union","do","for"]),m=t(["if","unless","case","while","until","begin","then"]),h=["end","else","elsif","rescue","ensure"],p=t(h),d=["\\)","\\}","\\]"],k=new RegExp("^(?:"+d.join("|")+")$"),F={def:y,fun:y,macro:function(e,t){if(e.eatSpace())return null;var n;if(n=e.match(o)){if("def"==n)return"keyword";e.eat(/[?!]/)}return t.tokenize.pop(),"def"},class:g,module:g,struct:g,lib:g,enum:g,union:g},z={"[":"]","{":"}","(":")","<":">"};function _(e,t){if(e.eatSpace())return null;if("\\"!=t.lastToken&&e.match("{%",!1))return n(x("%","%"),e,t);if("\\"!=t.lastToken&&e.match("{{",!1))return n(x("{","}"),e,t);if("#"==e.peek())return e.skipToEnd(),"comment";var h;if(e.match(o))return e.eat(/[?!]/),h=e.current(),e.eat(":")?"atom":"."==t.lastToken?"property":s.test(h)?(l.test(h)?"fun"==h&&t.blocks.indexOf("lib")>=0||"def"==h&&"abstract"==t.lastToken||(t.blocks.push(h),t.currentIndent+=1):"operator"!=t.lastStyle&&t.lastStyle||!m.test(h)?"end"==h&&(t.blocks.pop(),t.currentIndent-=1):(t.blocks.push(h),t.currentIndent+=1),F.hasOwnProperty(h)&&t.tokenize.push(F[h]),"keyword"):f.test(h)?"atom":"variable";if(e.eat("@"))return"["==e.peek()?n(b("[","]","meta"),e,t):(e.eat("@"),e.match(o)||e.match(c),"variable-2");if(e.match(c))return"tag";if(e.eat(":"))return e.eat('"')?n(I('"',"atom",!1),e,t):e.match(o)||e.match(c)||e.match(r)||e.match(a)||e.match(u)?"atom":(e.eat(":"),"operator");if(e.eat('"'))return n(I('"',"string",!0),e,t);if("%"==e.peek()){var p,d="string",k=!0;if(e.match("%r"))d="string-2",p=e.next();else if(e.match("%w"))k=!1,p=e.next();else if(e.match("%q"))k=!1,p=e.next();else if(p=e.match(/^%([^\w\s=])/))p=p[1];else{if(e.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/))return"meta";if(e.eat("%"))return"operator"}return z.hasOwnProperty(p)&&(p=z[p]),n(I(p,d,k),e,t)}return(h=e.match(/^<<-('?)([A-Z]\w*)\1/))?n(function(e,t){return function(n,r){if(n.sol()&&(n.eatSpace(),n.match(e)))return r.tokenize.pop(),"string";for(var a=!1;n.peek();)if(a)n.next(),a=!1;else{if(n.match("{%",!1))return r.tokenize.push(x("%","%")),"string";if(n.match("{{",!1))return r.tokenize.push(x("{","}")),"string";if(t&&n.match("#{",!1))return r.tokenize.push(b("#{","}","meta")),"string";a="\\"==n.next()&&t}return"string"}}(h[2],!h[1]),e,t):e.eat("'")?(e.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/),e.eat("'"),"atom"):e.eat("0")?(e.eat("x")?e.match(/^[0-9a-fA-F_]+/):e.eat("o")?e.match(/^[0-7_]+/):e.eat("b")&&e.match(/^[01_]+/),"number"):e.eat(/^\d/)?(e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/),"number"):e.match(r)?(e.eat("="),"operator"):e.match(a)||e.match(i)?"operator":(h=e.match(/[({[]/,!1))?n(b(h=h[0],z[h],null),e,t):e.eat("\\")?(e.next(),"meta"):(e.next(),null)}function b(e,t,n,r){return function(a,u){if(!r&&a.match(e))return u.tokenize[u.tokenize.length-1]=b(e,t,n,!0),u.currentIndent+=1,n;var i=_(a,u);return a.current()===t&&(u.tokenize.pop(),u.currentIndent-=1,i=n),i}}function x(e,t,n){return function(r,a){return!n&&r.match("{"+e)?(a.currentIndent+=1,a.tokenize[a.tokenize.length-1]=x(e,t,!0),"meta"):r.match(t+"}")?(a.currentIndent-=1,a.tokenize.pop(),"meta"):_(r,a)}}function y(e,t){return e.eatSpace()?null:(e.match(o)?e.eat(/[!?]/):e.match(r)||e.match(a)||e.match(u),t.tokenize.pop(),"def")}function g(e,t){return e.eatSpace()?null:(e.match(c),t.tokenize.pop(),"def")}function I(e,t,n){return function(r,a){for(var u=!1;r.peek();)if(u)r.next(),u=!1;else{if(r.match("{%",!1))return a.tokenize.push(x("%","%")),t;if(r.match("{{",!1))return a.tokenize.push(x("{","}")),t;if(n&&r.match("#{",!1))return a.tokenize.push(b("#{","}","meta")),t;var i=r.next();if(i==e)return a.tokenize.pop(),t;u=n&&"\\"==i}return t}}return{startState:function(){return{tokenize:[_],currentIndent:0,lastToken:null,lastStyle:null,blocks:[]}},token:function(e,t){var n=t.tokenize[t.tokenize.length-1](e,t),r=e.current();return n&&"comment"!=n&&(t.lastToken=r,t.lastStyle=n),n},indent:function(t,n){return n=n.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g,""),p.test(n)||k.test(n)?e.indentUnit*(t.currentIndent-1):e.indentUnit*t.currentIndent},fold:"indent",electricInput:t(d.concat(h),!0),lineComment:"#"}}),e.defineMIME("text/x-crystal","crystal")}); \ No newline at end of file diff --git a/unauthenticated/js/codemirror/mode/dart/dart.js b/unauthenticated/js/codemirror/mode/dart/dart.js index ba4068a46..1971a9d8f 100644 --- a/unauthenticated/js/codemirror/mode/dart/dart.js +++ b/unauthenticated/js/codemirror/mode/dart/dart.js @@ -1 +1 @@ -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../clike/clike"],e):e(CodeMirror)}(function(e){function t(e){for(var t={},n=0;n0&&(t.tokenize=l(t),null)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function e(t){return function(n,i){for(var r;r=n.next();){if("*"==r&&n.eat("/")){if(1==t){i.tokenize=null;break}return i.tokenize=e(t-1),i.tokenize(n,i)}if("/"==r&&n.eat("*"))return i.tokenize=e(t+1),i.tokenize(n,i)}return"comment"}}(1),t.tokenize(e,t))},token:function(e,t,n){if("variable"==n&&RegExp("^[_$]*[A-Z][a-zA-Z0-9_$]*$","g").test(e.current()))return"variable-2"}}}),e.registerHelper("hintWords","application/dart",t.concat(i).concat(r)),e.defineMode("dart",function(t){return e.getMode(t,"application/dart")},"clike")}); \ No newline at end of file diff --git a/unauthenticated/js/codemirror/mode/groovy/groovy.js b/unauthenticated/js/codemirror/mode/groovy/groovy.js index c73f59fef..236984583 100644 --- a/unauthenticated/js/codemirror/mode/groovy/groovy.js +++ b/unauthenticated/js/codemirror/mode/groovy/groovy.js @@ -1 +1 @@ -!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.defineMode("groovy",function(t){function n(e){for(var t={},n=e.split(" "),r=0;r"))return r="->",null;if(/[+\-*&%=<>!?|\/~]/.test(n))return e.eatWhile(/[+\-*&%=<>|~]/),"operator";if(e.eatWhile(/[\w\$_]/),"@"==n)return e.eatWhile(/[\w\$_\.]/),"meta";if("."==t.lastToken)return"property";if(e.eat(":"))return r="proplabel","property";var s=e.current();return l.propertyIsEnumerable(s)?"atom":i.propertyIsEnumerable(s)?(o.propertyIsEnumerable(s)?r="newstatement":a.propertyIsEnumerable(s)&&(r="standalone"),"keyword"):"variable"}function u(e,t,n){var r=!1;if("/"!=e&&t.eat(e)){if(!t.eat(e))return"string";r=!0}function i(t,n){for(var i,o=!1,a=!r;null!=(i=t.next());){if(i==e&&!o){if(!r)break;if(t.match(e+e)){a=!0;break}}if('"'==e&&"$"==i&&!o){if(t.eat("{"))return n.tokenize.push(f()),"string";if(t.match(/^\w/,!1))return n.tokenize.push(c),"string"}o=!o&&"\\"==i}return a&&n.tokenize.pop(),"string"}return n.tokenize.push(i),i(t,n)}function f(){var e=1;function t(t,n){if("}"==t.peek()){if(0==--e)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)}else"{"==t.peek()&&e++;return s(t,n)}return t.isBase=!0,t}function c(e,t){var n=e.match(/^(\.|[\w\$_]+)/);return n?"."==n[0]?null:"variable":(t.tokenize.pop(),t.tokenize[t.tokenize.length-1](e,t))}function p(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize.pop();break}r="*"==n}return"comment"}function d(e,t){return!e||"operator"==e||"->"==e||/[\.\[\{\(,;:]/.test(e)||"newstatement"==e||"keyword"==e||"proplabel"==e||"standalone"==e&&!t}function m(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function k(e,t,n){return e.context=new m(e.indented,t,n,null,e.context)}function h(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}return s.isBase=!0,{startState:function(e){return{tokenize:[s],context:new m((e||0)-t.indentUnit,0,"top",!1),indented:0,startOfLine:!0,lastToken:null}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0,"statement"!=n.type||d(t.lastToken,!0)||(h(t),n=t.context)),e.eatSpace())return null;r=null;var i=t.tokenize[t.tokenize.length-1](e,t);if("comment"==i)return i;if(null==n.align&&(n.align=!0),";"!=r&&":"!=r||"statement"!=n.type)if("->"==r&&"statement"==n.type&&"}"==n.prev.type)h(t),t.context.align=!1;else if("{"==r)k(t,e.column(),"}");else if("["==r)k(t,e.column(),"]");else if("("==r)k(t,e.column(),")");else if("}"==r){for(;"statement"==n.type;)n=h(t);for("}"==n.type&&(n=h(t));"statement"==n.type;)n=h(t)}else r==n.type?h(t):("}"==n.type||"top"==n.type||"statement"==n.type&&"newstatement"==r)&&k(t,e.column(),"statement");else h(t);return t.startOfLine=!1,t.lastToken=r||i,i},indent:function(n,r){if(!n.tokenize[n.tokenize.length-1].isBase)return e.Pass;var i=r&&r.charAt(0),o=n.context;"statement"!=o.type||d(n.lastToken,!0)||(o=o.prev);var a=i==o.type;return"statement"==o.type?o.indented+("{"==i?0:t.indentUnit):o.align?o.column+(a?0:1):o.indented+(a?0:t.indentUnit)},electricChars:"{}",closeBrackets:{triples:"'\""},fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),e.defineMIME("text/x-groovy","groovy")}); \ No newline at end of file +!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.defineMode("groovy",function(t){function n(e){for(var t={},n=e.split(" "),r=0;r"))return r="->",null;if(/[+\-*&%=<>!?|\/~]/.test(n))return e.eatWhile(/[+\-*&%=<>|~]/),"operator";if(e.eatWhile(/[\w\$_]/),"@"==n)return e.eatWhile(/[\w\$_\.]/),"meta";if("."==t.lastToken)return"property";if(e.eat(":"))return r="proplabel","property";var s=e.current();return l.propertyIsEnumerable(s)?"atom":i.propertyIsEnumerable(s)?(o.propertyIsEnumerable(s)?r="newstatement":a.propertyIsEnumerable(s)&&(r="standalone"),"keyword"):"variable"}function u(e,t,n){var r=!1;if("/"!=e&&t.eat(e)){if(!t.eat(e))return"string";r=!0}function i(t,n){for(var i,o=!1,a=!r;null!=(i=t.next());){if(i==e&&!o){if(!r)break;if(t.match(e+e)){a=!0;break}}if('"'==e&&"$"==i&&!o){if(t.eat("{"))return n.tokenize.push(f()),"string";if(t.match(/^\w/,!1))return n.tokenize.push(c),"string"}o=!o&&"\\"==i}return a&&n.tokenize.pop(),"string"}return n.tokenize.push(i),i(t,n)}function f(){var e=1;function t(t,n){if("}"==t.peek()){if(0==--e)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)}else"{"==t.peek()&&e++;return s(t,n)}return t.isBase=!0,t}function c(e,t){var n=e.match(/^(\.|[\w\$_]+)/);return n&&e.match("."==n[0]?/^[\w$_]/:/^\./)||t.tokenize.pop(),n?"."==n[0]?null:"variable":t.tokenize[t.tokenize.length-1](e,t)}function p(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize.pop();break}r="*"==n}return"comment"}function d(e,t){return!e||"operator"==e||"->"==e||/[\.\[\{\(,;:]/.test(e)||"newstatement"==e||"keyword"==e||"proplabel"==e||"standalone"==e&&!t}function m(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function h(e,t,n){return e.context=new m(e.indented,t,n,null,e.context)}function k(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}return s.isBase=!0,{startState:function(e){return{tokenize:[s],context:new m((e||0)-t.indentUnit,0,"top",!1),indented:0,startOfLine:!0,lastToken:null}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0,"statement"!=n.type||d(t.lastToken,!0)||(k(t),n=t.context)),e.eatSpace())return null;r=null;var i=t.tokenize[t.tokenize.length-1](e,t);if("comment"==i)return i;if(null==n.align&&(n.align=!0),";"!=r&&":"!=r||"statement"!=n.type)if("->"==r&&"statement"==n.type&&"}"==n.prev.type)k(t),t.context.align=!1;else if("{"==r)h(t,e.column(),"}");else if("["==r)h(t,e.column(),"]");else if("("==r)h(t,e.column(),")");else if("}"==r){for(;"statement"==n.type;)n=k(t);for("}"==n.type&&(n=k(t));"statement"==n.type;)n=k(t)}else r==n.type?k(t):("}"==n.type||"top"==n.type||"statement"==n.type&&"newstatement"==r)&&h(t,e.column(),"statement");else k(t);return t.startOfLine=!1,t.lastToken=r||i,i},indent:function(n,r){if(!n.tokenize[n.tokenize.length-1].isBase)return e.Pass;var i=r&&r.charAt(0),o=n.context;"statement"!=o.type||d(n.lastToken,!0)||(o=o.prev);var a=i==o.type;return"statement"==o.type?o.indented+("{"==i?0:t.indentUnit):o.align?o.column+(a?0:1):o.indented+(a?0:t.indentUnit)},electricChars:"{}",closeBrackets:{triples:"'\""},fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),e.defineMIME("text/x-groovy","groovy")}); \ No newline at end of file