define("mixins/token_iterator",["require","exports","module"],function(a,p,k){var g=a("ace/token_iterator").TokenIterator,n=a("ace/range").Range;(function(){function a(b,a){return 1===b.length&&("{"===b||"("===b||"["===b||!!a&&"<"===b)}function f(b,a){return 1===b.length&&("}"===b||")"===b||"]"===b||!!a&&">"===b)}function e(b,a,d,e,c){for(var m=1,q,h=b.clone();q=d.call(h);)if(q=a(q),q===c){if(m--,0===m)return b.moveToTokenIterator(h),!0}else q===e&&m++;return!1}var b={"(":")","{":"}","[":"]","<":">",
")":"(","}":"{","]":"[",">":"<"};this.moveToPreviousToken=function(){var b=this.$rowTokens,a=this.$tokenIndex-1;if(0<=a)return this.$tokenIndex--,b[a];a=this.$session;var d=this.$row;if(0>d)return null;for(;;){d--;if(0>d)return null;if((b=a.getTokens(d))&&b.length)return this.$row=d,this.$tokenIndex=b.length-1,this.$rowTokens=b,b[b.length-1]}};this.moveToNextToken=function(){var b=this.$rowTokens,a=this.$tokenIndex+1;if(a<b.length)return this.$tokenIndex++,b[a];a=this.$session;var d=a.getLength(),
e=this.$row;if(e>=d)return null;for(;;){e++;if(e>=d)return null;if((b=a.getTokens(e))&&b.length)return this.$row=e,this.$tokenIndex=0,this.$rowTokens=b,b[0]}};this.moveToNextSignificantToken=function(){if(!this.moveToNextToken())return!1;for(var b=this.getCurrentToken();/^\s+$/.test(b.value)||/\bcomment\b/.test(b.type);){if(!this.moveToNextToken())return!1;b=this.getCurrentToken()}return!0};this.moveToPreviousSignificantToken=function(){if(!this.moveToPreviousToken())return!1;for(var b=this.getCurrentToken();/^\s+$/.test(b.value)||
/\bcomment\b/.test(b.type);){if(!this.moveToPreviousToken())return!1;b=this.getCurrentToken()}return!0};this.moveToStartOfRow=function(){this.$tokenIndex=0;return this.getCurrentToken()};this.moveToEndOfRow=function(){this.$tokenIndex=this.$rowTokens.length-1;return this.getCurrentToken()};this.moveToStartOfNextRowWithTokens=function(){for(var b=this.$row,a=this.$session,d=a.getLength();;){b++;if(b>=d)return null;var e=a.getTokens(b);if(e&&e.length)return this.$row=b,this.$tokenIndex=0,this.$rowTokens=
e,this.getCurrentToken()}};var c,d=0,h=0;this.tokenizeUpToRow=function(b){var a=this.$session.bgTokenizer;d=Math.min(d,a.currentLine);h=Math.max(h,b);for(var e=a.currentLine;e<=b;e++)a.$tokenizeRow(e);clearTimeout(c);c=setTimeout(function(){a.fireUpdateEvent(d,h);d=h;h=0},700)};this.moveToPosition=function(b,a){this.tokenizeUpToRow(b.row);var d=this.$session.getTokenAt(b.row,b.column);d&&a&&d.column<b.column&&(d=this.$session.getTokenAt(b.row,b.column+1));if(null==d){if(a)return this.$row=b.row,this.$rowTokens=
this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1,this.moveToNextToken();this.$row=b.row+1;this.$tokenIndex=0;this.$rowTokens=this.$session.getTokens(this.$row);return this.moveToPreviousToken()}this.$row=b.row;this.$rowTokens=this.$session.getTokens(this.$row);this.$tokenIndex=d.index;return this.getCurrentToken()};this.clone=function(){var b=new g(this.$session,0,0);b.moveToTokenIterator(this);return b};this.moveToTokenIterator=function(b){for(var a in b)b.hasOwnProperty(a)&&
(this[a]=b[a])};this.peekFwd=function(b){for(var a=this.clone(),d=null,e=0;e<b;e++)d=a.moveToNextToken();return d};this.peekBwd=function(b){for(var a=this.clone(),d=null,e=0;e<b;e++)d=a.moveToPreviousToken();return d};this.getCurrentToken=function(){var b=this.$rowTokens[this.$tokenIndex];b&&(b.row=this.$row);return b};this.getCurrentTokenValue=function(){return this.getCurrentToken().value};this.getCurrentTokenPosition=function(){return{row:this.getCurrentTokenRow(),column:this.getCurrentTokenColumn()}};
this.getCurrentTokenRange=function(){var b=this.getCurrentTokenPosition(),a={row:b.row,column:b.column+this.getCurrentToken().value.length};return n.fromPoints(b,a)};this.fwdToMatchingToken=function(){var d=this.getCurrentToken();return a(d.value,!0)?e(this,function(b){return b.value},this.moveToNextToken,d.value,b[d.value]):"support.function.codebegin"===d.type?e(this,function(b){return b.type},this.moveToNextToken,"support.function.codebegin","support.function.codeend"):!1};this.bwdToMatchingToken=
function(){var a=this.getCurrentToken();return f(a.value,!0)?e(this,function(b){return b.value},this.moveToPreviousToken,a.value,b[a.value]):"support.function.codeend"===a.type?e(this,function(b){return b.type},this.moveToPreviousToken,"support.function.codeend","support.function.codebegin"):!1};this.findTokenValueBwd=function(b,a){a=!!a;do if(!(a&&this.bwdToMatchingToken()||this.getCurrentToken().value!==b))return!0;while(this.moveToPreviousToken());return!1};this.findTokenValueFwd=function(b,a){a=
!!a;do if(!(a&&this.fwdToMatchingToken()||this.getCurrentToken().value!==b))return!0;while(this.moveToNextToken());return!1};this.findTokenTypeBwd=function(b,a){a=!!a;do if(!(a&&this.bwdToMatchingToken()||this.getCurrentToken().type!==b))return!0;while(this.moveToPreviousToken());return!1};this.findTokenTypeFwd=function(b,a){a=!!a;do if(!(a&&this.fwdToMatchingToken()||this.getCurrentToken().type!==b))return!0;while(this.moveToNextToken());return!1}}).call(g.prototype)});define("ace/token_tooltip",["require","exports","module"],function(a,p,k){function g(a){a.tokenTooltip||(f.call(this,a.container),a.tokenTooltip=this,this.editor=a,this.update=this.update.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseOut=this.onMouseOut.bind(this),n.addListener(a.renderer.scroller,"mousemove",this.onMouseMove),n.addListener(a.renderer.content,"mouseout",this.onMouseOut))}a("ace/lib/dom");k=a("ace/lib/oop");var n=a("ace/lib/event"),l=a("ace/range").Range,f=a("ace/tooltip").Tooltip;
k.inherits(g,f);(function(){this.token={};this.range=new l;this.update=function(){this.$timer=null;var a=this.editor.renderer;1E3<this.lastT-(a.timeStamp||0)&&(a.rect=null,a.timeStamp=this.lastT,this.maxHeight=window.innerHeight,this.maxWidth=window.innerWidth);var b=a.rect||(a.rect=a.scroller.getBoundingClientRect()),c=this.editor.session;a=c.screenToDocumentPosition(Math.floor((this.y+a.scrollTop-b.top)/a.lineHeight),Math.round((this.x+a.scrollLeft-b.left-a.$padding)/a.characterWidth));(b=c.getTokenAt(a.row,
a.column))||c.getLine(a.row)||(b={type:"",value:"",state:c.bgTokenizer.getState(0)});if(b){var d=b.type;b.state&&(d+="|"+b.state);b.merge&&(d+="\n  merge");b.stateTransitions&&(d+="\n  "+b.stateTransitions.join("\n  "));this.tokenText!=d&&(this.setText(d),this.width=this.getWidth(),this.height=this.getHeight(),this.tokenText=d);this.show(null,this.x,this.y);this.token=b;c.removeMarker(this.marker);this.range=new l(a.row,b.start,a.row,b.start+b.value.length);this.marker=c.addMarker(this.range,"ace_bracket",
"text")}else c.removeMarker(this.marker),this.hide()};this.onMouseMove=function(a){this.x=a.clientX;this.y=a.clientY;this.isOpen&&(this.lastT=a.timeStamp,this.setPosition(this.x,this.y));this.$timer||(this.$timer=setTimeout(this.update,100))};this.onMouseOut=function(a){a&&a.currentTarget.contains(a.relatedTarget)||(this.hide(),this.editor.session.removeMarker(this.marker),this.$timer=clearTimeout(this.$timer))};this.setPosition=function(a,b){a+10+this.width>this.maxWidth&&(a=window.innerWidth-this.width-
10);if(b>.75*window.innerHeight||b+20+this.height>this.maxHeight)b=b-this.height-30;f.prototype.setPosition.call(this,a+10,b+20)};this.destroy=function(){this.onMouseOut();n.removeListener(this.editor.renderer.scroller,"mousemove",this.onMouseMove);n.removeListener(this.editor.renderer.content,"mouseout",this.onMouseOut);delete this.editor.tokenTooltip}}).call(g.prototype);p.TokenTooltip=g});define("mode/auto_brace_insert",["require","exports","module"],function(a,p,k){var g=a("ace/range").Range,n=a("ace/mode/text").Mode;(function(){this.$complements={"(":")","[":"]",'"':'"',"{":"}"};this.$reOpen=/^[(["{]$/;this.$reClose=/^[)\]"}]$/;this.$reStop=/^[;,\s)\]}]$/;this.wrapInsert=function(a,f,e,b){if(!this.insertMatching)return f.call(a,e,b);var c=a.selection.getCursor();if(c=a.selection.isEmpty()&&e.row==c.row&&e.column==c.column){var d=g.fromPoints(e,{row:e.row,column:e.column+1}),h=a.doc.getTextRange(d);
if(this.$reClose.test(h)&&h==b){a.selection.moveCursorTo(d.end.row,d.end.column,!1);return}}d=null;c&&(d=this.$moveLeft(a.doc,e),d=a.doc.getTextRange(g.fromPoints(d,e)));f=f.call(a,e,b);c&&this.$reOpen.test(b)?(e=g.fromPoints(f,{row:f.row,column:f.column+1}),e=a.doc.getTextRange(e),(this.$reStop.test(e)||0==e.length)&&this.allowAutoInsert(a,f,this.$complements[b])&&(a.doc.insert(f,this.$complements[b]),a.selection.moveCursorTo(f.row,f.column,!1))):c&&"\n"===b&&(b=this.$moveRight(a.doc,f),b=a.doc.getTextRange(g.fromPoints(f,
b)),"{"===d&&"}"===b||"("===d&&")"===b||"["===d&&"]"===b)&&(e=this.getIndentForOpenBrace?this.getIndentForOpenBrace(this.$moveLeft(a.doc,e)):this.$getIndent(a.doc.getLine(f.row-1)),a.doc.insert(f,"\n"+e),a.selection.moveCursorTo(f.row,f.column,!1));return f};this.allowAutoInsert=function(a,f,e){return!0};this.smartAllowAutoInsert=function(a,f,e){return"'"!==e&&'"'!==e&&"`"!==e?!0:"`"===e?(f=a.doc.getTextRange({start:{row:f.row,column:0},end:f}),f=f.replace(/\\./g,""),0!=f.match(/`/g).length%2):0==
f.column?!0:(a=this.codeModel.getTokenForPos(f,!1,!0))&&"string"===a.type&&a.column===f.column-1};this.wrapRemove=function(a,f,e){var b=a.selection.getCursor(),c=a.session.getDocument();if(!this.insertMatching||"left"!=e||!a.selection.isEmpty()||a.$readOnly||0==b.column||c.getLine(b.row).length<=b.column)return f.call(a,e);var d=g.fromPoints(this.$moveLeft(c,b),b);b=g.fromPoints(b,this.$moveRight(c,b));d=c.getTextRange(d);c=this.$reOpen.test(d)&&this.$complements[d]==c.getTextRange(b);f.call(a,e);
c&&f.call(a,"right")};this.$moveLeft=function(a,f){if(0==f.row&&0==f.column)return f;var e=f.row,b=f.column;b?b--:(e--,b=a.getLine(e).length);return{row:e,column:b}};this.$moveRight=function(a,f){var e=f.row,b=f.column;a.getLine(e).length!=b?b++:(e++,b=0);return e>=a.getLength()?f:{row:e,column:b}}}).call(n.prototype);p.setInsertMatching=function(a){n.prototype.insertMatching=a}});define("mode/c_cpp",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("ace/range").Range;a("mode/r_highlight_rules");var f=a("mode/c_cpp_highlight_rules").c_cppHighlightRules,e=a("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,b=a("mode/behaviour/cstyle").CStyleBehaviour,c=null;window.NodeWebkit||(c=a("mode/c_cpp_fold_mode").FoldMode);var d=a("mode/r_code_model").RCodeModel,h=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,
q=a("mode/cpp_code_model").CppCodeModel;a("mode/token_cursor");var r=a("mode/utils");a=function(a,l){this.$session=l;this.$doc=l.getDocument();this.$tokenizer=new n((new f).getRules());this.r_codeModel=new d(l,this.$tokenizer,/^r-/,/^\s*\/\*{3,}\s*([Rr])\s*$/,/^\s*\*+\//);this.$r_outdent=new h(this.r_codeModel);this.codeModel=new q(l,this.$tokenizer);this.$behaviour=new b(this.codeModel);this.$cpp_outdent=new e(this.codeModel);window.NodeWebkit||(this.foldingRules=new c);this.$tokens=this.codeModel.$tokens;
this.getLineSansComments=this.codeModel.getLineSansComments};k.inherits(a,g);(function(){this.wrapInsert=function(a,b,d,c){return this.cursorInRLanguageMode()?g.prototype.wrapInsert(a,b,d,c):b.call(a,d,c)};this.wrapRemove=function(a,b,d){return this.cursorInRLanguageMode()?g.prototype.wrapRemove(a,b,d):b.call(a,d)};this.insertChunkInfo={value:"/*** R\n\n*/\n",position:{row:1,column:0},content_position:{row:1,column:0}};this.toggleCommentLines=function(a,b,d,c){var e=!0;a=/^(\s*)\/\//;for(var m=d;m<=
c;m++)if(!a.test(b.getLine(m))){e=!1;break}if(e)for(e=new l(0,0,0,0),m=d;m<=c;m++)d=b.getLine(m).match(a),e.start.row=m,e.end.row=m,e.end.column=d[0].length,b.replace(e,d[1]);else b.indentRows(d,c,"//")};this.getLanguageMode=function(a){return r.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"C_CPP"};this.cursorInRLanguageMode=function(){return"R"===this.getLanguageMode(this.$session.getSelection().getCursor())};this.inRLanguageMode=function(a){return a.match(/^r-/)};this.getNextLineIndent=
function(a,b,d,c,e){a=r.primaryState(a);return this.inRLanguageMode(a)?this.r_codeModel.getNextLineIndent(a,b,d,c):this.codeModel.getNextLineIndent(a,b,d,c,e)};this.checkOutdent=function(a,b,d){return this.inRLanguageMode(a)?this.$r_outdent.checkOutdent(a,b,d):this.$cpp_outdent.checkOutdent(a,b,d)};this.autoOutdent=function(a,b,d){return this.inRLanguageMode(a)?this.$r_outdent.autoOutdent(a,b,d,this.r_codeModel):this.$cpp_outdent.autoOutdent(a,b,d)};this.$transformAction=this.transformAction;this.transformAction=
function(a,b,d,c,e){a=r.primaryState(a);if(!this.inRLanguageMode(a))return this.$transformAction(a,b,d,c,e)};this.$id="mode/c_cpp"}).call(a.prototype);p.Mode=a});define("mode/c_cpp_fold_mode",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/range").Range;a=a("ace/mode/folding/fold_mode").FoldMode;p=p.FoldMode=function(){};k.inherits(p,a);(function(){function a(a,c,d,e){a=a.doc.$lines;for(var b=c+e,h=a[b],m=0<e?"*/":"/*",f;null!=h;){var l=h.indexOf(m);if(-1!==l){f=0<e?new g(c,d,b,l):new g(b,h.length,c,d);break}b+=e;h=a[b]}return f}function l(a,e,d,h,f){for(var b=e+f,c=a.doc.$lines;0<=b&&b<a.getLength();){for(var q=a.getTokens(b),
l=c[b],n=0;n<q.length;n++)if(q[n].type===h)return 0<f?new g(e,d,b,0):new g(b,l.length,e,d);b+=f}}var f=/(\{|\[)[^\}\]]*$/,e=/^[^\[\{]*(\}|\])/;this.getFoldWidget=function(a,c,d){c="markbeginend"===c?"end":"";d=a.getLine(d);if(f.test(d))return"start";if(e.test(d))return c;a=d.indexOf("/*");d=d.indexOf("*/");return-1!==a&&(-1===d||a>d)?"start":-1!==d&&(-1===a||d<a)?c:""};this.getFoldWidgetRange=function(b,c,d){var h=b.getLine(d),q;if(q=h.match(f))return this.openingBracketBlock(b,q[1],d,q.index);if(q=
"markbeginend"===c&&h.match(e))return this.closingBracketBlock(b,q[1],d,q.index+q[0].length);c=b.getTokens(d);for(q=0;q<c.length;q++){var g=c[q];if("support.function.codebegin"===g.type)return l(b,d,h.length,"support.function.codeend",1);if("support.function.codeend"===g.type)return l(b,d,0,"support.function.codebegin",-1)}c=h.indexOf("/*");if(-1!==c)return a(b,d,h.length,1);c=h.indexOf("*/");if(-1!==c)return a(b,d,c,-1)}}).call(p.prototype)});define("mode/c_cpp_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/lib/lang"),n=a("mode/doc_comment_highlight_rules").DocCommentHighlightRules,l=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/tex_highlight_rules").TexHighlightRules,e=a("mode/r_highlight_rules").RHighlightRules;a=function(){function a(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var c=g.arrayToMap("alignas alignof and and_eq asm auto bitand bitor bool break case catch char char16_t char32_t class compl const constexpr const_cast continue decltype default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int in long mutable namespace new noexcept not not_eq nullptr or or_eq private protected public register reinterpret_cast return short signed sizeof sizeof... static static_assert static_cast struct switch template this thread_local throw true try typedef typeid typeof typename union unsigned using virtual void volatile wchar_t while xor xor_eq".split(" ")),
d=g.arrayToMap(["NULL"]),h="new delete >>= <<= ->* ... << >> && || == != <= >= :: *= += -= /= ++ -- &= ^= %= -> .* ! $ & | + - * / ^ ~ = %".split(" "),q=h.map(function(b){return a(b)}).join("|");h=["->*"].concat(h).concat("< > , () [] ->".split(" ")).map(function(b){return a(b)});h=["new\\s*\\[\\]","delete\\s*\\[\\]"].concat(h);h="operator\\s*(?:"+h.join("|")+")|operator\\s+[\\w_]+(?:&&|&|\\*)?";this.$rules={start:[{token:"comment.doc.tag",regex:"\\/\\/\\s*\\[\\[.*\\]\\].*$"},{token:"comment",regex:"\\/\\/'",
next:"rd-start"},{token:"comment",regex:"\\/\\/.*$"},n.getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string",regex:'(?:R|L|u8|u|U)?["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:'(?:R|L|u8|u|U)?["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",merge:!0,regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"0[bB][01']+\\b"},
{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:(?:[fF])|(?:(?:[uU]?(?:(?:l?l?)|(?:L?L?))?)|(?:(?:(?:l?l?)|(?:L?L?))[uU]?))|(?:_\\w+))?\\b"},{token:"keyword.preproc",regex:"#\\s*include\\b",next:"include"},{token:"keyword.preproc",regex:"(?:"+"include pragma line define defined undef ifdef ifndef if else elif endif warning error".split(" ").map(function(a){return"#\\s*"+a+"\\b"}).join("|")+")"},{token:"variable.language",regex:"\\b__\\S+__\\b"},{token:"keyword",regex:h},
{token:function(a){return"this"==a?"variable.language":c.hasOwnProperty(a)?"keyword":d.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",merge:!1,regex:q},{token:"keyword.punctuation.operator",merge:!1,regex:"\\?|\\:|\\,|\\;|\\.|\\\\"},{token:"paren.keyword.operator",merge:!1,regex:"[[({<]"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}>]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},
{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",merge:!0,regex:".+"}],include:[{token:"string",regex:/<.+>/,next:"start"},{token:"string",regex:/".+"/,next:"start"}]};q=(new f("comment")).getRules();for(h=0;h<q.start.length;h++)q.start[h].token+=".virtual-comment";this.addRules(q,"rd-");this.$rules["rd-start"].unshift({token:"text",
regex:"^",next:"start"});this.$rules["rd-start"].unshift({token:"keyword",regex:"@(?!@)[^ ]*"});this.$rules["rd-start"].unshift({token:"comment",regex:"@@"});this.$rules["rd-start"].push({token:"comment",regex:"[^%\\\\[({\\])}]+"});this.embedRules(n,"doc-",[n.getEndRule("start")]);this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\\s*\\/\\*{3,}\\s*[Rr]\\s*$",next:"r-start"});q=(new e).getRules();this.addRules(q,"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",
regex:"\\*\\/",next:"start"})};k.inherits(a,l);p.c_cppHighlightRules=a});define("mode/c_cpp_matching_brace_outdent",["require","exports","module"],function(a,p,k){var g=a("ace/range").Range,n=a("mode/token_cursor").CppTokenCursor;k=function(a){this.codeModel=a};var l=a("mode/utils"),f=!0,e=!0,b=!0,c=!0,d=!0,h=!0,q=!0,r=!0,m=!0,v=!0,y=!0,A=!0;(function(){this.setIndent=function(a,b,d,e,c){a=a.getDocument();e="string"===typeof e?e:"";var m=a.$lines[d];d=this.$getIndent(a.$lines[b]);m=this.$getIndent(m);("function"!==typeof c||c(d,m))&&a.replace(new g(b,0,b,d.length),m+e)};
this.checkOutdent=function(a,b,d){return l.endsWith(a,"start")&&(":"===d||/^\s*[#\{\}>\]\)<.:]/.test(d)||"="===d)||l.endsWith(a,"comment")&&"/"==d?!0:!1};this.escapeRegExp=function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};this.alignStartToken=function(a,b,d,e,c){return null===c||null===e?!1:(new RegExp("^\\s*"+this.escapeRegExp(a))).test(e)&&(a=c.indexOf(a),0<=a)?(b=b.getDocument(),e=this.$getIndent(e),a=Array(a+1).join(" "),b.replace(new g(d,0,d,e.length),a),!0):!1};this.alignEquals=
function(a,b,d,e){if(null===e||null===d)return!1;var c=d.indexOf("=");if(c!==d.lastIndexOf("="))return!1;var m=e.indexOf("=");if(-1!==c&&-1!==m&&/,\s*$/.test(e)){a=a.getDocument();d=this.$getIndent(d);if(d.length>=m)return!1;c=m-c;if(0>=c)return!1;c=Array(d.length+c+1).join(" ");a.replace(new g(b,0,b,d.length),c);return!0}return!1};this.autoOutdent=function(a,l,r){a=l.doc;var w=a.getLine(r),z=null;0<r&&(z=a.getLine(r-1));this.$getIndent(w);if(!v||!this.alignStartToken("<<",l,r,w,z))if(!m||!this.alignStartToken(">>",
l,r,w,z))if(!q||!this.alignStartToken(".",l,r,w,z)){if(f&&/^\s*:/.test(a.getLine(r))&&!/^\s*::/.test(a.getLine(r))&&this.codeModel.$tokenUtils.$tokenizeUpToRow(r)){var k=new n(this.codeModel.$tokens,r,0),t=-1,B=k.cloneCursor();if(")"===B.peekBwd().currentValue()||"keyword"===B.peekBwd().currentType()){do{k=B.currentType();var F=B.currentValue();if("identifier"===k||";"===F){t=B.$row;break}"keyword"!==k&&B.bwdToMatchingToken()}while(B.moveToPreviousToken())}else k.moveToPreviousToken(),k.bwdOverClassySpecifiers()&&
(t=k.$row);0<=t&&this.setIndent(l,r,t,l.getTabString(),function(a,b){return a===b})}if(h&&/^\s*>/.test(w)&&!/^\s*>>/.test(w)&&(t=this.codeModel.getRowForMatchingEOLArrows(l,a,r),0<=t)){this.setIndent(l,r,t);return}if(c&&/^\s*\}/.test(w)&&(t=l.findMatchingBracket({row:r,column:w.indexOf("}")+1}),null!==t)){if(/^\s*\{/.test(a.$lines[t.row])){this.setIndent(l,r,t.row);return}t=this.codeModel.getRowForOpenBraceIndent(l,t.row);if(0<=t){this.setIndent(l,r,t);return}}if(e&&/^\s*\)/.exec(w)&&(t=l.findMatchingBracket({row:r,
column:w.indexOf(")")+1}))){this.setIndent(l,r,t.row);return}if(d&&/^\s*\]/.exec(w)&&(t=l.findMatchingBracket({row:r,column:w.indexOf("]")+1}))){this.setIndent(l,r,t.row);return}if(y&&/^\s*public\s*:\s*$|^\s*private\s*:\s*$|^\s*protected\s*:\s*$/.test(w)&&(B=l.$findOpeningBracket("}",{row:r,column:w.length},new RegExp(/paren\.keyword\.operator/)))){t=this.codeModel.getRowForOpenBraceIndent(l,B.row);0<=t?this.setIndent(l,r,t):this.setIndent(l,r,B.row);return}if(A&&(/^\s*case.+:/.test(w)||/^\s*default\s*:/.test(w))&&
(B=l.$findOpeningBracket("}",{row:r,column:/(\S)/.exec(w).index+1}))){t=this.codeModel.getRowForOpenBraceIndent(l,B.row);0<=t?this.setIndent(l,r,t):this.setIndent(l,r,B.row);return}if(b&&/^\s*\{/.test(w)&&!/;\s*$/.test(z)){if(this.codeModel.$tokenUtils.$tokenizeUpToRow(r)&&(k=new n(this.codeModel.$tokens),k.$row=r,k.$offset=0,k.moveToPreviousToken()&&"="===k.currentValue()))return;z=this.codeModel.getRowForOpenBraceIndent(l,r);if(0<=z){this.setIndent(l,r,z);return}}/^\s*#/.test(w)&&(l=this.$getIndent(w),
a.replace(new g(r,0,r,l.length),""))}};this.$getIndent=function(a){return(a=a.match(/^(\s+)/))?a[1]:""}}).call(k.prototype);p.CppMatchingBraceOutdent=k;p.getOutdentColon=function(){return f};p.setOutdentColon=function(a){f=a};p.getOutdentRightParen=function(){return e};p.setOutdentRightParen=function(a){e=a};p.getOutdentLeftBrace=function(){return b};p.setOutdentLeftBrace=function(a){b=a};p.getOutdentRightBrace=function(){return c};p.setOutdentRightBrace=function(a){c=a};p.getOutdentRightBracket=
function(){return d};p.setOutdentRightBracket=function(a){d=a};p.getOutdentRightArrow=function(){return h};p.setOutdentRightArrow=function(a){h=a};p.getAlignDots=function(){return q};p.setAlignDots=function(a){q=a};p.getAlignEquals=function(){return r};p.setAlignEquals=function(a){r=a};p.getAlignStreamIn=function(){return m};p.setAlignStreamIn=function(a){m=a};p.getAlignStreamOut=function(){return v};p.setAlignStreamOut=function(a){v=a};p.getAlignClassAccessModifiers=function(){return y};p.setAlignClassAccessModifiers=
function(a){y=a};p.getAlignCase=function(){return A};p.setAlignCase=function(a){A=a}});define("mode/behaviour/cstyle",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/behaviour").Behaviour;a("mode/cpp_code_model");a("mode/token_cursor");a("ace/mode/text");var n=a("mode/utils"),l=!0;a=function(a){var e=a.$complements,b=function(a,b,c,f){var d=e[a];if(b==a)return b=c.getSelectionRange(),f=f.doc.getTextRange(b),""!==f?{text:a+f+d,selection:!1}:{text:a+d,selection:[1,1]};if(b==d&&(a=c.getCursorPosition(),f.doc.getLine(a.row)[a.column]==d&&(">"===d||null!==
f.findMatchingBracket({row:a.row,column:a.column+1}))))return{text:"",selection:[1,1]}},c=function(a,b,c){var d=e[a],m=c.doc.getTextRange(b);if(!b.isMultiLine()&&m==a&&c.doc.getLine(b.start.row).substring(b.start.column+1,b.start.column+2)==d)return b.end.column++,b};this.add("R","insertion",function(a,b,e,c,m){if("R"===m||"r"===m)if(a=e.getCursorPosition(),c=(new String(c.doc.getLine(a.row))).match(/^(\s*)\/\*{3,}\s*/))return{text:"R\n"+c[1]+"\n"+c[1]+"*/",selection:[1,c[1].length,1,c[1].length]}});
this.add("newline","insertion",function(b,c,e,f,m){if("\n"===m){m=e.selection.getCursor().row;var d=e.selection.getCursor().column;c=f.getTabString();var h=e.getCursorPosition();e=f.doc.getLine(h.row);if(!this.codeModel.inMacro(f.getDocument().$lines,m-1)){var l=/^(\s*\/\/'\s*)/.exec(e);if(l&&d>=l[1].length)return{text:"\n"+l[1]};if(/^\s*\/\*/.test(e)&&(-1!==e.indexOf("*/")||!/^\s*\*/.test(f.getLine(m+1))))return f=this.$getIndent(e),c=f+" * ",{text:"\n"+c+"\n"+f+" */",selection:[1,c.length,1,c.length]};
if(n.endsWith(b,"comment")||n.endsWith(b,"doc-start")){h&&h.row==m&&(e=e.substring(0,h.column));if(b=/^(\s*)(\/\*)/.exec(e))return{text:"\n"+b[1]+" * "};if(b=/^(\s*\*+\s*)/.exec(e))return{text:"\n"+b[1],selection:[1,b[1].length,1,b[1].length]}}for(b=d-1;/\s/.test(e[b]);)--b;b=e[b];d=e[d];if(l=e.match(/\s*namespace\s*\w*\s*{/))return f=this.$getIndent(e),{text:"\n"+f,selection:[1,f.length,1,f.length]};if("("==b&&")"==d||"["==b&&"]"==d)return m=this.$getIndent(e),f=m+c,{text:"\n"+f+"\n"+m,selection:[1,
f.length,1,f.length]};if("{"==b&&"}"==d){if(/^\s*{/.test(e))return m=this.$getIndent(e),f=m+f.getTabString(),{text:"\n"+f+"\n"+m,selection:[1,f.length,1,f.length]};m=a.getRowForOpenBraceIndent(f,m);if(null!==m&&0<=m)return m=this.$getIndent(f.getDocument().getLine(m)),f=m+f.getTabString(),{text:"\n"+f+"\n"+m,selection:[1,f.length,1,f.length]};m=this.$getIndent(e);f=m+c;return{text:"\n"+f+"\n"+m,selection:[1,f.length,1,f.length]}}}}});this.add("braces","insertion",function(a,e,c,f,m){if(this.insertMatching){if("{"==
m&&(a=c.getSelectionRange(),""===f.doc.getTextRange(a))){a=this.codeModel.getTokenCursor();if(!a.moveToPosition(c.getCursorPosition()))return b("{",m,c,f);do if(!a.bwdToMatchingArrow()){e=a.currentValue();if(!e||!e.length)break;if("namespace"===e)return{text:"{",selection:[1,1]};if("class"===e||"struct"===e||"="===e)return{text:"{};",selection:[1,1]};if(l&&"do"===e)return{text:"{} while ();",selection:[1,1]};if(";"===e||"["===e||"]"===e||"("===e||")"===e||"{"===e||"}"===e||"if"===e||"else"===e||"#"===
e[0])return{text:"{}",selection:[1,1]}}while(a.moveToPreviousToken())}return b("{",m,c,f)}});this.add("braces","deletion",function(a,b,e,c,m){if(this.insertMatching&&(a=c.doc.getTextRange(m),!m.isMultiLine()&&"{"==a)){a=c.doc.getLine(m.start.row);if(/^\s*do\s*\{\} while \(\);\s*$/.test(a))return m.end.column=a.length,m;c=a.substring(m.end.column,m.end.column+1);a=a.substring(m.end.column+1,m.end.column+2);if("}"==c)return m.end.column++,";"==a&&m.end.column++,m}});this.add("parens","insertion",function(a,
e,c,f,m){if(this.insertMatching)return b("(",m,c,f)});this.add("parens","deletion",function(a,b,e,f,m){if(this.insertMatching)return c("(",m,f)});this.add("brackets","insertion",function(a,e,c,f,m){if(this.insertMatching)return b("[",m,c,f)});this.add("brackets","deletion",function(a,b,e,f,m){if(this.insertMatching)return c("[",m,f)});this.add("arrows","insertion",function(a,e,c,f,m){if(this.insertMatching&&(a=f.getLine(c.getCursorPosition().row),/^\s*#\s*include/.test(a)))return b("<",m,c,f)});this.add("arrows",
"deletion",function(a,b,e,f,m){if(this.insertMatching)return c("<",m,f)});this.add("string_dquotes","insertion",function(a,b,e,c,m){if(this.insertMatching&&('"'==m||"'"==m)){a=e.getSelectionRange();b=c.doc.getTextRange(a);if(""!==b)return{text:m+b+m,selection:!1};e=e.getCursorPosition();b=c.doc.getLine(e.row);if("\\"==b.substring(e.column-1,e.column))return null;c=c.getTokens(a.start.row);for(var d=0,f,l=-1,h=0;h<c.length;h++){f=c[h];"string"==f.type?l=-1:0>l&&(l=f.value.indexOf(m));if(f.value.length+
d>a.start.column)break;d+=c[h].value.length}if(!f||0>l&&"comment"!==f.type&&("string"!==f.type||a.start.column!==f.value.length+d-1&&f.value.lastIndexOf(m)===f.value.length-1))return{text:m+m,selection:[1,1]};if(f&&"string"===f.type&&b.substring(e.column,e.column+1)==m)return{text:"",selection:[1,1]}}});this.add("string_dquotes","deletion",function(a,b,e,c,f){if(this.insertMatching&&(a=c.doc.getTextRange(f),!f.isMultiLine()&&('"'==a||"'"==a)&&(c=c.doc.getLine(f.start.row).substring(f.start.column+
1,f.start.column+2),'"'===c||"'"===c)))return f.end.column++,f});this.add("punctuation.operator","insertion",function(a,b,e,c,f){if(this.insertMatching&&";"===f&&(a=e.selection.getCursor(),";"==c.getLine(a.row)[a.column]))return{text:"",selection:[1,1]}});this.add("macro","insertion",function(a,b,e,c,f){b=e.getPrintMarginColumn();b=Math.min(62,b);var d=c.getDocument().$lines,m=e.getCursorPosition(),l=m.row,h=d[l];e=h.substring(0,m.column);if(/^\s*#\s*define[^\\]*$/.test(h)&&"\\"==f)return a=b-e.length+
1,0<=a?{text:Array(a+1).join(" ")+"\\\n"+this.$getIndent(h)+c.getTabString(),selection:!1}:{text:"\\\n"+c.getTabString(),selection:!1};if(/^\s*#\s*define/.test(h)||this.codeModel.inMacro(d,l-1)){if("\\"==f&&/^\s*$/.test(h.substring(e.length,h.length)))return a=b-e.length+1,0<=a?{text:Array(a+1).join(" ")+"\\",selection:!1}:{text:"\\",selection:!1};if("\n"==f){if(/^\s*$/.test(h)||/^\s*#\s*define/.test(h)&&!/\\\s*$/.test(h))return{text:"\n",selection:!1};if(/\\\s*$/.test(h)&&!/\\\s*$/.test(e))return{text:"",
selection:[1,m.column,1,m.column]};c=c.getMode().getNextLineIndent(a,h+"\\",c.getTabString(),l,!1);a=b-e.length+1;f=/\\\s*$/.test(e)?"":"\\";return 0<=a?{text:Array(a+1).join(" ")+f+"\n"+c,selection:!1}:{text:f+"\n"+c,selection:!1}}}})};k.inherits(a,g);p.CStyleBehaviour=a;p.setFillinDoWhile=function(a){l=a};p.getFillinDoWhile=function(){return l}});define("mode/cpp_code_model",["require","exports","module"],function(a,p,k){a("ace/lib/oop");var g=a("ace/range").Range,n=a("mode/token_utils").TokenUtils;a("ace/token_iterator");var l=a("mode/token_cursor").CppTokenCursor,f=a("mode/cpp_scope_tree").CppScopeNode,e=a("mode/cpp_scope_tree").CppScopeManager,b=a("mode/r_code_model").getVerticallyAlignFunctionArgs,c=a("mode/utils");a=function(a,b,c,l,m){this.$session=a;this.$doc=a.getDocument();this.$tokenizer=b;this.$tokens=Array(this.$doc.getLength());
this.$statePattern=c;this.$codeBeginPattern=l;this.$codeEndPattern=m;this.$tokenUtils=new n(this.$doc,this.$tokenizer,this.$tokens,this.$statePattern,this.$codeBeginPattern);this.$scopes=new e(f);var d=!0,h=function(a,b){d?d=!1:(this.$doc.off("change",g),this.$session.off("changeMode",h))}.bind(this),g=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",h);this.$doc.on("change",g)};(function(){var a=c.contains;this.getTokenCursor=function(){return new l(this.$tokens,0,0,this)};
this.$tokenizeUpToRow=function(a){this.$tokenUtils.$tokenizeUpToRow(a)};var e=function(b,e){for(;;){var c=b.currentValue(),d=e.$doc.getLine(b.$row);if(a(["{","}",";"],c))break;if(":"===c&&(c=b.peekBwd().currentValue(),a(["public","private","protected"],c)))break;if(/^\s*#/.test(d))break;if(!b.moveToPreviousToken())break}},f="if else for do while struct class try catch switch".split(" "),n=function(a){a=a.trim();return a=a.replace(/[\n\s]+/g," ")},m=function(a,b){var e=n(a),c=b;"undefined"===typeof c&&
(c=80);e.length>c&&(e=e.substring(0,c)+"...");return e};this.$complements={"<":">",">":"<","{":"}","}":"{","[":"]","]":"[","(":")",")":"(","'":"'",'"':'"'};this.alignContinuationSlashes=function(a,b){"undefined"===typeof b&&(b={start:0,end:a.getLength()});var e=a.$lines;if(!(e instanceof Array))return!1;for(var c=b.start;c<b.end;c++)if(y.test(e[c])){var d=c;for(c+=1;y.test(e[c])&&c<=b.end;)c++;for(var f=c,m=e.slice(d,f).map(function(a){return a.lastIndexOf("\\")}),l=Math.max.apply(null,m),h=0;h<f-
d;h++){var g={row:d+h,column:m[h]},n=Array(l-m[h]+1).join(" ");a.insert(g,n)}}return!0};this.allIndicesOf=function(a,b){for(var e=[],c=0;c<a.length;c++)a[c]==b&&e.push(c);return e};this.getRowForMatchingEOLArrows=function(a,b,e){a=0;for(var c,d=1;100>d;d++){c=this.getLineSansComments(b,e-d);if(/;\s*$/.test(c))break;if(/<\s*$/.test(c)&&!/<<\s*$/.test(c)){if(0===a)return e-d;a--}else/^\s*>/.test(c)&&!/^\s*>>/.test(c)&&a++}return-1};var k=/^\s*#\s*define/,y=/\\\s*$/,p=/^\s*[+\-/&^%$!<>.?|=~]|^\s*\*[^/]|^\s*\/[^\*]/,
D=/[+\-*&^%$!<>.?|=~]\s*$|\*[^/]\s*$|\/[^\*]\s*$/,I=function(a){return p.test(a)||D.test(a)};this.inMacro=function(a,b){var e=a[b];return 0>b?!1:y.test(e)?k.test(e)?!0:this.inMacro(a,b-1):!1};this.$buildScopeTreeUpToRow=function(a){a=Math.min(a+30,this.$doc.getLength()-1);this.$tokenUtils.$tokenizeUpToRow(a);var b=this.getTokenCursor();if(b.seekToNearestToken(this.$scopes.parsePos,a)){do{this.$scopes.parsePos=b.currentPosition();this.$scopes.parsePos.column+=b.currentValue().length;var c=b.currentToken().type;
if(/\bsectionhead\b/.test(c)){if(c=/^\/\/'?[-=#\s]*(.*?)\s*[-=#]+\s*$/.exec(b.currentValue()))c=""+c[1],0==c.length&&(c="(Untitled)"),50<c.length&&(c=c.substring(0,50)+"..."),this.$scopes.onSectionStart(c,b.currentPosition())}else if(/\bcodebegin\b/.test(c)){c=b.currentPosition();var d={row:c.row+1,column:0};this.$scopes.getTopLevelScopeCount();this.$scopes.onChunkStart("(R Code Chunk)","(R Code Chunk)",c,d)}else if(/\bcodeend\b/.test(c)){for(c=b.currentPosition();this.$scopes.onScopeEnd(c););c.column+=
b.currentValue().length;this.$scopes.onChunkEnd(c)}else if("{"===b.currentValue())if(c=b.cloneCursor(),d=c.currentPosition(),c.isFirstSignificantTokenOnLine()&&(d.column=0),"namespace"===c.peekBwd(2).currentValue())c.moveToPreviousToken(),d=c.currentValue(),this.$scopes.onNamespaceScopeStart("namespace "+d,c.currentPosition(),b.currentPosition(),d);else if("namespace"===c.peekBwd().currentValue())this.$scopes.onNamespaceScopeStart("anonymous namespace",d,b.currentPosition(),"<anonymous>");else if("class"===
c.peekBwd(2).currentValue()||"struct"===c.peekBwd(2).currentValue()||c.bwdOverClassInheritance()){c.moveToPreviousToken();var f=c.cloneCursor();e(f,this);f=f.peekFwd().currentPosition();d=this.$session.getTextRange(new g(f.row,f.column,d.row,d.column));d=n(d);this.$scopes.onClassScopeStart(d,c.currentPosition(),b.currentPosition(),d)}else if(c.bwdOverConstNoexceptDecltype()&&c.bwdOverInitializationList()&&c.moveBackwardOverMatchingParens()||c.moveBackwardOverMatchingParens())if("identifier"===c.peekBwd().currentType()||
"]"===c.peekBwd().currentValue()||/^operator/.test(c.peekBwd().currentValue()))if("]"===c.peekBwd().currentValue())c=c.currentPosition(),c=this.$session.getTextRange(new g(c.row,c.column,d.row,d.column-1)),c=n("lambda "+c),this.$scopes.onLambdaScopeStart(c,d,b.currentPosition());else{if(c.moveToPreviousToken()){var l="";d=c.currentValue();f="";var h=this.$scopes.getActiveScopes(c.currentPosition());null!=h&&(h=h[h.length-1],h.isClass()&&h.label==="class "+d?"~"===c.peekBwd().currentValue()&&(d="~"+
d):(l=c.cloneCursor(),e(l,this),l.moveToNextToken(),l=l.currentPosition(),h=c.currentPosition(),l=this.$session.getTextRange(new g(l.row,l.column,h.row,h.column))));var q=c.peekFwd();h=q.currentPosition();q.fwdToMatchingToken()&&("const"===q.peekFwd().currentValue()&&q.moveToNextToken(),"noexcept"===q.peekFwd().currentValue()&&q.moveToNextToken(),"noexcept"===q.currentValue()&&"("===q.peekFwd().currentValue()&&(q.moveToNextToken(),q.fwdToMatchingToken()),(q=q.peekFwd().currentPosition())&&(f=this.$session.getTextRange(new g(h.row,
h.column,q.row,q.column))));l=0<l.length?m(d.trim()+f.trim()+": "+l.trim()):m(d.trim()+f.trim());this.$scopes.onFunctionScopeStart(l,c.currentPosition(),b.currentPosition(),d.trim(),f.split(","))}}else this.$scopes.onScopeStart(d);else this.$scopes.onScopeStart(d);else"}"===b.currentValue()&&(c=b.currentPosition(),b.isLastSignificantTokenOnLine()?c.column=this.$doc.getLine(c.row).length+1:c.column++,this.$scopes.onScopeEnd(c))}while(b.moveToNextToken(a))}};this.getCurrentScope=function(a,b){b||(b=
function(a){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);var c=this.$scopes.getActiveScopes(a);if(c)for(var e=c.length-1;0<=e;e--)if(b(c[e]))return c[e];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.getScopeList()};this.getRowForOpenBraceIndent=function(b,c,e){if(1>=b.getDocument().$lines.length)return-1;if(this.$tokenUtils.$tokenizeUpToRow(c))try{for(var d=Array(this.$tokens.length),m=0;m<this.$tokens.length;m++)if(null!=
this.$tokens[m]&&0<this.$tokens[m].length){var l=this.$tokens[m];"\\"===l[l.length-1].value&&(d[m]=this.$tokens[m].splice(l.length-1,1)[0])}var h=this.getTokenCursor();if(e){var g=b.getSelection().getCursor();if(!h.moveToPosition(g))return 0}else for(h.$row=c,m=h.$tokens[c].length-1,m=h.$tokens[c].length-1;0<=m&&(h.$offset=m,"{"!==h.currentValue());m--);if("{"===h.peekBwd().currentValue()||";"===h.currentValue())return-1;h.bwdOverInitializationList();h.bwdOverClassInheritance();if("{"===h.currentValue()&&
!h.moveToPreviousToken()||"{"===h.currentValue())return-1;for(;"keyword"===h.currentType();){var q=h.currentValue();if(a(f,q)||0===h.$row&&0===h.$offset)return h.$row;if(!h.moveToPreviousToken())return-1}if(":"===h.currentValue()){var n=h.peekBwd().currentValue();if(a(["public","private","protected"],n))return h.moveToNextToken(),h.$row}if(":"===h.currentValue())for(;h.moveToPreviousToken();){if(h.bwdToMatchingToken())if("keyword"===h.peekBwd().currentType())continue;else break;if("identifier"===
h.currentType())break}if(")"===h.currentValue()&&!h.bwdToMatchingToken()||"("===h.currentValue()&&!h.moveToPreviousToken())return-1;"="===h.currentValue()&&h.moveToPreviousToken();return h.$row}finally{for(m=0;m<d.length;m++)"undefined"!==typeof d[m]&&this.$tokens[m].push(d[m])}return-1};this.getLineSansComments=function(a,b,c){if(0>b)return"";a=a.getLine(b);var e=/(?!\\)"/g,d=a,f;for(b=[];f=e.exec(d);)b.push(f.index);if(0<b.length&&0===b.length%2)for(e=0;e<b.length/2;e+=2)d=b[e+1],a=a.substring(0,
b[e]+1)+a.substring(d,a.length);b=a.indexOf("//");-1!=b&&(a=a.substring(0,b));y.test(a)&&(a=a.substring(0,a.lastIndexOf("\\")));c&&(a=a.replace(/\bconst\b/,"").replace(/\bnoexcept\b/,""));return a};this.findStartOfCommentBlock=function(a,b,c){for(var e=0,d=/^\s*\/+\*/;0<=b&&e<c;){if(d.test(a[b]))return b;--b;++e}return-1};this.getNextLineIndent=function(e,d,f,m,h){var l=b(),t=this.$session,g=t.getTabSize(),q=t.getDocument();"number"!==typeof m&&(m=t.getSelection().getCursor().row-1);if(-1===m)return d=
q.getLine(0),0<d.length?this.$getIndent(d):"";if(0===d.length||/^\s*#/.test(d))return this.getNextLineIndent(c.getPrimaryState(t,m-1),q.getLine(m-1),f,m-1,h);var n=this.$getIndent(d),v=this.$getUnindent(d,g),r=q.$lines;if(c.endsWith(e,"comment")||c.endsWith(e,"doc-start")){p&&p.row==m&&(d=d.substring(0,p.column));if(/^\s*$/.test(d))return this.$getIndent(r[m]);p=this.findStartOfCommentBlock(r,m,200);if(null!==p)return this.$getIndent(r[p])+" "}if(c.endsWith(e,"start")){if(k.test(d))return/\\\s*$/.test(d)?
n+f:n;if(/^\s*#\s*\S/.test(d))return n;if(this.inMacro(r,m-1)&&!y.test(d))return v;d=this.getLineSansComments(q,m);var p=t.getSelection().getCursor();p&&p.row==m&&!h&&(d=d.substring(0,p.column));e=this.getLineSansComments(q,m-1);if("string"!==typeof d)return"";if(0===d.length||/^\s*$/.test(d))return this.$getIndent(r[m]);if(/\*\/\s*$/.test(d)&&(v=this.findStartOfCommentBlock(r,m,200),0<=v))return this.$getIndent(r[v]);if(/^\s*<</.test(d)){for(d=m-1;/^\s*<</.test(r[d]);)d--;return this.$getIndent(r[d])}if(/^\s*\./.test(d)){for(d=
m-1;/^\s*\./.test(r[d]);)d--;return this.$getIndent(r[d])}if(/\bnamespace\b.*\{\s*$/.test(d)||/\bswitch\b.*\{\s*$/.test(d))return n;if(d.match(/\(\s*$/))return-1!==d.indexOf("=")||/^\s*(return\s+)?[a-zA-Z0-9_.->:]+\(\s*$/.test(d)?n+f:n+f+f;if(/^\s*(class|struct).*\{\s*$/.test(d)||/^\s*(class|struct)\s+.+:\s*$/.test(d))return n+f;if((v=d.match(/(^\s*(?:class|struct)\s+.*\w[^:]):[^:]\s*.+/))&&!/,\s*/.test(d)||(v=d.match(/^(\s*(class|struct).*:\s*).*,\s*$/))||(v=d.match(/^(\s*:\s*)(\w+).*,\s*$/))||(v=
d.match(/^(\s*)[:,]\s*[\w\s]*$/)))return l?Array(v[1].length+1).join(" "):n+f;if(/<\s*$/.test(d))return n+f;if(/^\s*".*"\s*$/.test(d)||/^\s*template\s*<.*>\s*$/.test(d)&&d.split(">").length==d.split("<").length)return n;if(/([\[\{\(<]).+,\s*$/.exec(d)){var A=["(","{","[","<"];for(v=0;v<A.length;v++){var D=A[v],E=this.$complements[D];D=this.allIndicesOf(d,D);if(D.length&&(E=this.allIndicesOf(d,E),E=D.length-E.length-1,!(0>E)))return r=D[E],l?(d=d.substr(r+1).match(/([^\s])/),Array(r+d.index+2).join(" ")):
n+f}}for(v=m-1;0<=v&&/^\s*$|^\s*#/.test(e);)e=this.getLineSansComments(q,v),v--;if(I(d)&&I(e))return this.$getIndent(d);if(this.$tokenUtils.$tokenizeUpToRow(m+2)){A=Array(this.$tokens.length);try{for(v=0;v<this.$tokens.length;v++)if(null!=this.$tokens[v]&&0<this.$tokens[v].length){var w=this.$tokens[v];"\\"===w[w.length-1].value&&(A[v]=this.$tokens[v].splice(w.length-1,1)[0])}var u=this.getTokenCursor();h?(u.$row=m,u.$offset=this.$tokens[m].length-1):u.moveToPosition(p);for(;0>u.$offset&&0<u.$row;)u.$row--,
u.$offset=u.$tokens[u.$row].length-1;for(;0<u.$row&&/^\s*#/.test(q.getLine(u.$row));)u.$row--,u.$offset=u.$tokens[u.$row].length-1;h="";var z=u.cloneCursor(),C=z.currentValue(),J=z.currentType();if("constant"===J||"keyword"===J||"identifier"===J||a(["{",")",">",":"],C))h=f;for(;";"===u.currentValue()&&u.moveToPreviousToken(););var L=u.cloneCursor();if(l&&u.isLastSignificantTokenOnLine()&&("keyword.operator"===u.currentType()||"punctuation.operator"===u.currentType())){var O=u.cloneCursor();O.$offset=
0;if("keyword"===O.currentType()){var M=d.split("(").length-d.split(")").length;if(0<M){var K=d.match(/.*?\(\s*(\S)/);if(K)return Array(K[0].length).join(" ")}}}if(","===u.currentValue()){if(l){var G=u.peekBwd();if("]"===G.currentValue()&&G.bwdToMatchingToken())return Array(G.currentPosition().column+1).join(" ");M=d.split("(").length-d.split(")").length;if(0<M&&(K=d.match(/.*?\(\s*(\S)/)))return Array(K[0].length).join(" ")}if(/[,(]\s*$/.test(d)&&/[,(]\s*$/.test(e))return this.$getIndent(d);var x=
u.cloneCursor();return x.findOpeningBracket("{",!1)&&x.bwdOverClassySpecifiers()&&"enum"===x.currentValue()?this.$getIndent(r[x.$row])+f:-1!==d.indexOf("=")?this.$getIndent(d)+f:this.$getIndent(d)}if("keyword.operator"===J&&":"!==C)return this.$getIndent(r[m])+f;for(;;){if("undefined"===typeof u.currentValue())return"undefined"!==typeof L.currentValue()?this.$getIndent(r[L.$row])+h:h;L=u.cloneCursor();if(";"===u.currentValue()&&u.moveToNextToken()){for(m=u.$row;null!=r[m]&&/^\s*#/.test(r[m]);)++m;
return this.$getIndent(r[m])+h}if(a(["for","while","do","try"],u.currentValue())&&";"!==C)return this.$getIndent(r[u.$row])+h;G=u.peekBwd();if(":"===u.currentValue()){if(a(["public","private","protected"],G.currentValue()))return this.$getIndent(r[G.$row])+f;var H=r[u.$row];if(/^\s*case/.test(H))return this.$getIndent(H)+f;if(")"===G.currentValue()&&(x=G.cloneCursor(),x.bwdToMatchingToken())){var P=x.peekBwd(1),Q=x.peekBwd(2);if(null!==P&&"identifier"===P.currentType()&&null!==Q&&!/\boperator\b/.test(Q.currentType()))return this.$getIndent(r[x.peekBwd().$row])+
h}}if("]"===u.currentValue()&&"("===u.peekFwd().currentValue()&&(x=u.cloneCursor(),x.bwdToMatchingToken()))return this.$getIndent(r[x.$row])+h;if("("===u.currentValue()&&"for"===G.currentValue()&&";"===C)return u.peekFwd().cloneCursor(),l?Array(u.peekFwd().currentPosition().column+1).join(" "):this.$getIndent(r[u.peekFwd().$row])+f;if(l&&"("===u.currentValue()&&!u.isLastSignificantTokenOnLine())return u.moveToNextToken(),Array(u.currentPosition().column+1+g).join(" ");if("if"===u.currentValue()||
"else"===u.currentValue()||"template"===u.currentValue()&&"<"===u.peekFwd().currentValue())return this.$getIndent(r[u.$row])+h;if("{"===u.currentValue()){var R=this.getRowForOpenBraceIndent(t,u.$row);return 0<=R?(d=this.getLineSansComments(q,R),n=this.$getIndent(d),/\bnamespace\b/.test(d)?n:n+f):this.$getIndent(r[u.$row])+f}if(0===u.$row&&0===u.$offset)return this.$getIndent(r[0])+h;if(">"===u.currentValue()&&(x=u.cloneCursor(),x.bwdToMatchingArrow()&&"template"===x.peekBwd().currentValue()))return">"===
C&&(h=""),this.$getIndent(r[x.$row])+h;u.bwdToMatchingToken();if(!u.moveToPreviousToken())break;for(;0<u.$row&&/^\s*#/.test(r[u.$row]);)u.$row--,u.$offset=this.$tokens[u.$row].length-1}}finally{for(v=0;v<A.length;v++)"undefined"!==typeof A[v]&&this.$tokens[v].push(A[v])}}}return n};this.$onDocChange=function(a){"insert"===a.action?this.$tokenUtils.$insertNewRows(a.start.row,a.end.row-a.start.row):this.$tokenUtils.$removeRows(a.start.row,a.end.row-a.start.row);this.$tokenUtils.$invalidateRow(a.start.row);
this.$scopes.invalidateFrom(a.start)};this.$getIndent=function(a){return(a=/^([ \t]*)/.exec(a))?a[1]:""};this.$padIndent=function(a,b,c){b=Array(b+1).join(" ");b=a.replace("\t",b);return b>=c?a:a+Array(c-b+1).join(" ")};this.$getUnindent=function(a,b){var c=this.$getIndent(a);if(null===c||0===c.length)return"";var d=c.indexOf("\t");if(-1!=d)return c.substring(0,d)+c.substring(d+1,c.length);for(var e=d=0;e<b&&e<c.length;e++)" "===c[e]&&d++;return c.substring(d,c.length)}}).call(a.prototype);p.CppCodeModel=
a});define("mode/cpp_scope_tree",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("mode/r_scope_tree");a=g.ScopeManager;var n=g.ScopeNode,l=function(a,e,b,c,d,h){this.label=a;this.start=e;this.preamble=b||e;this.end=null;this.scopeType=c;this.scopeCategory=d;this.attributes=h||{};this.parentScope=null;this.$children=[]};k.mixin(l.prototype,n.prototype);l.CATEGORY_CLASS=1;l.CATEGORY_NAMESPACE=2;l.CATEGORY_FUNCTION=3;l.CATEGORY_LAMBDA=4;l.CATEGORY_ANON=5;(function(){this.isClass=
function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==l.CATEGORY_CLASS};this.isNamespace=function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==l.CATEGORY_NAMESPACE};this.isFunction=function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==l.CATEGORY_FUNCTION};this.isLambda=function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==l.CATEGORY_LAMBDA}}).call(l.prototype);g=function(a){this.$ScopeNodeFactory=a;this.parsePos={row:0,column:0};this.$root=new a("(Top Level)",
this.parsePos,null,n.TYPE_ROOT)};k.mixin(g.prototype,a.prototype);(function(){this.onClassScopeStart=function(a,e,b,c){a=new this.$ScopeNodeFactory(a,b,e,n.TYPE_BRACE,l.CATEGORY_CLASS,{name:c});this.$root.addNode(a);this.printScopeTree()};this.onNamespaceScopeStart=function(a,e,b,c){a=new this.$ScopeNodeFactory(a,b,e,n.TYPE_BRACE,l.CATEGORY_NAMESPACE,{name:c});this.$root.addNode(a);this.printScopeTree()};this.onFunctionScopeStart=function(a,e,b,c,d){a=new this.$ScopeNodeFactory(a,b,e,n.TYPE_BRACE,
l.CATEGORY_FUNCTION,{name:c,args:d});this.$root.addNode(a);this.printScopeTree()};this.onLambdaScopeStart=function(a,e,b,c){a=new this.$ScopeNodeFactory(a,b,e,n.TYPE_BRACE,l.CATEGORY_LAMBDA,{args:c});this.$root.addNode(a);this.printScopeTree()};this.onScopeStart=function(a){this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,n.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){a=this.$root.closeScope(a,n.TYPE_BRACE);this.printScopeTree();return a}}).call(g.prototype);p.CppScopeManager=
g;p.CppScopeNode=l});define("mode/dcf",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("mode/dcf_highlight_rules").DcfHighlightRules;a=function(){this.$tokenizer=new n((new l).getRules())};k.inherits(a,g);(function(){this.getNextLineIndent=function(a,e,b){return this.$getIndent(e)}}).call(a.prototype);p.Mode=a});define("mode/dcf_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:["keyword","text"],regex:"^([\\w@-]+)(\\:)"},{token:"text",regex:".+"}]}};k.inherits(g,a);p.DcfHighlightRules=g});define("mode/doc_comment_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"[@\\\\][\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\\\\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};k.inherits(g,a);g.getStartRule=function(a){return{token:"comment.doc",
merge:!0,regex:"\\/\\*[\\*\\!]",next:a}};g.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}};p.DocCommentHighlightRules=g});define("util/expand_selection",["require","exports","module"],function(a,p,k){p=a("ace/editor").Editor;var g=a("ace/range").Range;a("ace/keyboard/vim");var n=a("ace/token_iterator").TokenIterator,l=a("mode/utils");(function(){function a(a,b){for(var c=a.session.getTokens(b),d=0;d<c.length;d++){var e=c[d];if(!/^\s*$/.test(e.value))return/\bcomment\b/.test(e.type)}return!1}function e(a,b){var c=a.start.row<b.start.row||a.start.row===b.start.row&&a.start.column<b.start.column,d=a.start.row===b.start.row&&
a.start.column===b.start.column,e=a.end.row>b.end.row||a.end.row===b.end.row&&a.end.column>b.end.column,f=a.end.row===b.end.row&&a.end.column===b.end.column;return c?e||f:e?c||d:!1}function b(a,b){for(var c=a.getCurrentToken(),d=a.getCurrentTokenRow();a.moveToPreviousSignificantToken();){var e=a.getCurrentToken();if(d!==a.getCurrentTokenRow()&&0!==e.type.indexOf("keyword.operator")){if(!a.moveToNextSignificantToken())return!1;break}if(h.test(c.value)&&(h.test(e.value)||l.isOpeningBracket(e.value)||
l.contains(b,e.value))){if(!a.moveToNextSignificantToken())return!1;break}a.bwdToMatchingToken();c=a.getCurrentToken();d=a.getCurrentTokenRow()}return!0}function c(a,b,c){r.push({name:a,immediate:b,execute:c})}var d=this,h=/['"\w.]/,q=!1;this.$onClearSelectionHistory=function(){return d.$clearSelectionHistory()};this.$clearSelectionHistory=function(){this.$selectionRangeHistory=null;this.off("change",this.$clearSelectionHistory)};this.$acceptSelection=function(a,b,c){null==this.$selectionRangeHistory&&
(this.$selectionRangeHistory=[]);a.setSelectionRange(b);a.getRange().isEqual(c)||this.$selectionRangeHistory.push(c);this.isRowFullyVisible(b.start.row)&&this.isRowFullyVisible(b.end.row)||this.centerSelection(a);return b};var r=[];c("string",!0,function(a,b,c,d){return(a=b.getTokenAt(d.start.row,d.start.column+1))&&/\bstring\b/.test(a.type)?new g(d.start.row,a.column+1,d.start.row,a.column+a.value.length-1):null});c("token",!0,function(a,b,c,d){return(a=b.getTokenAt(d.start.row,d.start.column+1))&&
/[\d\w]/.test(a.value)?new g(d.start.row,a.column,d.start.row,a.column+a.value.length):null});c("comment",!0,function(b,c,d,e){c=e.start.row;e=e.end.row;for(d=c;d<=e;d++)if(!a(b,d))return null;for(;a(b,c);)c--;for(;a(b,e);)e++;b=b.getSession().getLine(e-1).length;return new g(c+1,0,e-1,b)});c("includeBoundaries",!0,function(a,b,c,d){a=new n(b);c=a.moveToPosition(d.start);0===d.start.column&&(c=a.moveToPreviousToken());b=new n(b);d=b.moveToPosition(d.end,!0);if(c&&d){var e="support.function.codebegin"===
c.type&&"support.function.codeend"===d.type;e||(e=l.isOpeningBracket(c.value)&&l.getComplement(c.value)===d.value);if(e)return a=a.getCurrentTokenPosition(),c=b.getCurrentTokenPosition(),c.column+=d.value.length,g.fromPoints(a,c)}return null});c("matching",!1,function(a,b,c,d){a=new n(b);d=a.moveToPosition(d.start);if(null==d)return null;do{if(null==d)break;if(!a.bwdToMatchingToken()&&(l.isOpeningBracket(d.value)||"support.function.codebegin"===d.type)){c=a.getCurrentTokenPosition();"support.function.codebegin"===
d.type?(c.row++,c.column=0):c.column+=d.value.length;var e=a.clone();if(e.fwdToMatchingToken())return a=e.getCurrentTokenPosition(),"support.function.codebegin"===d.type&&(a.row--,a.column=b.getLine(a.row).length),g.fromPoints(c,a)}}while(d=a.stepBackward());return null});c("statement",!1,function(a,c,d,e){a=new n(c);if(!a.moveToPosition(e.start,!0))return null;c=new n(c);if(!(d=!c.moveToPosition(e.end)||!b(a,[";",",","=","<-","<<-"]))){a:{d=[";",","];for(var f=c.getCurrentToken(),m=c.getCurrentTokenRow();c.moveToNextSignificantToken();){var q=
c.getCurrentToken();if(m!==c.getCurrentTokenRow()&&0!==f.type.indexOf("keyword.operator")){if(!c.moveToPreviousSignificantToken()){d=!1;break a}break}if(h.test(f.value)||l.isClosingBracket(f.value))if(h.test(q.value)||l.isClosingBracket(q.value)||l.contains(d,q.value)){if(!c.moveToPreviousSignificantToken()){d=!1;break a}break}c.fwdToMatchingToken();f=c.getCurrentToken();m=c.getCurrentTokenRow()}d=!0}d=!d}if(d)return null;d=a.getCurrentTokenPosition();f=c.getCurrentTokenPosition();if(d.row===e.start.row&&
d.column===e.start.column&&f.row===e.end.row&&f.column<=e.end.column&&!b(a,[";",","]))return null;e=a.getCurrentTokenPosition();a=c.getCurrentTokenPosition();a.column+=c.getCurrentTokenValue().length;return g.fromPoints(e,a)});c("scope",!1,function(a,b,c,d){c=b.getMode();if(null==c.codeModel||null==c.codeModel.getCurrentScope)return null;a=[];for(d=c.codeModel.getCurrentScope(d.start);null!=d;){c=d.preamble;var e=d.end;if(null==e&&d.parentScope)for(var f=d.parentScope.$children,h=f.length-2;0<=h;h--)if(f[h].equals(d)){e=
f[h+1].preamble;break}null==e&&(e={row:b.getLength(),column:0});a.push(g.fromPoints(c,e));d=d.parentScope}return 0===a.length?null:a});c("everything",!1,function(a,b,c,d){a=b.getLength();if(0===a)return new g(0,0,0,0);b=b.getLine(a-1);return new g(0,0,a-1,b.length)});this.$expandSelection=function(){q||(d.on("change",d.$onClearSelectionHistory),q=!0);for(var a=this.getSession(),b=this.getSelection(),c=b.getRange(),f=[],h=0;h<r.length;h++){var g=r[h],n=g.execute(this,a,b,c);l.isArray(n)||(n=[n]);for(var k=
0;k<n.length;k++){var p=n[k];if(p&&g.immediate&&e(p,c))return this.$acceptSelection(b,p,c);p&&e(p,c)&&f.push({name:g.name,range:p})}}f.sort(function(a,b){a=a.range;b=b.range;var c=a.end.row-a.start.row,d=b.end.row-b.start.row;return c!==d?c>d:a.end.column-a.start.column>b.end.column-b.start.column});return this.$acceptSelection(b,f[0].range,c)};this.$shrinkSelection=function(){var a=this.$selectionRangeHistory;if(a&&a.length)return a=a.pop(),this.getSelection().setSelectionRange(a),this.isRowFullyVisible(a.start.row)&&
this.isRowFullyVisible(a.end.row)||this.centerSelection(this.getSelection()),a;q&&(d.off("change",d.$onClearSelectionHistory),q=!1);return this.getSelectionRange()}}).call(p.prototype)});define("mode/markdown",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/mode/javascript").Mode,l=a("ace/mode/xml").Mode,f=a("ace/mode/html").Mode,e=a("mode/markdown_highlight_rules").MarkdownHighlightRules,b=a("mode/markdown_folding").FoldMode;a=function(){this.HighlightRules=e;this.createModeDelegates({"js-":n,"xml-":l,"html-":f});this.foldingRules=new b};k.inherits(a,g);(function(){this.type="text";this.blockComment={start:"\x3c!--",end:"--\x3e"};
this.getNextLineIndent=function(a,b,e){return this.$getIndent(b)};this.$id="mode/markdown"}).call(a.prototype);p.Mode=a});define("mode/markdown_folding",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/folding/fold_mode").FoldMode,n=a("ace/range").Range;p=p.FoldMode=function(){};var l=a("mode/utils");k.inherits(p,g);(function(){this.foldingStartMarker=/^(?:[=-]+\s*$|#{1,6} |`{3})/;this.getFoldWidget=function(a,e,b){e="markbeginend"===e?"end":"";var c=a.getLine(b);return this.foldingStartMarker.test(c)?"`"==c[0]?"start"===l.getPrimaryState(a,b)?e:"start":"":""};this.getFoldWidgetRange=
function(a,e,b){function c(b){return(k=a.getTokens(b)[0])&&0===k.type.lastIndexOf(p,0)}function d(){var a=k.value[0];return"="==a?6:"-"==a?5:7-k.value.search(/[^#]/)}var f=a.getLine(b);e=f.length;var g=a.getLength(),r=b,m=b;if(f.match(this.foldingStartMarker)){if("`"==f[0]){if("start"!==l.getPrimaryState(a,b)){for(;++b<g&&!(f=a.getLine(b),"`"==f[0]&"```"==f.substring(0,3)););return new n(r,e,b,0)}for(;0<b--&&!(f=a.getLine(b),"`"==f[0]&"```"==f.substring(0,3)););return new n(b,f.length,r,0)}var k,
p="markup.heading";if(c(b)){for(m=d();++b<g&&!(c(b)&&d()>=m););m=b-(k&&-1!=["=","-"].indexOf(k.value[0])?2:1);if(m>r)for(;m>r&&/^\s*$/.test(a.getLine(m));)m--;if(m>r)return b=a.getLine(m).length,new n(r,e,m,b)}}}}).call(p.prototype)});define("mode/markdown_highlight_rules",["require","exports","module"],function(a,p,k){function g(a,b){return{token:"support.function",regex:"^\\s*```(?:\\{"+a+"[^\\}]*\\}|"+a+")\\s*$",push:b+"start"}}k=a("ace/lib/oop");var n=a("ace/lib/lang"),l=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,e=a("ace/mode/xml_highlight_rules").XmlHighlightRules,b=a("ace/mode/html_highlight_rules").HtmlHighlightRules,c=a("ace/mode/css_highlight_rules").CssHighlightRules,
d=a("ace/mode/perl_highlight_rules").PerlHighlightRules,h=a("mode/python_highlight_rules").PythonHighlightRules,q=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,r=a("ace/mode/scala_highlight_rules").ScalaHighlightRules,m=a("mode/sh_highlight_rules").ShHighlightRules;a("mode/stan_highlight_rules");var v=a("mode/sql_highlight_rules").SqlHighlightRules,y=function(a){return"(?:[^"+n.escapeRegExp(a)+"\\\\]|\\\\.)*"};a=function(){var a=n.arrayToMap("title author date rtl depends autosize width height transition transition-speed font-family css class navigation incremental left right id audio video type at help-doc help-topic source console console-input execute pause".split(" ")),
l={token:["text","constant.numeric.text","constant.numeric.text","constant.numeric.text"],regex:"(^|\\s+)(_{2,3})(?![\\s_])(.*?)(?=_)(\\2)\\b"},k={token:["text","constant.language.boolean.text"],regex:"(^|\\s+)(_(?=[^\\s_]).*?_)\\b"},p={token:["constant.numeric.text","constant.numeric.text","constant.numeric.text"],regex:"([*]{2,3})(?![\\s*])(.*?)(?=[*])(\\1)"},w={token:["constant.language.boolean.text"],regex:"([*](?=[^\\s*]).*?[*])"},z={token:"text",regex:"\\^\\["+y("]")+"\\]"},C={token:"text constant text url string text".split(" "),
regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},t={token:["text","keyword","text","constant","text"],regex:"(\\s*\\[)("+y("]")+")(\\]\\[)("+y("]")+")(\\])"},B={token:"text keyword text markup.href string text paren.keyword.operator nospell paren.keyword.operator".split(" "),regex:"(\\s*\\[)("+y("]")+')(\\]\\()((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)(\\s*"'+y('"')+'"\\s*)?(\\))(?:(\\s*{)((?:[^\\}]+))(\\s*}))?'},F={token:["text","keyword","text"],regex:"(<)((?:https?|ftp|dict):[^'\">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)"};
this.$rules={basic:[{token:"constant.language.escape",regex:/\\[\\`*_{}[\]()#+\-.!]/},{token:"text",regex:/[?]`/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function","support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)"},z,C,t,B,F,p,l,w,k],start:[{token:"empty_line",regex:"^\\s*$",next:"allowBlock"},{token:"text",regex:/[?]`/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function","support.function","support.function"],
regex:"(`+)([^\\r]*?[^`])(\\1)"},{token:"markup.heading.1",regex:"^\\={3,}\\s*$",next:"fieldblock"},{token:"markup.heading.1",regex:"^={3,}(?=\\s*$)"},{token:"markup.heading.2",regex:"^\\-{3,}(?=\\s*$)"},{token:function(a){return"markup.heading."+a.length},regex:/^#{1,6}(?=\s*[^ #]|\s+#.)/,next:"header"},g("(?:javascript|js)","jscode-"),g("xml","xmlcode-"),g("html","htmlcode-"),g("css","csscode-"),g("perl","perlcode-"),g("python","pythoncode-"),g("ruby","rubycode-"),g("scala","scalacode-"),g("sh",
"shcode-"),g("bash","bashcode-"),g("stan","stancode-"),g("sql","sqlcode-"),g("d3","jscode-"),{token:"support.function",regex:"^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",next:"githubblock"},{token:"string.blockquote",regex:"^\\s*>\\s*(?=[-])"},{token:"string.blockquote",regex:"^\\s*>\\s*",next:"blockquote"},z,C,t,{token:"constant",regex:"^\\s*[*](?:\\s*[*]){2,}\\s*$",next:"allowBlock"},{token:"constant",regex:"^\\s*[-](?:\\s*[-]){2,}\\s*$",next:"allowBlock"},{token:"constant",regex:"^\\s*[_](?:\\s*[_]){2,}\\s*$",
next:"allowBlock"},{token:"latex.markup.list.string.begin",regex:"\\\\\\[",next:"mathjaxnativedisplay"},{token:"latex.markup.list.string.begin",regex:"\\\\\\(",next:"mathjaxnativeinline"},{token:"text",regex:"\\\\\\$"},{token:"latex.markup.list.string.begin",regex:"\\${2}",next:"mathjaxdisplay"},{token:["latex.markup.list.string.begin","latex.support.function","latex.markup.list.string.end"],regex:"(\\$)((?:(?:\\\\.)|(?:[^\\$\\\\]))*?)(\\$)"},{token:["text","keyword","text"],regex:"(<)((?:https?|ftp|dict):[^'\">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)"},
{token:"keyword",regex:"\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"},{token:"paren.keyword.operator",regex:"[{}]"},{token:"markup.list",regex:"-?\\@[\\w\\d-]+"},{token:"text",regex:"[^\\*_%$`\\[#<>{}\\\\@\\s!]+"},{token:"text",regex:"\\\\"},{token:"text",regex:"^\\s*(?:[*+-]|\\d+\\.)\\s+",next:"listblock"},p,l,w,k,{token:"comment",regex:"<\\!--",next:"html-comment"},{include:"basic"}],"html-comment":[{token:"comment",regex:"--\x3e",next:"start"},{defaultToken:"comment.text"}],allowBlock:[{token:"support.function",
regex:"^ {4}.+",next:"allowBlock"},{token:"empty_line",regex:"^\\s*$",next:"allowBlock"},{token:"empty",regex:"",next:"start"}],header:[{regex:"$",next:"start"},{include:"basic"},{defaultToken:"heading"}],listblock:[{token:"empty_line",regex:"^\\s*$",next:"start"},{token:"text",regex:"^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",next:"listblock"},{token:["latex.markup.list.string.begin","latex.support.function","latex.markup.list.string.end"],regex:"(\\$)((?:(?:\\\\.)|(?:[^\\$\\\\]))*?)(\\$)"},{include:"basic",
noEscape:!0},{token:"support.function",regex:"^\\s*```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",next:"githubblock"},{defaultToken:"text"}],blockquote:[{token:"empty_line",regex:"^\\s*$",next:"start"},{token:"constant.language.escape",regex:/\\[\\`*_{}[\]()#+\-.!]/},{token:"text",regex:/[?]`/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function","support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)"},z,C,t,B,F,p,l,w,k,{defaultToken:"string.blockquote"}],githubblock:[{token:"support.function",
regex:"^\\s*```",next:"start"},{token:"support.function",regex:".+"}],fieldblock:[{token:function(b){b=b.slice(0,-1);return a[b]?"comment.doc.tag":"text"},regex:"^[\\w-]+\\:",next:"fieldblockvalue"},{token:"text",regex:"(?=.+)",next:"start"}],fieldblockvalue:[{token:"text",regex:"$",next:"fieldblock"},{token:"text",regex:"[^{}]+"}],mathjaxdisplay:[{token:"latex.markup.list.string.end",regex:"\\${2}",next:"start"},{token:"latex.support.function",regex:"[^\\$]+"}],mathjaxnativedisplay:[{token:"latex.markup.list.string.end",
regex:"\\\\\\]",next:"start"},{token:"latex.support.function",regex:"[\\s\\S]+?"}],mathjaxnativeinline:[{token:"latex.markup.list.string.end",regex:"\\\\\\)",next:"start"},{token:"latex.support.function",regex:"[\\s\\S]+?"}]};this.embedRules(f,"jscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(b,"htmlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(c,"csscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(e,
"xmlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(d,"perlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(h,"pythoncode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(q,"rubycode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(r,"scalacode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(m,"shcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);
this.embedRules(m,"bashcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(v,"sqlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(f,"jscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.normalizeRules()};k.inherits(a,l);p.MarkdownHighlightRules=a});define("mode/mermaid",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("mode/mermaid_highlight_rules").MermaidHighlightRules;a=function(){this.$highlightRules=new l;this.$tokenizer=new n(this.$highlightRules.getRules())};k.inherits(a,g);(function(){this.getNextLineIndent=function(a,e,b){return this.$getIndent(e)}}).call(a.prototype);p.Mode=a});define("mode/mermaid_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.createKeywordMapper({keyword:"sequenceDiagram|participant|graph|subgraph|loop|alt|is|opt|else|end|style|linkStyle|classDef|class"},"identifier",!1);this.$rules={start:[{token:"keyword",merge:!1,regex:"^\\s*graph\\s+(?:TB|BT|RL|LR|TD)\\s*$"},{token:"keyword",merge:!1,regex:"^\\s*(?:sequenceDiagram|participant|subgraph|loop|alt(?:\\s+is)?|opt|else(?:\\s+is)?|end|style|linkStyle|classDef|class)"},
{token:"keyword.operator",merge:!1,regex:">|\\->|\\-\\->|\\-\\-\\-|\\-\\-|\\-\\.\\->|\\-\\.|\\.\\->|==>|==|\\->>|\\-\\->>|\\-x|\\-\\-x"},{token:"paren.keyword.operator",merge:!1,regex:"[[({\\|]"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}]"},{token:"markup.list",merge:!1,regex:"Note\\s+(?:left|right)\\s+of"},{token:"markup.list",merge:!1,regex:"<br/>"},{token:"text",regex:"\\s+",merge:!0}]}};k.inherits(g,a);p.MermaidHighlightRules=g});define("mode/python",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/python_highlight_rules").PythonHighlightRules,l=a("ace/mode/folding/pythonic").FoldMode;a("ace/range");a=function(){this.HighlightRules=n;this.foldingRules=new l("\\:")};k.inherits(a,g);(function(){this.lineCommentStart="#";this.getLanguageMode=function(a){return"Python"};this.getNextLineIndent=function(a,e,b){var c=this.$getIndent(e),d=this.getTokenizer().getLineTokens(e,
a).tokens;if(d.length&&"comment"==d[d.length-1].type)return c;"start"==a&&e.match(/^.*[\{\(\[:]\s*$/)&&(c+=b);return c};this.checkOutdent=function(a,e,b){return!1};this.autoOutdent=function(a,e,b){};this.$id="mode/python"}).call(a.prototype);p.Mode=a});define("mode/python_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a("mode/utils");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:'(?:r|u|ur|R|U|UR|Ur|uR)?"{3}',next:"qqstring3"},{token:"string",regex:'(?:r|u|ur|R|U|UR|Ur|uR)?"(?=.)',next:"qqstring"},{token:"string",regex:"(?:r|u|ur|R|U|UR|Ur|uR)?'{3}",next:"qstring3"},{token:"string",regex:"(?:r|u|ur|R|U|UR|Ur|uR)?'(?=.)",
next:"qstring"},{token:"constant.numeric",regex:"(?:(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+))(?:[eE][+-]?\\d+))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:"(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+))(?:[eE][+-]?\\d+))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))"},{token:"constant.numeric",regex:"(?:(?:(?:[1-9]\\d*)|(?:0))|(?:0[oO]?[0-7]+)|(?:0[xX][\\dA-Fa-f]+)|(?:0[bB][01]+))[lL]\\b"},{token:"constant.numeric",
regex:"(?:(?:(?:[1-9]\\d*)|(?:0))|(?:0[oO]?[0-7]+)|(?:0[xX][\\dA-Fa-f]+)|(?:0[bB][01]+))\\b"},{token:this.createKeywordMapper({"invalid.deprecated":"debugger","support.function":"abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern",
"constant.language":"True|False|None|NotImplemented|Ellipsis|__debug__",keyword:"and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield"},"identifier"),regex:"[a-zA-Z_][a-zA-Z0-9_]*\\b"},{token:"keyword.operator",regex:"//=|\\*\\*=|>>=|<<=|//|\\*\\*|==|!=|>=|<=|>>|<<|\\+=|-=|\\*=|/=|&=|%=|\\|=|\\^=|\\+|-|\\*|/|%|>|<|\\^|~|\\||&|=|:|\\.|;|,",merge:!1},{token:"paren.lparen.keyword.operator",
regex:"[\\[\\(\\{]",merge:!1},{token:"paren.rparen.keyword.operator",regex:"[\\]\\)\\}]",merge:!1},{token:"text",regex:"\\s+"}],qqstring3:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},{token:"string",regex:'"{3}',next:"start"},{defaultToken:"string"}],qstring3:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},{token:"string",regex:"'{3}",next:"start"},
{defaultToken:"string"}],qqstring:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},{token:"string",regex:"\\\\$",next:"qstring"},{token:"string",regex:"'|$",next:"start"},{defaultToken:"string"}]}};
k.inherits(g,a);p.PythonHighlightRules=g});define("mode/r",["require","exports","module"],function(a,p,k){a("ace/editor");a("ace/edit_session");a("ace/range");k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/r_highlight_rules").RHighlightRules,e=a("mode/r_code_model").RCodeModel,b=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent;a("mode/auto_brace_insert");var c=a("ace/unicode");a=function(a,c){this.$tokenizer=a?new n((new l).getRules()):
new n((new f).getRules());this.foldingRules=this.codeModel=new e(c,this.$tokenizer);this.$outdent=new b(this.codeModel)};k.inherits(a,g);(function(){this.getLanguageMode=function(a){return"R"};this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(a,b,c)};this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(a,b,c)};this.tokenRe=new RegExp("^["+c.wordChars+"._]+","g");this.nonTokenRe=new RegExp("^(?:[^"+c.wordChars+"._]|\\s)+","g");this.$complements={"(":")","[":"]",'"':'"',
"'":"'","{":"}","`":"`"};this.$reOpen=/^[{(\["'`]$/;this.$reClose=/^[})\]"'`]$/;this.getNextLineIndent=function(a,b,c,e){return this.codeModel.getNextLineIndent(a,b,c,e)};this.allowAutoInsert=this.smartAllowAutoInsert;this.getIndentForOpenBrace=function(a){return this.codeModel.getIndentForOpenBrace(a)};this.$getIndent=function(a){return(a=a.match(/^(\s+)/))?a[1]:""};this.transformAction=function(a,b,c,e,f){return"insertion"===b&&"\n"===f&&(a=c.getSelectionRange().start,e=e.doc.getLine(a.row),(a=
/^((\s*#+')\s*)/.exec(e))&&c.getSelectionRange().start.column>=a[2].length||(a=/^((\s*#+\*)\s*)/.exec(e))&&c.getSelectionRange().start.column>=a[2].length)?{text:"\n"+a[1]}:!1};this.$id="mode/r"}).call(a.prototype);p.Mode=a});define("mode/r_code_model",["require","exports","module"],function(a,p,k){function g(a,b){for(var c=0;c<b.length;c++)if(a===b[c])return!0;return!1}var n=a("ace/range").Range,l=a("ace/token_iterator").TokenIterator,f=a("mode/token_cursor").RTokenCursor,e=a("mode/utils"),b=!1,c=a("mode/r_scope_tree").ScopeManager,d=a("mode/r_scope_tree").ScopeNode;a=function(a,b,e,f,l){this.$session=a;this.$doc=a.getDocument();this.$tokenizer=b;this.$tokens=Array(this.$doc.getLength());this.$endStates=Array(this.$doc.getLength());
this.$statePattern=e;this.$codeBeginPattern=f;this.$codeEndPattern=l;this.$scopes=new c(d);var h=!0,m=function(a,b){h?h=!1:(this.$doc.off("change",g),this.$session.off("changeMode",m))}.bind(this),g=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",m);this.$doc.on("change",g)};(function(){function a(a){return"keyword"==a.type&&"function"==a.value}function c(a){return/\boperator\b/.test(a.type)&&/^(=|<-|<<-)$/.test(a.value)}function d(a){return/\bidentifier\b/.test(a.type)}
function m(b){var c=b.cloneCursor();if("{"!==c.currentValue()||!c.moveBackwardOverMatchingParens()||!c.moveToPreviousToken()||!a(c.currentToken()))return!1;b.$row=c.$row;b.$offset=c.$offset;return!0}function k(a){for(;a.findOpeningBracket("(")&&a.moveToPreviousToken();)if(g(a.currentValue(),["if","for","while"]))return!0;return!1}function p(b){var d=b.cloneCursor();if(!(a(d.currentToken())&&d.moveToPreviousToken()&&c(d.currentToken())&&d.moveToPreviousToken()))return!1;b.$row=d.$row;b.$offset=d.$offset;
return!0}function A(b){if(a(b.currentToken())&&!b.moveToNextToken()||"("===b.currentValue()&&!b.moveToNextToken()||")"===b.currentValue())return[];var c=[];for(d(b.currentToken())&&c.push(b.currentValue());b.moveToNextToken();)if(!b.fwdToMatchingToken()){if(")"===b.currentValue())break;if(","===b.currentValue()){for(;","===b.currentValue()&&b.moveToNextToken(););d(b.currentToken())&&c.push(b.currentValue())}}return c}function D(a){for(var b=0,c=Math.min(a.getLength(),100),d="Title";b++<c;){var f=
a.getLine(b);if(/^\s*[-]{3}\s*$/.test(f))break;f=/^\s*title:\s+(.*?)\s*$/.exec(f);if(null!==f){d=f[1];break}}return e.stripEnclosingQuotes(d.trim())}function I(a){return"keyword.operator"===a||"keyword.operator.infix"===a}var E=e.contains;this.getTokenCursor=function(){return new f(this.$tokens,0,0,this)};this.$complements={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{"};var w=function(a){a=a.trim();return a=a.replace(/[\n\s]+/g," ")};this.getFunctionsInScope=function(a){this.$buildScopeTreeUpToRow(a.row);
return this.$scopes.getFunctionsInScope(a)};this.getAllFunctionScopes=function(a){"undefined"===typeof a&&(a=this.$doc.getLength());this.$buildScopeTreeUpToRow(a);return this.$scopes.getAllFunctionScopes()};this.getDplyrJoinContextFromInfixChain=function(a){var b=a.cloneCursor();a="";b.hasType("identifier")&&(a=b.currentValue());var c="left";"="===b.currentValue()&&(c="right");if(b.hasType("identifier")){if(!b.moveToPreviousToken())return null;"="===b.currentValue()&&(c="right")}if(!b.findOpeningBracket("(",
!0)||!b.moveToPreviousToken())return null;for(;b.findOpeningBracket("(",!0)&&b.moveToPreviousToken();)if(/_join$/.test(b.currentValue())){var d=b.currentValue();if(!b.moveToNextToken())break;if(!b.moveToNextToken())break;var e=b.currentValue();if(!1===this.moveToDataObjectFromInfixChain(b))break;b=b.currentValue();return{token:a,leftData:b,rightData:e,verb:d,cursorPos:c}}return null};this.getDataFromInfixChain=function(a){var b=this.moveToDataObjectFromInfixChain(a),c=[],d=[],e="",f=!1;!1!==b&&(b.excludeArgsFromObject&&
(f=b.excludeArgsFromObject),e=a.currentValue(),c=b.additionalArgs,d=b.excludeArgs);return{name:e,additionalArgs:c,excludeArgs:d,excludeArgsFromObject:f}};var z="mutate summarise summarize rename transmute select rename_vars inner_join left_join right_join semi_join anti_join outer_join full_join".split(" "),C=function(a,b,c,d){if(!a.moveToNextToken()||"("!==a.currentValue()||!a.moveToNextToken()||")"===a.currentValue())return!1;a.hasType("identifier")&&b.additionalArgs.push(a.currentValue());if("rename"===
d){if(!a.moveToNextToken())return!1;b.excludeArgs.push(a.currentValue())}"select"===d&&(b.excludeArgsFromObject=!0);do{if(")"===a.currentValue())break;if(a.$row>c.$row||a.$row===c.$row&&a.$offset>=c.$offset)break;if(a.fwdToMatchingToken()){if(!a.moveToNextToken())break}else if(","===a.currentValue()){if(!a.moveToNextToken())return!1;a.hasType("identifier")&&b.additionalArgs.push(a.currentValue());if(!a.moveToNextToken())return!1;if("="===a.currentValue()&&g(d,["rename","rename_vars"])){if(!a.moveToNextToken())return!1;
a.hasType("identifier")&&b.excludeArgs.push(a.currentValue())}}}while(a.moveToNextToken());return!0};this.moveToDataObjectFromInfixChain=function(a){var b=a.cloneCursor(),c;a:{for(c=b.cloneCursor();c.findOpeningBracket("(",!1)&&c.moveToPreviousToken()&&c.moveToPreviousToken();){if(":"===c.currentValue()){for(;":"===c.currentValue();)if(!c.moveToPreviousToken()){c=!1;break a}if(!c.moveToPreviousToken())break}if(/\binfix\b/.test(c.currentToken().type)){b.$row=c.$row;b.$offset=c.$offset;c=!0;break a}}c=
!1}if(!c)return!1;for(c={additionalArgs:[],excludeArgs:[]};;){if(0===b.$row&&0===b.$offset)return a.$row=0,a.$offset=0,c;b.moveBackwardOverMatchingParens();if(!b.moveToPreviousToken())return!1;var d=b.currentValue();E(z,d)&&C(b.cloneCursor(),c,a,d);if(!b.moveToPreviousToken())return 0===b.$row&&0===b.$offset?(a.$row=0,a.$offset=0,c):!1;if(":"===b.currentValue()){for(;":"===b.currentValue();)if(!b.moveToPreviousToken())return!1;if(!b.moveToPreviousToken())return!1}if(!/\binfix\b/.test(b.currentToken().type))break}if(!b.moveToNextToken())return!1;
a.$row=b.$row;a.$offset=b.$offset;return c};this.getVariablesInScope=function(a){var b=this.getTokenCursor();if(!b.moveToPosition(a))return[];a=b.cloneCursor();a.findOpeningBracket("(",!0)&&a.moveToPreviousToken()&&"function"===a.currentValue()?(b.$row=a.$row,b.$offset=a.$offset,a=!0):a=!1;a&&p(b)&&b.findStartOfEvaluationContext();a={};do if(!b.bwdToMatchingToken()){var e=a,f=b.cloneCursor();if("for"===f.currentValue()&&f.moveToNextToken()&&"("===f.currentValue()&&f.moveToNextToken()){var l=f.currentValue();
f.moveToNextToken()&&"in"===f.currentValue()&&(e[l]="variable")}c(b.currentToken())&&(e="variable",f=b.cloneCursor(),f.moveToNextToken()&&"function"===f.currentValue()&&(e="function"),f=b.cloneCursor(),f.moveToPreviousToken()&&d(f.currentToken())&&(f=f.currentValue(),a[f]=e))}while(b.moveToPreviousToken());b=[];for(var h in a)b.push({token:h,type:a[h]});b.sort();return b};this.$buildScopeTreeUpToRow=function(a){function b(a,b){if("undefined"===typeof a)return"";var c=a.exec(b);if(!c)return null;var d=
c[1].split(",");if(0==d.length)return null;if(!/=/.test(d[0]))return d[0].replace(/(^\s+)|(\s+$)/g,"");for(var f=0;f<d.length;f++)if(c=/^\s*label\s*=\s*(.*)$/.exec(d[f]))return e.stripEnclosingQuotes(c[1].trim());return null}var c=this.$session.getMode().$id;a=Math.min(a+30,this.$doc.getLength()-1);var d=this.$scopes.parsePos.row;if(d>=a)return d;d=new l(this.$session);d.tokenizeUpToRow(a);this.$tokenizeUpToRow(a);var f=this.$scopes.parsePos.row;d.moveToPosition({row:f,column:this.$scopes.parsePos.column},
!0);var h=d.getCurrentToken();if(null==h)return f;var g=h.value,q=h.type,k=d.getCurrentTokenPosition();f=this.$scopes.getChunkCount();do{if(d.$row>a)break;g=h.value;q=h.type;k=d.getCurrentTokenPosition();if("rd-start"===this.$session.getState(k.row))d.moveToEndOfRow();else if(h=!0,this.$codeBeginPattern&&(h=/^r-/.test(this.$session.getState(d.$row))),e.startsWith(q,"markup.heading")){h="";var r={row:k.row,column:0},t={row:k.row+1,column:0};q=0;if(/^\s*#+\s*$/.test(g))q=g.split("#").length-1,g=this.$session.getLine(k.row),
h=g.replace(/^\s*[#]+\s*/,"");else if(/^[-=]{3,}\s*$/.test(g)&&(q="="===g[0]?1:2,h=this.$session.getLine(k.row-1).trim(),r.row--,0===h.length))continue;0===h.length&&(h="(Untitled)");h=h.replace(/{.*}\s*$/,"");this.$scopes.onMarkdownHead(h,r,t,q)}else if(h&&/\bsectionhead\b/.test(q)){h="(Untitled)";if(q=/[^#=-\s]/.exec(g))h=g.substr(q.index),h=h.replace(/\s*[#=-]+\s*$/,"");this.$scopes.onSectionStart(h,k)}else if(h||"mode/sweave"!==c||"keyword"!==q||0!==k.column||0!==g.indexOf("\\")||"\\chapter"!==
g&&"\\section"!==g&&"\\subsection"!==g&&"\\subsubsection"!==g)if(/\bcodebegin\b/.test(q)&&"---"===g)g=D(this.$session),this.$scopes.onSectionStart(g,k,{isYaml:!0});else if(/\bcodeend\b/.test(q)&&"---"===g)k.column=Infinity,this.$scopes.onSectionEnd(k);else if("mode/rmarkdown"===c&&/\bcodebegin\b/.test(q)&&0===g.trim().indexOf("/***"))this.$scopes.onSectionStart("(R Code Chunk)",k);else if("mode/rmarkdown"===c&&/\bcodeend\b/.test(q)&&0===g.trim().indexOf("*/"))this.$scopes.onSectionEnd(k);else/\bcodebegin\b/.test(q)?
(f++,h={row:k.row+1,column:0},r=f,q=b(this.$codeBeginPattern,g),r="Chunk "+r,q&&"YAML Header"!==g&&(r+=": "+q),this.$scopes.onChunkStart(q,r,k,h)):/\bcodeend\b/.test(q)?(k.column+=g.length,this.$scopes.onChunkEnd(k)):h&&"{"===g?(g=this.getTokenCursor(),g.moveToPosition(k,!0),h=g.cloneCursor(),m(h)?(q=h.cloneCursor(),q.moveToNextToken(),k=null,p(h)&&(r=h.cloneCursor(),t=h.cloneCursor(),t.findStartOfEvaluationContext()&&(k=t.currentPosition(),t=r.currentPosition(),k.row!==t.row?(k.row=t.row,k.column=
0,h.$row=k.row,h.$offset=0):h.moveToPosition(k,!0),k=this.$doc.getTextRange(new n(k.row,k.column,t.row,t.column+r.currentValue().length)))),r=h.currentPosition(),h.isFirstSignificantTokenOnLine()&&(r.column=0),h=A(q),q="("+h.join(", ")+")",q=null==k?w("<function>"+q):w(k+q),this.$scopes.onFunctionScopeStart(q,r,g.currentPosition(),k,h)):(r=g.currentPosition(),g.isFirstSignificantTokenOnLine()&&(r.column=0),this.$scopes.onScopeStart(r))):h&&"}"===g&&(k.column+=1,this.$scopes.onScopeEnd(k));else q=
1,"\\chapter"===g?q=2:"\\section"===g?q=3:"\\subsection"===g?q=4:"\\subsubsection"===g&&(q=5),g=this.$doc.getLine(k.row),g=/{([^}]*)}/.exec(g),h="",null!=g&&(h=g[1]),r={row:k.row,column:0},t={row:k.row,column:Infinity},this.$scopes.onMarkdownHead(h,r,t,q)}while(h=d.moveToNextToken());a=Math.max(a,d.$row);this.$scopes.parsePos={row:a,column:-1};return a};this.$getFoldToken=function(a,b,c){this.$tokenizeUpToRow(c);if(this.$statePattern&&!this.$statePattern.test(this.$endStates[c]))return"";a=this.$tokens[c];
for(c=0;c<a.length;c++)if(/\bsectionhead\b/.test(a[c].type))return a[c];var d=0,e=null,f=null;for(c=0;c<a.length;c++){var h=a[c];if(/\bparen\b/.test(h.type))switch(h.value){case "{":d++;1==d&&(e=h);break;case "}":d--,0==d&&(e=null),0>d&&(f=h,d=0)}}return e?e:"markbeginend"==b&&f?f:1<=a.length&&(/\bcodebegin\b/.test(a[0].type)||/\bcodeend\b/.test(a[0].type))?a[0]:null};this.getFoldWidget=function(a,b,c){a=this.$getFoldToken(a,b,c);return null==a?"":"{"==a.value?"start":"}"==a.value?"end":/\bcodebegin\b/.test(a.type)?
"start":/\bcodeend\b/.test(a.type)?"end":/\bsectionhead\b/.test(a.type)?"start":""};this.getFoldWidgetRange=function(a,b,c){var d=this.$getFoldToken(a,b,c);if(d){b={row:c,column:d.column+1};if("{"==d.value)return(a=a.$findClosingBracket(d.value,b))?n.fromPoints(b,a):void 0;if("}"==d.value)return(a=a.$findOpeningBracket(d.value,b))?n.fromPoints({row:a.row,column:a.column+1},{row:b.row,column:b.column-1}):void 0;if(/\bcodebegin\b/.test(d.type)){b=new l(a,c,0);for(var e;e=b.stepForward();)if(/\bcode(begin|end)\b/.test(e.type))return e=
/\bcodebegin\b/.test(e.type),b=b.getCurrentTokenRow(),a=e?{row:b-1,column:a.getLine(b-1).length}:{row:b,column:a.getLine(b).length},n.fromPoints({row:c,column:d.column+d.value.length},a)}else if(/\bcodeend\b/.test(d.type))for(b=new l(a,c,0);d=b.stepBackward();){if(/\bcodebegin\b/.test(d.type))return b=b.getCurrentTokenRow(),n.fromPoints({row:b,column:a.getLine(b).length},{row:c,column:a.getLine(c).length})}else if(/\bsectionhead\b/.test(d.type)){d=a.getLine(c);if(/^\s*[#=-]+\s*$/.test(d))d=d.length;
else{d=/[#=-]+\s*$/.exec(d);if(!d)return;d=d.index}b.column=d;c=new l(a,c+1);for(c.$tokenIndex=-1;(token=c.stepForward())&&"}"!==token.value&&!/\bsectionhead\b/.test(token.type)&&!/\bcode(?:begin|end)/.test(token.type);)"{"===token.value&&c.fwdToMatchingToken();c=c.getCurrentTokenRow();token&&c--;a={row:c,column:a.getLine(c).length};return n.fromPoints(b,a)}}};this.getCurrentScope=function(a,b){b||(b=function(a){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);var c=this.$scopes.getActiveScopes(a);
if(c)for(var d=c.length-1;0<=d;d--)if(b(c[d]))return c[d];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.getScopeList()};this.findFunctionDefinitionFromUsage=function(a,b){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.findFunctionDefinitionFromUsage(a,b)};this.getIndentForOpenBrace=function(a){if(this.$tokenizeUpToRow(a.row)){var b=this.getTokenCursor();if(b.seekToNearestToken(a,a.row)&&"{"==b.currentValue()&&
b.moveBackwardOverMatchingParens())return this.$getIndent(this.$getLine(b.currentPosition().row))}return this.$getIndent(this.$getLine(a.row))};this.getIndentForRow=function(a){return this.getNextLineIndent("start",this.$getLine(a),this.$session.getTabString(),a)};this.getNextLineIndent=function(a,d,f,h){if(e.endsWith(a,"qstring"))return this.$getIndent(d);"number"!==typeof h&&(h=this.$session.getSelection().getCursor().row-1);var l=this.$session.getTabSize();a=Array(l+1).join(" ");this.$lineOverrides=
null;this.$doc.getLine(h)!==d&&(this.$lineOverrides={},this.$lineOverrides[h]=d,this.$invalidateRow(h));try{var m=0>h?"":this.$getIndent(this.$getLine(h));if(!this.$tokenizeUpToRow(h))return m;var q={row:h,column:this.$getLine(h).length},n=this.$findPreviousSignificantToken(q,h-10);m="";var r=!1;if(n&&I(n.token.type))m=f,r=!0;else if(n&&/\bparen\b/.test(n.token.type)&&/\)$/.test(n.token.value)){var p=this.$walkParensBalanced(n.row,n.row-10,null,function(a,b,c){return 0===a.length});if(null!=p){var y=
this.$findPreviousSignificantToken(p,0);if(y&&"keyword"===y.token.type&&/^(if|while|for|function)$/.test(y.token.value))return this.$getIndent(this.$getLine(y.row))+f}}else if(n&&"keyword"===n.token.type&&("repeat"===n.token.value||"else"===n.token.value))return this.$getIndent(this.$getLine(n.row))+f;var t=this.getTokenCursor();if(!t.moveToPosition(q))return"";do{var v=t.currentType();if("support.function.codebegin"===v||"support.function.codeend"===v)return this.$getIndent(this.$doc.getLine(t.$row))+
m;var u=t.currentValue();if(t.isAtStartOfNewExpression(!1)){if("{"===u||"["===u||"("===u)m+=f;return this.$getIndent(this.$doc.getLine(t.$row))+m}if("("===u&&t.isAtStartOfNewExpression(!0))return this.$getIndent(this.$doc.getLine(t.$row))+f;if(!t.bwdToMatchingToken()){if("{"===u)break;if(E(["[","("],u)){var A=t.currentPosition();q=null;b&&(q=this.$findNextSignificantToken({row:A.row,column:A.column+1},h));if(q){d=this.$getLine(q.row);var B=d.replace(/[^\s].*$/,""),w=q.column-B.length,D=Math.floor(w/
l);A=w-l*D;w="";for(d=0;d<D;d++)w+=f;for(f=0;f<A;f++)w+=" ";f=B+w;var F=f.replace("\t",a).length;for(d=q.row+1;d<=h;d++)if(/[^\s]/.test(this.$getLine(d))){var z=this.$endStates[d-1];if("qstring"!==z&&"qqstring"!==z){var N=this.$getLine(d).replace(/[^\s].*$/,"");var C=N.replace("\t",a).length;C<F&&(f=N,F=C)}}return k(t)?f:f+m}return this.getIndentForOpenBrace(A)+f+m}}}while(t.moveToPreviousToken());if(!t.moveToPosition(q))return"";do if(!t.bwdToMatchingToken()){if("{"===t.currentValue())return this.getIndentForOpenBrace(t.currentPosition())+
f+m;if(c(t.currentToken())){for(;c(t.currentToken())&&t.moveToPreviousToken()&&t.findStartOfEvaluationContext();){var x=t.cloneCursor();if(x.moveToPreviousToken()&&("else"===x.currentValue()||"repeat"===x.currentValue()||")"===x.currentValue()&&x.bwdToMatchingToken()&&x.moveToPreviousToken()&&(u=x.currentValue(),E(["if","for","while","repeat","else"],u))))return this.$getIndent(this.$doc.getLine(x.$row))+m+m;c(t.peekBwd().currentToken())&&t.moveToPreviousToken()}return this.$getIndent(this.$getLine(t.$row))+
m}}while(t.moveToPreviousToken());if(r){F=0;t=this.getTokenCursor();t.moveToPosition(q);t.moveToPreviousToken();do{if(g(t.currentValue(),["if","else"])){m+=f;break}if(t.hasType("constant","identifier")){if(!t.moveToPreviousToken())break;if(g(t.currentValue(),["if","else"])){m+=f;break}if(")"===t.currentValue()){if(!t.bwdToMatchingToken())break;if(!t.moveToPreviousToken())break;if(g(t.currentValue(),["if","else"])){m+=f;break}}if(!t.hasType("operator"))break}else if(!t.findStartOfEvaluationContext())break}while(t.moveToPreviousToken()&&
20>F++)}var H=this.$findNextSignificantToken({row:0,column:0},h);return H?this.$getIndent(this.$getLine(H.row))+m:""+m}finally{this.$lineOverrides&&(this.$lineOverrides=null,this.$invalidateRow(h))}};this.getBraceIndent=function(a){var b=this.getTokenCursor(),c={row:a,column:this.$getLine(a).length};if(!b.moveToPosition(c))return"";if(")"===b.currentValue()){if(b.bwdToMatchingToken()&&b.moveToPreviousToken()&&(c=b.currentValue(),g(c,["if","while","for","function"])))return this.$getIndent(this.$getLine(b.$row))}else if(g(b.currentValue(),
["else","repeat"]))return this.$getIndent(this.$getLine(b.$row));return this.getIndentForRow(a)};this.getTokenForPos=function(a,b,c){this.$tokenizeUpToRow(a.row);if(this.$tokens.length<=a.row)return null;for(var d=this.$tokens[a.row],e=0;e<d.length;e++){var f=d[e];if(b&&a.column==f.column)return f;if(a.column<=f.column)break;if(c&&a.column==f.column+f.value.length||a.column<f.column+f.value.length)return f}return null};this.$tokenizeUpToRow=function(a){a=Math.min(a,this.$endStates.length-1);for(var b=
0,c=!0;b<=a;b++)if(!c||!this.$endStates[b]){c=!1;var d=0===b?"start":this.$endStates[b-1],e=this.$getLine(b);e=this.$tokenizer.getLineTokens(e,d,b);!this.$statePattern||this.$statePattern.test(e.state)||this.$statePattern.test(d)?this.$tokens[b]=this.$filterWhitespaceAndComments(e.tokens):this.$tokens[b]=[];e.state===this.$endStates[b]?c=!0:this.$endStates[b]=e.state}c||b<this.$tokens.length&&this.$invalidateRow(b);return!0};this.$onDocChange=function(a){"insert"===a.action?this.$insertNewRows(a.start.row,
a.end.row-a.start.row):this.$removeRows(a.start.row,a.end.row-a.start.row);this.$invalidateRow(a.start.row);this.$scopes.invalidateFrom(a.start)};this.$invalidateRow=function(a){this.$tokens[a]=null;this.$endStates[a]=null};this.$insertNewRows=function(a,b){for(var c=[a,0],d=0;d<b;d++)c.push(null);this.$tokens.splice.apply(this.$tokens,c);this.$endStates.splice.apply(this.$endStates,c)};this.$removeRows=function(a,b){this.$tokens.splice(a,b);this.$endStates.splice(a,b)};this.$getIndent=function(a){return(a=
/^([ \t]*)/.exec(a))?a[1]:""};this.$getLine=function(a){return this.$lineOverrides&&"undefined"!=typeof this.$lineOverrides[a]?this.$lineOverrides[a]:this.$doc.getLine(a)};this.$walkParens=function(a,b,c){var d=/\bparen\b/;return a<b?function(){for(;a<=b;a++)for(var e=this.$tokens[a],f=0;f<e.length;f++)if(d.test(e[f].type)&&!c(e[f].value,{row:a,column:e[f].column}))return!1;return!0}.call(this):function(){a=Math.max(0,a);for(b=Math.max(0,b);a>=b;a--)for(var e=this.$tokens[a],f=e.length-1;0<=f;f--)if(d.test(e[f].type)&&
!c(e[f].value,{row:a,column:e[f].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,b,c,d){var e=[],f=null,h=this;this.$walkParens(a,b,function(a,b){if(c&&c(e,a,b))return f=b,!1;if(/[\[({]/.test(a))if(e[e.length-1]===h.$complements[a])e.pop();else return!0;else e.push(a);return d&&d(e,a,b)?(f=b,!1):!0});return f};this.$findNextSignificantToken=function(a,b){if(0==this.$tokens.length)return null;b=Math.min(b,this.$tokens.length-1);for(var c=a.row,d=a.column;c<=b;c++){for(var e=
this.$tokens[c],f=0;f<e.length;f++)if(e[f].column+e[f].value.length>d)return{token:e[f],row:c,column:Math.max(e[f].column,d),offset:f};d=0}return null};this.findNextSignificantToken=function(a){return this.$findNextSignificantToken(a,this.$tokens.length-1)};this.$findPreviousSignificantToken=function(a,b){if(0===this.$tokens.length)return null;b=Math.max(0,b);for(var c=Math.min(a.row,this.$tokens.length-1);c>=b;c--){var d=this.$tokens[c];if(0!==d.length){if(c!=a.row)return{row:c,column:d[d.length-
1].column,token:d[d.length-1],offset:d.length-1};for(var e=d.length-1;0<=e;e--)if(d[e].column<a.column)return{row:c,column:d[e].column,token:d[e],offset:e}}}};this.$filterWhitespaceAndComments=function(a){a=a.filter(function(a){a=/\bcode(?:begin|end)\b/.test(a.type)?!1:/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a});for(var b=a.length-1;0<=b;b--)if(1<a[b].value.length&&/\bparen\b/.test(a[b].type)){var c=a[b];a.splice(b,1);for(var d=
c.value.length-1;0<=d;d--){var e={type:c.type,value:c.value.charAt(d),column:c.column+d};a.splice(b,0,e)}}return a}}).call(a.prototype);p.RCodeModel=a;p.setVerticallyAlignFunctionArgs=function(a){b=a};p.getVerticallyAlignFunctionArgs=function(){return b}});var $colorFunctionCalls=!1;
define("mode/r_highlight_rules",["require","exports","module"],function(a,p,k){function g(a){for(var b=Array(a.length),d=0;d<a.length;d++)b[d]={include:a[d]};return b}k=a("ace/lib/oop");var n=a("ace/lib/lang"),l=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/utils"),e=function(){this.$rules={start:[{token:"comment",regex:"@@",merge:!1},{token:"keyword",regex:"\\\\[a-zA-Z0-9]+",merge:!1},{token:["keyword","comment"],regex:"(@(?:export|inheritParams|name|param|rdname|slot|template|useDynLib))(\\s+)(?=[a-zA-Z0-9._-])",merge:!1,
next:"rd-highlight"},{token:"keyword",regex:"@(?!@)[^ ]*",merge:!1},{token:["paren.keyword.operator","comment"],regex:"(\\[)(=)",merge:!1,next:"markdown-link"},{token:"paren.keyword.operator",regex:"\\[",merge:!1,next:"markdown-link"},{token:["support.function","support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)",merge:!1},{token:["comment","constant.language.boolean"],regex:"(\\s+|^)(__.+?__)\\b",merge:!1},{token:["comment","constant.language.boolean"],regex:"(\\s+|^)(_(?=[^_])(?:(?:\\\\.)|(?:[^_\\\\]))*?_)\\b",
merge:!1},{token:["constant.numeric"],regex:"([*][*].+?[*][*])",merge:!1},{token:["constant.numeric"],regex:"([*](?=[^*])(?:(?:\\\\.)|(?:[^*\\\\]))*?[*])",merge:!1},{token:"paren.keyword.operator",regex:"(?:[[({]|[\\])}])",merge:!1},{defaultToken:"comment"}],highlight:[{token:"identifier.support.function",regex:"[^ ,]+"},{token:"comment",regex:","},{token:"comment",regex:"\\s*",next:"start"}],"markdown-link":[{token:"paren.keyword.operator",regex:"\\]",next:"start"},{token:["identifier.support.class",
"comment"],regex:"([a-zA-Z0-9_.]+)(:{1,3})"},{token:"support.function",regex:"`.*?`"},{token:"support.function",regex:"[^{}()[\\]]+"},{token:"paren.keyword.operator",regex:"(?:[[({]|[\\])}])"},{defaultToken:"comment"}]};this.normalizeRules()};k.inherits(e,l);a=function(){var a=n.arrayToMap("function if else in break next repeat for while".split(" ")),c=n.arrayToMap("return switch try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass setRefClass R6Class UseMethod NextMethod".split(" ")),
d=n.arrayToMap("NULL NA TRUE FALSE T F Inf NaN NA_integer_ NA_real_ NA_character_ NA_complex_".split(" ")),h={"#comment":[{token:"comment.sectionhead",regex:"#+(?!').*(?:----|====|####)\\s*$",next:"start"},{token:["comment","comment.keyword.operator"],regex:"(#+'\\s*)(TODO|FIXME)\\b",next:"rd-start"},{token:"comment",regex:"#+'",next:"rd-start"},{token:["comment","comment.keyword.operator","comment"],regex:"(#+\\s*)(TODO|FIXME)\\b(.*)$",next:"start"},{token:"comment",regex:"#.*$",next:"start"}],"#string":[{token:"string",
regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',next:"start"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",next:"start"},{token:"string",merge:!0,regex:'["]',next:"qqstring"},{token:"string",merge:!0,regex:"[']",next:"qstring"}],"#number":[{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+[Li]?",merge:!1,next:"start"},{token:"constant.numeric",regex:"(?:(?:\\d+(?:\\.\\d*)?)|(?:\\.\\d+))(?:[eE][+\\-]?\\d*)?[iL]?",merge:!1,next:"start"}],"#quoted-identifier":[{token:"identifier",regex:"`.*?`",
merge:!1,next:"start"}],"#identifier":[{token:function(a){return d.hasOwnProperty(a)?"constant.language":a.match(/^\.\.\d+$/)?"variable.language":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*",next:"start"}],"#keyword-or-identifier":[{token:function(b){return d.hasOwnProperty(b)?"constant.language":a.hasOwnProperty(b)?"keyword":b.match(/^\.\.\d+$/)?"variable.language":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*",next:"start"}],"#package-access":[{token:function(a){return $colorFunctionCalls?"identifier.support.class":
"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*(?=\\s*::)",next:"start"}],"#function-call":[{token:function(a){return $colorFunctionCalls?"identifier.support.function":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*(?=\\s*\\()",next:"start"}],"#function-call-or-keyword":[{token:function(b){return c.hasOwnProperty(b)||a.hasOwnProperty(b)?"keyword":$colorFunctionCalls?"identifier.support.function":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*(?=\\s*\\()",next:"start"}],"#operator":[{token:"keyword.operator",
regex:"\\$|@",merge:!1,next:"afterDollar"},{token:"keyword.operator",regex:":::|::|:=|%%|>=|<=|==|!=|<<\\-|\\->>|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*\\*?|/|\\^|>|<|!|&|\\||~|\\$|:|@|\\?",merge:!1,next:"start"},{token:"keyword.operator.infix",regex:"%.*?%",merge:!1,next:"start"},{token:"paren.keyword.operator",merge:!1,regex:"[[({]",next:"start"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}]",next:"start"},{token:function(a){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},
regex:"[;]",merge:!1,next:"start"},{token:function(a){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},regex:"[,]",merge:!1,next:"start"}],"#text":[{token:"text",regex:"\\s+"}]};h.start=g("#comment #string #number #package-access #quoted-identifier #function-call-or-keyword #keyword-or-identifier #operator #text".split(" "));h.afterDollar=g("#comment #string #number #quoted-identifier #function-call #keyword-or-identifier #operator #text".split(" "));h.qqstring=[{token:"string",
regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+",merge:!0}];h.qstring=[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+",merge:!0}];this.$rules=h;var l=(new e).getRules(),k;for(k in l){h=l[k];for(var m=0;m<h.length;m++)if(f.isArray(h[m].token))for(var p=0;p<h[m].token.length;p++)h[m].token[p]+=".virtual-comment";else h[m].token+=".virtual-comment"}this.embedRules(l,"rd-",[{token:"text",regex:"^",next:"start"}]);this.normalizeRules()};
k.inherits(a,l);p.RHighlightRules=a;p.setHighlightRFunctionCalls=function(a){$colorFunctionCalls=a}});define("mode/r_matching_brace_outdent",["require","exports","module"],function(a,p,k){var g=a("ace/range").Range;a=function(a){this.codeModel=a};(function(){this.checkOutdent=function(a,l,f){return/^\s+$/.test(l)&&/^\s*[\{\}\)\]]/.test(f)||/^\s*}\s*$/.test(l)&&"\n"==f||/}\s*$/.test(l)&&/\n/.test(f)?!0:!1};this.autoOutdent=function(a,l,f){if(0===f)return 0;a=l.getLine(f);var e=a.match(/^(\s*[\}\)\]])/);if(e){e=e[1].length;var b=l.findMatchingBracket({row:f,column:e});if(!b||b.row==f)return 0;b=this.codeModel.getIndentForOpenBrace(b);
l.replace(new g(f,0,f,e-1),b)}if(e=a.match(/^(\s*\{)/))e=e[1].length,b=this.codeModel.getBraceIndent(f-1),l.replace(new g(f,0,f,e-1),b)}}).call(a.prototype);p.RMatchingBraceOutdent=a});define("mode/r_scope_tree",["require","exports","module"],function(a,p,k){function g(a,f){return a.row!=f.row?a.row-f.row:a.column-f.column}var n=function(a,f,e,b,c){this.label=a;if((this.start=f)&&e&&(e.row>f.row||e.row===f.row&&e.column>f.column))throw Error("Malformed preamble: should lie before start position");this.preamble=e||f;this.end=null;this.scopeType=b;this.parentScope=null;this.attributes=c||{};this.$children=[]};n.TYPE_ROOT=1;n.TYPE_BRACE=2;n.TYPE_CHUNK=3;n.TYPE_SECTION=4;(function(){this.isRoot=
function(){return this.scopeType==n.TYPE_ROOT};this.isBrace=function(){return this.scopeType==n.TYPE_BRACE};this.isChunk=function(){return this.scopeType==n.TYPE_CHUNK};this.isSection=function(){return this.scopeType==n.TYPE_SECTION};this.isFunction=function(){return this.isBrace()&&!!this.attributes.args};this.equals=function(a){return this.scopeType!==a.scopeType||this.start.row!==a.start.row||this.start.column!==a.start.column?!1:!0};this.addNode=function(a){a.end&&window.alert("[ASSERTION FAILED] New node is already closed");
0!=a.$children.length&&window.alert("[ASSERTION FAILED] New node already had children");if(!this.equals(a)){this.end=null;var f=this.$binarySearch(a.preamble);0<=f?this.$children[f].addNode(a):(f=-(f+1),f<this.$children.length&&(a.$children=this.$children.splice(f,this.$children.length-f)),a.parentScope=this,this.$children.push(a))}};this.closeScope=function(a,f){if(0==this.$children.length)return null;var e=this.$children[this.$children.length-1];if(e.end)return null;var b=e.closeScope(a,f);return b?
b:f==e.scopeType?(e.end=a,e.$forceDescendantsClosed(a),e):null};this.$forceDescendantsClosed=function(a){if(0!=this.$children.length){var f=this.$children[this.$children.length-1];f.end||(f.$forceDescendantsClosed(a),f.end=a)}};this.findNode=function(a){var f=this.$binarySearch(a);return 0<=f&&(a=this.$children[f].findNode(a))?(this.label&&a.unshift(this),a):this.label?[this]:null};this.$getFunctionStack=function(a){var f=this.$binarySearch(a);a=0<=f?this.$children[f].$getFunctionStack(a):[];this.isFunction()&&
a.push(this);return a};this.findFunctionDefinitionFromUsage=function(a,f){for(var e=this.$getFunctionStack(a),b=0;b<e.length;b++)for(var c=e[b],d=0;d<c.$children.length;d++)if(c.$children[d].label==f)return c.$children[d];return null};this.getFunctionsInScope=function(a){a=this.$getFunctionStack(a);for(var f=[],e=0;e<a.length;e++)f.push({name:a[e].attributes.name,args:a[e].attributes.args.slice()});return f};this.invalidateFrom=function(a){var f=this.$binarySearch(a);0<=f?0>=g(a,this.$children[f].start)?
a=this.$children[f].preamble:(a=this.$children[f].invalidateFrom(a),f++):f=-(f+1);f<this.$children.length&&this.$children.splice(f,this.$children.length-f);this.end=null;return a};this.$binarySearch=function(a,f,e){"undefined"===typeof f&&(f=0);"undefined"===typeof e&&(e=this.$children.length);if(f===e)return-(f+1);var b=Math.floor((f+e)/2),c=this.$children[b].comparePosition(a);return 0===c?b:0>c?this.$binarySearch(a,f,b):this.$binarySearch(a,b+1,e)};this.comparePosition=function(a){return 0>g(a,
this.preamble)?-1:null!=this.end&&0<=g(a,this.end)?1:0};this.printDebug=function(a){"undefined"===typeof a&&(a="");for(var f=0;f<this.$children.length;f++)this.$children[f].printDebug(a+"    ")}}).call(n.prototype);a=function(a){this.$ScopeNodeFactory=a||n;this.parsePos={row:0,column:0};this.$root=new this.$ScopeNodeFactory("(Top Level)",this.parsePos,null,n.TYPE_ROOT)};(function(){function a(e){count=e.isChunk()?1:0;e=e.$children||[];for(var b=0;b<e.length;b++)count+=a(e[b]);return count}this.getParsePosition=
function(){return this.parsePos};this.setParsePosition=function(a){this.parsePos=a};this.onSectionStart=function(a,b,c){"undefined"==typeof c&&(c={});var d=this.getActiveScopes(b);if(1<d.length){d=d[d.length-2].$children;for(var e=d.length-1;0<=e;e--)if(d[e].isSection()){this.$root.closeScope(b,n.TYPE_SECTION);break}}a=new this.$ScopeNodeFactory(a,b,b,n.TYPE_SECTION,c);this.$root.addNode(a)};this.onSectionEnd=function(a){this.$root.closeScope(a,n.TYPE_SECTION)};this.closeMarkdownHeaderScopes=function(a,
b,c){for(var d=a.$children,e=d.length-1;0<=e;e--){var f=d[e];if(f.isSection()&&f.attributes.depth>=c)return this.$root.closeScope(b,n.TYPE_SECTION),f.attributes.depth===c||a.isRoot()||null==a?void 0:this.closeMarkdownHeaderScopes(a.parentScope,b,c)}a.isRoot()||null==a||this.closeMarkdownHeaderScopes(a.parentScope,b,c)};this.onMarkdownHead=function(a,b,c,d){var e=this.getActiveScopes(b);1<e.length&&this.closeMarkdownHeaderScopes(e[e.length-2],b,d);this.$root.addNode(new this.$ScopeNodeFactory(a,c,
b,n.TYPE_SECTION,{depth:d,isMarkdown:!0}))};this.onChunkStart=function(a,b,c,d){this.$root.closeScope(c,n.TYPE_CHUNK);b=new this.$ScopeNodeFactory(b,d,c,n.TYPE_CHUNK);b.chunkLabel=a;this.$root.addNode(b);this.printScopeTree()};this.onChunkEnd=function(a){a=this.$root.closeScope(a,n.TYPE_CHUNK);this.printScopeTree();return a};this.onFunctionScopeStart=function(a,b,c,d,f){this.$root.addNode(new this.$ScopeNodeFactory(a,c,b,n.TYPE_BRACE,{name:d,args:f}));this.printScopeTree()};this.onNamedScopeStart=
function(a,b){this.$root.addNode(new this.$ScopeNodeFactory(a,b,null,n.TYPE_BRACE))};this.onScopeStart=function(a){this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,n.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){a=this.$root.closeScope(a,n.TYPE_BRACE);this.printScopeTree();return a};this.getActiveScopes=function(a){return this.$root.findNode(a)};this.getScopeList=function(){return this.$root.$children};this.findFunctionDefinitionFromUsage=function(a,b){return this.$root.findFunctionDefinitionFromUsage(a,
b)};this.getFunctionsInScope=function(a,b){return this.$root.getFunctionsInScope(a,b)};this.invalidateFrom=function(a){a={row:Math.max(0,a.row-1),column:0};0<g(this.parsePos,a)&&(this.parsePos=this.$root.invalidateFrom(a));this.printScopeTree()};this.getChunkCount=function(e){return a(this.$root)};this.getTopLevelScopeCount=function(){return this.$root.$children.length};this.printScopeTree=function(){};this.getAllFunctionScopes=function(){var a=[];f(this.$root,a);return a};var f=function(a,b){a.isFunction()&&
b.push(a);for(var c=a.$children,d=0;d<c.length;d++)f(c[d],b)}}).call(a.prototype);p.ScopeManager=a;p.ScopeNode=n});define("mode/rdoc",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/rdoc_highlight_rules").RDocHighlightRules,e=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent;a=function(a){a?(this.$highlightRules=new l,this.$tokenizer=new n((new l).getRules())):(this.$highlightRules=new f,this.$tokenizer=new n((new f).getRules()));this.$outdent=new e};k.inherits(a,
g);(function(){this.getNextLineIndent=function(a,c,d){return this.$getIndent(c)}}).call(a.prototype);p.Mode=a});define("mode/rdoc_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){var a="\\"+"name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage".replace(/\|/g,"|\\");this.createKeywordMapper({keyword:a},
"identifer");this.$rules={start:[{token:"comment",regex:"%.*$"},{token:"text",regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b",next:"nospell"},{token:"keyword",regex:"\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"},{token:"paren.keyword.operator",
regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],nospell:[{token:"comment",regex:"%.*$",next:"start"},{token:"nospell.text",regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b"},{token:"keyword",
regex:"\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",next:"start"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])]"},{token:"paren.keyword.operator",regex:"}",next:"start"},{token:"nospell.text",regex:"\\s+"},{token:"nospell.text",regex:"\\w+"}]}};k.inherits(g,a);p.RDocHighlightRules=g});define("mode/rhtml",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/html").Mode,n=a("ace/tokenizer").Tokenizer,l=a("mode/rhtml_highlight_rules").RHtmlHighlightRules,f=a("mode/r_code_model").RCodeModel,e=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,b=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,c=a("mode/utils");a=function(a,c){this.$session=c;this.$tokenizer=new n((new l).getRules());this.codeModel=new f(c,this.$tokenizer,/^r-/,/^\x3c!--\s*begin.rcode\s*(.*)/,
/^\s*end.rcode\s*--\x3e/);this.$outdent=new e;this.$r_outdent=new b(this.codeModel);this.foldingRules=this.codeModel};k.inherits(a,g);(function(){this.insertChunkInfo={value:"\x3c!--begin.rcode\n\nend.rcode--\x3e\n",position:{row:0,column:15},content_position:{row:1,column:0}};this.checkOutdent=function(a,b,e){return"r"===c.activeMode(a,"html")?this.$r_outdent.checkOutdent(a,b,e):this.$outdent.checkOutdent(b,e)};this.autoOutdent=function(a,b,e){return"r"===c.activeMode(a,"html")?this.$r_outdent.autoOutdent(a,
b,e):this.$outdent.autoOutdent(b,e)};this.getLanguageMode=function(a){return c.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"HTML"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,b,e,f){return"r"===c.activeMode(a,"html")?this.codeModel.getNextLineIndent(a,b,e,f):this.$getNextLineIndent(a,b,e)};this.$id="mode/rhtml"}).call(a.prototype);p.Mode=a});define("mode/rhtml_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("mode/r_highlight_rules").RHighlightRules,n=a("ace/mode/html_highlight_rules").HtmlHighlightRules;a=a("ace/mode/text_highlight_rules").TextHighlightRules;var l=function(){this.$rules=(new n).getRules();this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\x3c!--\\s*begin.rcode\\s*(?:.*)",next:"r-start"});var a=(new g).getRules();this.addRules(a,"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",
regex:"^\\s*end.rcode\\s*--\x3e",next:"start"})};k.inherits(l,a);p.RHtmlHighlightRules=l});define("mode/rmarkdown",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("mode/markdown").Mode,n=a("ace/tokenizer").Tokenizer,l=a("mode/rmarkdown_highlight_rules").RMarkdownHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,e=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,b=a("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,c=a("mode/r_code_model").RCodeModel,d=a("mode/cpp_code_model").CppCodeModel,h=a("rstudio/folding/rmarkdown").FoldMode,
q=a("ace/mode/folding/cstyle").FoldMode;a("mode/auto_brace_insert");var r=a("mode/utils"),m=a("ace/unicode");a=function(a,m){var g=this;this.$session=m;this.$tokenizer=new n((new l).getRules());this.$outdent=new f;this.codeModel=new c(m,this.$tokenizer,/^r-/,new RegExp(l.prototype.$reChunkStartString),new RegExp(l.prototype.$reChunkEndString));this.$r_outdent=new e(this.codeModel);this.cpp_codeModel=new d(m,this.$tokenizer,/^r-cpp-/,new RegExp(l.prototype.$reCppChunkStartString),new RegExp(l.prototype.$reChunkEndString));
this.$cpp_outdent=new b(this.cpp_codeModel);var k=new h,p=new q;this.$tokenizer.getLineTokens=function(a,b,c){0===c&&(b="firstLine");return n.prototype.getLineTokens.call(this,a,b,c)};this.foldingRules={getFoldWidget:function(a,b,c){var d=g.getLanguageMode({row:c,column:0}),e=a.getLine(c);return"Markdown"===d||r.startsWith(e,"```")||0===c?k.getFoldWidget(a,b,c):"C_CPP"===d?p.getFoldWidget(a,b,c):g.codeModel.getFoldWidget(a,b,c)},getFoldWidgetRange:function(a,b,c){var d=g.getLanguageMode({row:c,column:0}),
e=a.getLine(c);return"Markdown"===d||r.startsWith(e,"```")||0===c?k.getFoldWidgetRange(a,b,c):"C_CPP"===d?p.getFoldWidgetRange(a,b,c):g.codeModel.getFoldWidgetRange(a,b,c)}}};k.inherits(a,g);(function(){function a(a){return r.activeMode(a,"markdown")}this.insertChunkInfo={value:"```{r}\n\n```\n",position:{row:0,column:5},content_position:{row:1,column:0}};this.getLanguageMode=function(b){b=r.getPrimaryState(this.$session,b.row);b=a(b);return"r"===b?"R":"r-cpp"===b?"C_CPP":"yaml"===b?"YAML":"python"===
b?"Python":"sql"==b?"SQL":"stan"===b?"Stan":"Markdown"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(b,c,d,e,f){var h=a(b);return"r"===h?this.codeModel.getNextLineIndent(b,c,d,e):"r-cpp"===h?this.cpp_codeModel.getNextLineIndent(b,c,d,e,f):"yaml"===h?this.$getIndent(this.$session.getLine(e+1)):this.$getNextLineIndent(b,c,d)};this.checkOutdent=function(b,c,d){var e=a(b);return"r"===e?this.$r_outdent.checkOutdent(b,c,d):"r-cpp"===e?this.$cpp_outdent.checkOutdent(b,c,
d):"yaml"===e?!1:this.$outdent.checkOutdent(c,d)};this.autoOutdent=function(b,c,d){var e=a(b);if("r"===e)return this.$r_outdent.autoOutdent(b,c,d);if("r-cpp"===e)return this.$cpp_outdent.autoOutdent(b,c,d);if("yaml"!==e)return this.$outdent.autoOutdent(c,d)};this.transformAction=function(b,c,d,e,f){var h=a(b);return"r-cpp"===h?this.transformActionCpp(b,c,d,e,f):"yaml"===h?this.transformActionYaml(b,c,d,e,f):!1};this.transformActionCpp=function(a,b,c,d,e){if("insertion"===b)if("\n"===e){if(a=c.getSelectionRange().start,
(d=/^((\s*\/\/+')\s*)/.exec(d.doc.getLine(a.row)))&&c.getSelectionRange().start.column>=d[2].length)return{text:"\n"+d[1]}}else if("R"===e&&(a=c.getSelectionRange().start,(d=/^(\s*\/\*{3,}\s*)/.exec(d.doc.getLine(a.row)))&&c.getSelectionRange().start.column>=d[1].length))return{text:"R\n\n*/\n",selection:[1,0,1,0]};return!1};this.transformActionYaml=function(a,b,c,d,e){return"insertion"===b&&"\n"===e?(a=c.getCursorPosition().row,a=d.getLine(a),d=this.$getIndent(a),/[:({[]$/.test(a)?(a=this.$session.getTabString(),
{text:"\n"+d+a}):{text:"\n"+d}):!1};this.tokenRe=new RegExp("^["+m.wordChars+"._]+","g");this.nonTokenRe=new RegExp("^(?:[^"+m.wordChars+"._]|\\s)+","g");this.allowAutoInsert=this.smartAllowAutoInsert;this.$id="mode/rmarkdown"}).call(a.prototype);p.Mode=a});define("rstudio/folding/rmarkdown",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/folding/fold_mode").FoldMode,n=a("ace/range").Range;p=p.FoldMode=function(){};var l=a("mode/utils");k.inherits(p,g);(function(){this.getFoldWidget=function(a,b,c){b="markbeginend"===b?"end":"";var d=a.getLine(c),e=a.getState(c);a=0<c?a.getState(c-1):"start";if(l.startsWith(d,"===")||l.startsWith(d,"---")||l.startsWith(d,"..."))return l.startsWith(a,"yaml")?b:"start";if("start"===
e&&l.startsWith(d,"#"))return"start";a=d.trim();return l.startsWith(a,"```")?"start"===e?b:"start":""};var a=function(a,b,c,d,f){b=0===c?1:"start"===b?-1:1;var e={row:c,column:0};1===b&&(e.column=a.getLine(c).length);c+=b;for(var h=0<b?a.getLength():0;c!==h;){var m=a.getLine(c).trim();if(l.startsWith(m,d))break;if(f&&l.startsWith(m,f))break;c+=b}d={row:c,column:0};-1===b&&(d.column=a.getLine(c).length);return 1===b?n.fromPoints(e,d):n.fromPoints(d,e)};this.$getFoldWidgetRange=function(e,b,c){var d=
e.getState(c);b=e.getLine(c);var f=b.trim();if(l.startsWith(b,"```"))return a(e,d,c,"```");var g=0<c?e.getState(c-1):"start";f=0===c&&"---"===f;g=l.startsWith(g,"yaml");if(f||g)return a(e,d,c,"---",f?"...":void 0);if("="===b[0])g=1;else if("-"===b[0])g=2;else{g=/^(#+)(?:.*)$/.exec(b);if(!g)return;g=g[1].length}if(null!==g){a:{f=e.getLength();for(var k=c+1;k<f;k++)if(e.getState(k)===d){var m=e.getLine(k);if(1===g&&/^[=]{3,}\s*/.test(m)){d=k-2;break a}if(2===g&&/^[-]{3,}\s*/.test(m)){d=k-2;break a}if((m=
/^(#+)(?:.*)$/.exec(m))&&m[1].length<=g){d=k-1;break a}}d=f}return new n(c,b.length,d,e.getLine(d).length)}};this.getFoldWidgetRange=function(a,b,c){a=this.$getFoldWidgetRange(a,b,c);if(null!=a&&a.start.row!==a.end.row)return a}}).call(p.prototype)});define("mode/rmarkdown_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("mode/r_highlight_rules").RHighlightRules,n=a("mode/c_cpp_highlight_rules").c_cppHighlightRules,l=a("ace/mode/perl_highlight_rules").PerlHighlightRules,f=a("mode/python_highlight_rules").PythonHighlightRules,e=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,b=a("mode/markdown_highlight_rules").MarkdownHighlightRules,c=a("ace/mode/text_highlight_rules").TextHighlightRules,d=a("mode/yaml_highlight_rules").YamlHighlightRules,
h=a("mode/sh_highlight_rules").ShHighlightRules,q=a("mode/stan_highlight_rules").StanHighlightRules,r=a("mode/sql_highlight_rules").SqlHighlightRules,m=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,v=a("mode/utils");a=function(){this.$rules=(new b).getRules();this.$rules.firstLine=this.$rules.allowBlock.slice();v.embedRules(this,g,"r",this.$reChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,n,"r-cpp",this.$reCppChunkStartString,this.$reChunkEndString,
["start","listblock","allowBlock"]);v.embedRules(this,l,"perl",this.$rePerlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,f,"python",this.$rePythonChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,e,"ruby",this.$reRubyChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,b,"markdown",this.$reMarkdownChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);
v.embedRules(this,h,"sh",this.$reShChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,q,"stan",this.$reStanChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,r,"sql",this.$reSqlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,m,"js",this.$reJavaScriptChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);v.embedRules(this,d,"yaml","^\\s*---\\s*$",
"^\\s*(?:---|\\.\\.\\.)\\s*$",["firstLine"]);this.$rules["yaml-start"].unshift({token:["string"],regex:/((?:January|February|March|April|May|June|July|August|September|October|November|December)\s+\d+(?:st|nd|rd|s|n|r)?(?:\s*(?:,)?(?:\s*\d+)?)?)/});this.$rules["yaml-start"].push({defaultToken:"text.nospell"});this.normalizeRules()};k.inherits(a,c);(function(){function a(a){return"^(?:[ ]{4})?`{3,}\\s*\\{[Rr]\\b(?:.*)engine\\s*\\=\\s*['\"]"+a+"['\"](?:.*)\\}\\s*$|^(?:[ ]{4})?`{3,}\\s*\\{"+a+"\\b(?:.*)\\}\\s*$"}
this.$reChunkStartString="^(?:[ ]{4})?`{3,}\\s*\\{\\w+\\b(.*)\\}\\s*$";this.$reChunkEndString="^(?:[ ]{4})?`{3,}\\s*$";this.$reCppChunkStartString=a("[Rr]cpp");this.$reMarkdownChunkStartString=a("block");this.$rePerlChunkStartString=a("perl");this.$rePythonChunkStartString=a("python");this.$reRubyChunkStartString=a("ruby");this.$reShChunkStartString=a("(?:bash|sh)");this.$reStanChunkStartString=a("stan");this.$reSqlChunkStartString=a("sql");this.$reJavaScriptChunkStartString=a("(?:d3|js)")}).call(a.prototype);
p.RMarkdownHighlightRules=a});define("mode/sh",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/sh_highlight_rules").ShHighlightRules,l=a("ace/range").Range,f=a("ace/mode/folding/cstyle").FoldMode,e=a("ace/mode/behaviour/cstyle").CstyleBehaviour;a=function(){this.HighlightRules=n;this.foldingRules=new f;this.$behaviour=new e};k.inherits(a,g);(function(){this.lineCommentStart="#";this.getNextLineIndent=function(a,b,e){var c=this.$getIndent(b),d=this.getTokenizer().getLineTokens(b,
a).tokens;if(d.length&&"comment"==d[d.length-1].type)return c;"start"==a&&b.match(/^.*[\{\(\[:]\s*$/)&&(c+=e);return c};var a={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(b,d,e){if("\r\n"!==e&&"\r"!==e&&"\n"!==e)return!1;b=this.getTokenizer().getLineTokens(d.trim(),b).tokens;if(!b)return!1;do d=b.pop();while(d&&("comment"==d.type||"text"==d.type&&d.value.match(/^\s+$/)));return d?"keyword"==d.type&&a[d.value]:!1};this.autoOutdent=function(a,b,e){e+=1;a=this.$getIndent(b.getLine(e));
var c=b.getTabString();a.slice(-c.length)==c&&b.remove(new l(e,a.length-c.length,e,a.length))};this.$id="mode/sh"}).call(a.prototype);p.Mode=a});define("mode/sh_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=p.reservedKeywords="!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set|function|declare|readonly",n=p.languageConstructs="[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait",
l=function(){this.$rules={start:[{token:"constant",regex:/\\./},{token:["text","comment"],regex:/(^|\s)(#.*)$/},{token:"string.start",regex:'"',push:[{token:"constant.language.escape",regex:/\\(?:[$`"\\]|$)/},{include:"variables"},{token:"keyword.operator",regex:/`/},{token:"string.end",regex:'"',next:"pop"},{defaultToken:"string"}]},{token:"string",regex:"\\$'",push:[{token:"constant.language.escape",regex:/\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/},{token:"string",
regex:"'",next:"pop"},{defaultToken:"string"}]},{regex:"<<<",token:"keyword.operator"},{stateName:"heredoc",regex:"(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",onMatch:function(a,e,b){var c=e.substring(0,e.length-5);c="-"===a[2]?c+"indentedHeredoc":c+"heredoc";a=a.split(this.splitRegex);b.push(c,a[4],e);return[{type:"constant",value:a[1]},{type:"text",value:a[2]},{type:"string",value:a[3]},{type:"support.class",value:a[4]},{type:"string",value:a[5]}]},rules:{heredoc:[{onMatch:function(a,e,b){if(a===
b[1])return this.next=b[2],b.splice(-3),"support.class";this.next="";return"string"},regex:".*$"}],indentedHeredoc:[{token:"string",regex:"^\t+"},{onMatch:function(a,e,b){if(a===b[1])return this.next=b[2],b.splice(-3),"support.class";this.next="";return"string"},regex:".*$"}]}},{regex:"$",token:"empty",next:function(a,e){return/heredoc$/i.test(e[0])?e[0]:a}},{token:["keyword","text","text","text","variable"],regex:/(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/},{token:"variable.language",
regex:"(?:\\$(?:SHLVL|\\$|\\!|\\?))"},{token:"variable",regex:"(?:[a-zA-Z_][a-zA-Z0-9_]*(?==))"},{include:"variables"},{token:"support.function",regex:"(?:[a-zA-Z_][a-zA-Z0-9_]*\\s*\\(\\))"},{token:"support.function",regex:"(?:&(?:\\d+))"},{token:"string",start:"'",end:"'"},{token:"constant.numeric",regex:"(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+)))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))"},{token:"constant.numeric",regex:"(?:(?:[1-9]\\d*)|(?:0))\\b"},{token:this.createKeywordMapper({keyword:g,
"support.function.builtin":n,"invalid.deprecated":"debugger"},"identifier"),regex:"[a-zA-Z_][a-zA-Z0-9_]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"},{token:"punctuation.operator",regex:";"},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]]"},{token:"paren.rparen",regex:"[\\)\\}]",next:function(a,e){if(2>e.length)return a;e.shift();return e.shift()}}],variables:[{token:"variable",regex:/(\$)(\w+)/},{token:["variable","paren.lparen"],
regex:/(\$)(\()/,push:"start"},{token:["variable","paren.lparen","keyword.operator","variable","keyword.operator"],regex:/(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,push:"start"},{token:"variable",regex:/\$[*@#?\-$!0_]/},{token:["variable","paren.lparen"],regex:/(\$)(\{)/,push:"start"}]};this.normalizeRules()};k.inherits(l,a);p.ShHighlightRules=l});define("mode/sql",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/sql_highlight_rules").SqlHighlightRules;a("ace/range");a=function(){this.HighlightRules=n};k.inherits(a,g);a.prototype.lineCommentStart="--";a.prototype.$id="mode/sql";p.Mode=a});define("mode/sql_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",start:"/\\*",end:"\\*/"},{token:"comment.doc.tag",regex:"\\?[a-zA-Z_][a-zA-Z0-9_$]*"},{token:"paren.keyword.operator",merge:!1,regex:"[[({]",next:"start"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}]",next:"start"},{token:"string",
regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:this.createKeywordMapper({"support.function":"avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl",keyword:"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|foreign|not|references|default|null|inner|cross|natural|database|drop|grant|into|values|between|like|in|alter|index|view|exists|full|distinct|top|truncate|all",
"constant.language":"true|false","storage.type":"int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|money|real|number|integer"},"identifier",!0),regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=|\\."},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]};this.normalizeRules()};k.inherits(g,a);p.SqlHighlightRules=g});define("mode/stan",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,f=a("mode/stan_highlight_rules").StanHighlightRules,e=a("ace/mode/folding/cstyle").FoldMode;a=function(){this.$highlightRules=new f;this.$tokenizer=new n(this.$highlightRules.getRules());this.$outdent=new l;this.foldingRules=new e};k.inherits(a,g);(function(){this.lineCommentStart=["//","#"];this.blockComment=
{start:"/*",end:"*/"};this.toggleCommentLines=function(a,c,d,e){var b=!0;a=/^(\s*)\/\//;for(var f=d;f<=e;f++)if(!a.test(c.getLine(f))){b=!1;break}if(b)for(b=new Range(0,0,0,0),f=d;f<=e;f++)d=c.getLine(f).match(a),b.start.row=f,b.end.row=f,b.end.column=d[0].length,c.replace(b,d[1]);else c.indentRows(d,e,"//")};this.getLanguageMode=function(a){return"Stan"};this.getNextLineIndent=function(a,c,d){var b=this.$getIndent(c),e=this.getTokenizer().getLineTokens(c,a).tokens;if(e.length&&"comment"==e[e.length-
1].type)return b;"start"==a&&c.match(/^.*(?:[\{\(\[])\s*$/)&&(b+=d);return b};this.checkOutdent=function(a,c,d){return this.$outdent.checkOutdent(c,d)};this.autoOutdent=function(a,c,d){this.$outdent.autoOutdent(c,d)};this.$id="mode/stan"}).call(a.prototype);p.Mode=a});define("mode/stan_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:"comment.line.number-sign",regex:"\\/\\/.*$"},{token:"comment.line.double-dash",regex:"#.*$"},{token:"comment.block",regex:"\\/\\*",merge:!0,next:"comment"},{token:"keyword.other.block",regex:"\\b(functions|data|transformed\\s+data|parameters|transformed\\s+parameters|model|generated\\s+quantities)\\b"},
{token:"string.quoted.double",regex:'["][ a-zA-Z0-9~@#$%^&*_\'`\\-+={}[\\]()<>|/!?.,;:]*["]'},{token:"constant.numeric",regex:"(?:(?:\\d+(?:\\.\\d*)?)|(?:\\.\\d+))(?:[eE][+\\-]?\\d*)?\\b"},{token:"keyword.operator",regex:"\\bT(?=\\s*\\[)"},{token:["keyword.other","text","punctuation"],regex:"(lower|upper)(\\s*)(=)"},{token:["keyword.other","text","keyword.operator"],regex:"(target)(\\s*)(\\+=)"},{token:"keyword.control",regex:"\\b(for|in|while|if|then|else|return)\\b"},{token:"keyword.other",regex:"\\b(print|reject)\\b"},
{token:"storage.type",regex:"\\b(int|real|vector|simplex|unit_vector|ordered|positive_ordered|row_vector|matrix|cholesky_factor_cov|cholesky_factor_corr|corr_matrix|cov_matrix|void)\\b"},{token:"invalid.deprecated",regex:"\\b(bernoulli_ccdf_log|bernoulli_cdf_log|bernoulli_log|bernoulli_logit_log|beta_binomial_ccdf_log|beta_binomial_cdf_log|beta_binomial_log|beta_ccdf_log|beta_cdf_log|beta_log|binomial_ccdf_log|binomial_cdf_log|binomial_coefficient_log|binomial_log|binomial_logit_log|categorical_log|categorical_logit_log|cauchy_ccdf_log|cauchy_cdf_log|cauchy_log|chi_square_ccdf_log|chi_square_cdf_log|chi_square_log|dirichlet_log|double_exponential_ccdf_log|double_exponential_cdf_log|double_exponential_log|exp_mod_normal_ccdf_log|exp_mod_normal_cdf_log|exp_mod_normal_log|exponential_ccdf_log|exponential_cdf_log|exponential_log|frechet_ccdf_log|frechet_cdf_log|frechet_log|gamma_ccdf_log|gamma_cdf_log|gamma_log|gaussian_dlm_obs_log|get_lp|gumbel_ccdf_log|gumbel_cdf_log|gumbel_log|hypergeometric_log|increment_log_prob|integrate_ode|inv_chi_square_ccdf_log|inv_chi_square_cdf_log|inv_chi_square_log|inv_gamma_ccdf_log|inv_gamma_cdf_log|inv_gamma_log|inv_wishart_log|lkj_corr_cholesky_log|lkj_corr_log|logistic_ccdf_log|logistic_cdf_log|logistic_log|lognormal_ccdf_log|lognormal_cdf_log|lognormal_log|multi_gp_cholesky_log|multi_gp_log|multi_normal_cholesky_log|multi_normal_log|multi_normal_prec_log|multi_student_t_log|multinomial_log|multiply_log|neg_binomial_2_ccdf_log|neg_binomial_2_cdf_log|neg_binomial_2_log|neg_binomial_2_log_log|neg_binomial_ccdf_log|neg_binomial_cdf_log|neg_binomial_log|normal_ccdf_log|normal_cdf_log|normal_log|ordered_logistic_log|pareto_ccdf_log|pareto_cdf_log|pareto_log|pareto_type_2_ccdf_log|pareto_type_2_cdf_log|pareto_type_2_log|poisson_ccdf_log|poisson_cdf_log|poisson_log|poisson_log_log|rayleigh_ccdf_log|rayleigh_cdf_log|rayleigh_log|scaled_inv_chi_square_ccdf_log|scaled_inv_chi_square_cdf_log|scaled_inv_chi_square_log|skew_normal_ccdf_log|skew_normal_cdf_log|skew_normal_log|student_t_ccdf_log|student_t_cdf_log|student_t_log|uniform_ccdf_log|uniform_cdf_log|uniform_log|von_mises_log|weibull_ccdf_log|weibull_cdf_log|weibull_log|wiener_log|wishart_log)\\b"},
{token:["keyword.operator.sampling","text","support.function"],regex:"(~)(\\s*)(bernoulli|bernoulli_logit|beta|beta_binomial|binomial|binomial_logit|categorical|categorical_logit|cauchy|chi_square|dirichlet|double_exponential|exp_mod_normal|exponential|frechet|gamma|gaussian_dlm_obs|gumbel|hypergeometric|inv_chi_square|inv_gamma|inv_wishart|lkj_corr|lkj_corr_cholesky|logistic|lognormal|multi_gp|multi_gp_cholesky|multi_normal|multi_normal_cholesky|multi_normal_prec|multi_student_t|multinomial|neg_binomial|neg_binomial_2|neg_binomial_2_log|normal|ordered_logistic|pareto|pareto_type_2|poisson|poisson_log|rayleigh|scaled_inv_chi_square|skew_normal|student_t|uniform|von_mises|weibull|wiener|wishart)\\b"},
{token:"support.function",regex:"\\b(Phi|Phi_approx|abs|acos|acosh|append_col|append_row|asin|asinh|atan|atan2|atanh|bernoulli_cdf|bernoulli_lccdf|bernoulli_lcdf|bernoulli_logit_lpmf|bernoulli_lpmf|bernoulli_rng|bessel_first_kind|bessel_second_kind|beta_binomial_cdf|beta_binomial_lccdf|beta_binomial_lcdf|beta_binomial_lpmf|beta_binomial_rng|beta_cdf|beta_lccdf|beta_lcdf|beta_lpdf|beta_rng|binary_log_loss|binomial_cdf|binomial_lccdf|binomial_lcdf|binomial_logit_lpmf|binomial_lpmf|binomial_rng|block|categorical_logit_lpmf|categorical_lpmf|categorical_rng|cauchy_cdf|cauchy_lccdf|cauchy_lcdf|cauchy_lpdf|cauchy_rng|cbrt|ceil|chi_square_cdf|chi_square_lccdf|chi_square_lcdf|chi_square_lpdf|chi_square_rng|cholesky_decompose|col|cols|columns_dot_product|columns_dot_self|cos|cosh|cov_exp_quad|crossprod|csr_extract_u|csr_extract_v|csr_extract_w|csr_matrix_times_vector|csr_to_dense_matrix|cumulative_sum|determinant|diag_matrix|diag_post_multiply|diag_pre_multiply|diagonal|digamma|dims|dirichlet_lpdf|dirichlet_rng|distance|dot_product|dot_self|double_exponential_cdf|double_exponential_lccdf|double_exponential_lcdf|double_exponential_lpdf|double_exponential_rng|e|eigenvalues_sym|eigenvectors_sym|erf|erfc|exp|exp2|exp_mod_normal_cdf|exp_mod_normal_lccdf|exp_mod_normal_lcdf|exp_mod_normal_lpdf|exp_mod_normal_rng|expm1|exponential_cdf|exponential_lccdf|exponential_lcdf|exponential_lpdf|exponential_rng|fabs|falling_factorial|fdim|floor|fma|fmax|fmin|fmod|frechet_cdf|frechet_lccdf|frechet_lcdf|frechet_lpdf|frechet_rng|gamma_cdf|gamma_lccdf|gamma_lcdf|gamma_lpdf|gamma_p|gamma_q|gamma_rng|gaussian_dlm_obs_lpdf|gumbel_cdf|gumbel_lccdf|gumbel_lcdf|gumbel_lpdf|gumbel_rng|head|hypergeometric_lpmf|hypergeometric_rng|hypot|inc_beta|int_step|integrate_ode_bdf|integrate_ode_rk45|inv|inv_chi_square_cdf|inv_chi_square_lccdf|inv_chi_square_lcdf|inv_chi_square_lpdf|inv_chi_square_rng|inv_cloglog|inv_gamma_cdf|inv_gamma_lccdf|inv_gamma_lcdf|inv_gamma_lpdf|inv_gamma_rng|inv_logit|inv_phi|inv_sqrt|inv_square|inv_wishart_lpdf|inv_wishart_rng|inverse|inverse_spd|is_inf|is_nan|lbeta|lchoose|lgamma|lkj_corr_cholesky_lpdf|lkj_corr_cholesky_rng|lkj_corr_lpdf|lkj_corr_rng|lmgamma|lmultiply|log|log10|log1m|log1m_exp|log1m_inv_logit|log1p|log1p_exp|log2|log_determinant|log_diff_exp|log_falling_factorial|log_inv_logit|log_mix|log_rising_factorial|log_softmax|log_sum_exp|logistic_cdf|logistic_lccdf|logistic_lcdf|logistic_lpdf|logistic_rng|logit|lognormal_cdf|lognormal_lccdf|lognormal_lcdf|lognormal_lpdf|lognormal_rng|machine_precision|max|mdivide_left_spd|mdivide_left_tri_low|mdivide_right_spd|mdivide_right_tri_low|mean|min|modified_bessel_first_kind|modified_bessel_second_kind|multi_gp_cholesky_lpdf|multi_gp_lpdf|multi_normal_cholesky_lpdf|multi_normal_cholesky_rng|multi_normal_lpdf|multi_normal_prec_lpdf|multi_normal_rng|multi_student_t_lpdf|multi_student_t_rng|multinomial_lpmf|multinomial_rng|multiply_lower_tri_self_transpose|neg_binomial_2_cdf|neg_binomial_2_lccdf|neg_binomial_2_lcdf|neg_binomial_2_log_lpmf|neg_binomial_2_log_rng|neg_binomial_2_lpmf|neg_binomial_2_rng|neg_binomial_cdf|neg_binomial_lccdf|neg_binomial_lcdf|neg_binomial_lpmf|neg_binomial_rng|negative_infinity|normal_cdf|normal_lccdf|normal_lcdf|normal_lpdf|normal_rng|not_a_number|num_elements|ordered_logistic_lpmf|ordered_logistic_rng|owens_t|pareto_cdf|pareto_lccdf|pareto_lcdf|pareto_lpdf|pareto_rng|pareto_type_2_cdf|pareto_type_2_lccdf|pareto_type_2_lcdf|pareto_type_2_lpdf|pareto_type_2_rng|pi|poisson_cdf|poisson_lccdf|poisson_lcdf|poisson_log_lpmf|poisson_log_rng|poisson_lpmf|poisson_rng|positive_infinity|pow|prod|qr_Q|qr_R|quad_form|quad_form_diag|quad_form_sym|rank|rayleigh_cdf|rayleigh_lccdf|rayleigh_lcdf|rayleigh_lpdf|rayleigh_rng|rep_array|rep_matrix|rep_row_vector|rep_vector|rising_factorial|round|row|rows|rows_dot_product|rows_dot_self|scaled_inv_chi_square_cdf|scaled_inv_chi_square_lccdf|scaled_inv_chi_square_lcdf|scaled_inv_chi_square_lpdf|scaled_inv_chi_square_rng|sd|segment|sin|singular_values|sinh|size|skew_normal_cdf|skew_normal_lccdf|skew_normal_lcdf|skew_normal_lpdf|skew_normal_rng|softmax|sort_asc|sort_desc|sort_indices_asc|sort_indices_desc|sqrt|sqrt2|square|squared_distance|step|student_t_cdf|student_t_lccdf|student_t_lcdf|student_t_lpdf|student_t_rng|sub_col|sub_row|sum|tail|tan|tanh|target|tcrossprod|tgamma|to_array_1d|to_array_2d|to_matrix|to_row_vector|to_vector|trace|trace_gen_quad_form|trace_quad_form|trigamma|trunc|uniform_cdf|uniform_lccdf|uniform_lcdf|uniform_lpdf|uniform_rng|variance|von_mises_lpdf|von_mises_rng|weibull_cdf|weibull_lccdf|weibull_lcdf|weibull_lpdf|weibull_rng|wiener_lpdf|wishart_lpdf|wishart_rng)\\b"},
{token:"invalid.illegal",regex:"\\b(STAN_MAJOR|STAN_MATH_MAJOR|STAN_MATH_MINOR|STAN_MATH_PATCH|STAN_MINOR|STAN_PATCH|alignas|alignof|and|and_eq|asm|auto|bitand|bitor|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|const_cast|constexpr|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|fvar|goto|if|in|inline|int|long|lp__|mutable|namespace|new|noexcept|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|repeat|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|then|this|thread_local|throw|true|try|typedef|typeid|typename|union|unsigned|until|using|var|virtual|void|volatile|wchar_t|while|xor|xor_eq)\\b"},
{token:"invalid.illegal",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b__\\b"},{token:"invalid.illegal",regex:"\\b(?:_|[_0-9][A-Za-z0-9_]+|[A-Za-z][A-Za-z0-9_]*__)\\b"},{token:"function",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b(?=\\s*\\()"},{token:"identifier",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b"},{token:"invalid.deprecated",regex:"<-"},{token:"keyword.operator",regex:"~|[|]{2}|&&|==?|!=|<=?|>=?|\\+|-|\\.?\\*|\\.?/|\\\\|\\^|!|'|%|\\?|:"},{token:"punctuation.operator",regex:",|;|[|]"},{token:"paren.lparen.keyword.operator",
regex:"[\\[\\(\\{]"},{token:"paren.rparen.keyword.operator",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}]}};k.inherits(g,a);p.StanHighlightRules=g});define("mode/sweave",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/sweave_highlight_rules").SweaveHighlightRules,e=a("mode/r_code_model").RCodeModel,b=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,c=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,d=a("ace/unicode"),h=a("mode/utils");a("mode/auto_brace_insert");a=function(a,d){this.$tokenizer=
a?new n((new l).getRules()):new n((new f).getRules());this.$session=d;this.$outdent=new b;this.codeModel=new e(d,this.$tokenizer,/^r-/,/<<(.*?)>>/,/^\s*@\s*$/);this.$r_outdent=new c(this.codeModel);this.foldingRules=this.codeModel};k.inherits(a,g);(function(){this.tokenRe=new RegExp("^["+d.wordChars+"._]+","g");this.nonTokenRe=new RegExp("^(?:[^"+d.wordChars+"._]|\\s)+","g");this.$complements={"(":")","[":"]",'"':'"',"'":"'","{":"}"};this.$reOpen=/^[(["'{]$/;this.$reClose=/^[)\]"'}]$/;this.insertChunkInfo=
{value:"<<>>=\n\n@\n",position:{row:0,column:2},content_position:{row:1,column:0}};this.getLanguageMode=function(a){return h.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"TeX"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,b,c,d){return"r"===h.activeMode(a,"tex")?this.codeModel.getNextLineIndent(a,b,c,d):this.$getNextLineIndent(a,b,c)};this.checkOutdent=function(a,b,c){return"r"===h.activeMode(a,"tex")?this.$r_outdent.checkOutdent(a,b,c):this.$outdent.checkOutdent(b,
c)};this.autoOutdent=function(a,b,c){return"r"===h.activeMode(a,"tex")?this.$r_outdent.autoOutdent(a,b,c):this.$outdent.autoOutdent(b,c)};this.allowAutoInsert=this.smartAllowAutoInsert;this.$id="mode/sweave"}).call(a.prototype);p.Mode=a});define("mode/sweave_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("mode/tex_highlight_rules").TexHighlightRules,n=a("mode/r_highlight_rules").RHighlightRules;a=a("ace/mode/text_highlight_rules").TextHighlightRules;var l=function(){this.$rules=(new g).getRules();this.$rules.start.unshift({token:"comment.codebegin",regex:"^\\s*\\<\\<.*\\>\\>=.*$",next:"r-start"});this.$rules.start.unshift({token:"comment",regex:"^\\s*@(?:\\s.*)?$"});this.$rules.start.unshift({regex:"(\\\\Sexpr)([{])",
next:"r-start",onMatch:function(a,b,c,d){c.length=2;c[0]=b;c[1]=1;return[{type:"keyword",value:"\\Sexpr"},{type:"paren.keyword.operator",value:"{"}]}});var a=(new n).getRules();this.addRules(a,"r-");this.$rules["r-start"].unshift({token:"paren.keyword.operator",regex:"[{]",merge:!1,onMatch:function(a,b,c,d){c.length&&(c[1]+=1);return this.token}});this.$rules["r-start"].unshift({token:"paren.keyword.operator",regex:"[}]",merge:!1,onMatch:function(a,b,c,d){this.next="r-start";c.length&&(--c[1],0==
c[1]&&(this.next=c[0],c.splice(0)));return this.token}});this.$rules["r-start"].unshift({token:"comment.codeend",regex:"^\\s*@(?:\\s.*)?$",next:"start"});this.$rules["r-start"].unshift({token:"comment.codebegin",regex:"^\\<\\<.*\\>\\>=.*$",next:"r-start"})};k.inherits(l,a);p.SweaveHighlightRules=l});define("mode/tex",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/tex_highlight_rules").TexHighlightRules,e=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent;a=function(a){this.$tokenizer=a?new n((new l).getRules()):new n((new f).getRules());this.$outdent=new e};k.inherits(a,g);(function(){this.getNextLineIndent=function(a,c,d){return this.$getIndent(c)};
this.allowAutoInsert=function(){return!1}}).call(a.prototype);p.Mode=a});define("mode/tex_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(a){a||(a="text");this.$rules={start:[{token:"comment",regex:"%.*$"},{token:a,regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
next:"nospell"},{token:"keyword",regex:"\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])}]"},{token:a,regex:"\\s+"}],nospell:[{token:"comment",regex:"%.*$",next:"start"},{token:"nospell."+a,regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"},
{token:"keyword",regex:"\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",next:"start"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])]"},{token:"paren.keyword.operator",regex:"}",next:"start"},{token:"nospell."+a,regex:"\\s+"},{token:"nospell."+a,regex:"\\w+"}]}};k.inherits(g,a);p.TexHighlightRules=g});define("mode/token_cursor",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("mode/utils"),n=function(a,b,c){this.$tokens=a;this.$row=b||0;this.$offset=c||0};(function(){this.cloneCursor=function(){return new n(this.$tokens,this.$row,this.$offset)};var a=g.isArray,b=g.contains,c={"(":")","{":"}","<":">","[":"]",")":"(","}":"{",">":"<","]":"["},d=["(","[","{"],f=[")","]","}"];this.moveToStartOfRow=function(a){this.$row=a;this.$offset=0};this.moveToEndOfRow=function(a){this.$row=
a;this.$offset=(a=this.$tokens[a])&&a.length?a.length-1:0};this.moveToPreviousToken=function(){if(0>=this.$row&&0>=this.$offset)return this.$offset=this.$row=0,!1;if(0<this.$offset)return this.$offset--,!0;for(var a=this.$row-1,b=0;0<=a;){var c=this.$tokens[a];if(c&&0!==c.length){b=c.length;break}a--}if(0>a)return!1;this.$row=a;this.$offset=b-1;return!0};this.moveToNextToken=function(a){"undefined"===typeof a&&(a=(this.$tokens||[]).length);if(this.$row>a)return!1;null==this.$tokens[this.$row]&&this.$codeModel&&
this.$codeModel.$tokenizeUpToRow&&this.$codeModel.$tokenizeUpToRow.call(this.$codeModel,a);var b=this.$tokens[this.$row];if(b&&this.$offset<b.length-1)return this.$offset++,!0;for(var c=this.$row+1;c<=a&&(!(b=this.$tokens[c])||0===b.length);)c++;if(c>a)return!1;this.$row=c;this.$offset=0;return!0};this.peekBwd=function(a){"undefined"===typeof a&&(a=1);for(var b=this.cloneCursor(),c=0;c<a;c++)if(!b.moveToPreviousToken())return b.$invalidate();return b};this.peekFwd=function(a){"undefined"===typeof a&&
(a=1);for(var b=this.cloneCursor(),c=0;c<a;c++)if(!b.moveToNextToken())return b.$invalidate();return b};this.$invalidate=function(){this.$column=this.$row=0;this.$tokens=[];return this};this.seekToNearestToken=function(a,b){if(a.row>b)return!1;this.$row=a.row;var c=this.$tokens[this.$row]||[];for(this.$offset=0;this.$offset<c.length;this.$offset++)if(c[this.$offset].column>=a.column)return!0;return a.row<b?this.moveToNextToken(b):!1};this.bwdToNearestToken=function(a){this.$row=a.row;this.$offset=
a.column;for(var b=this.$tokens[this.$row]||[];0<=this.$offset;this.$offset--){var c=b[this.$offset];if("undefined"!==typeof c&&c.column<=a.column)return!0}return this.moveToPreviousToken()};this.bwdToMatchingToken=function(){var a=this.currentValue();if(!b(f,a))return!1;for(var d=c[a],e=0;this.moveToPreviousToken();){var h=this.currentValue();if(h===d){if(0===e)return!0;e--}else h===a&&e++}return!1};this.fwdToMatchingToken=function(){var a=this.currentValue();if(!b(d,a))return!1;for(var e=c[a],f=
0;this.moveToNextToken();){var h=this.currentValue();if(h===e){if(0===f)return!0;f--}else h===a&&f++}return!1};this.equals=function(a){return this.$row===a.$row&&this.$offset===a.$offset};this.moveBackwardOverMatchingParens=function(){if(!this.moveToPreviousToken())return!1;if(")"!==this.currentValue())return this.moveToNextToken(),!1;for(var a=!1,b=0;this.moveToPreviousToken();){var c=this.currentValue();if("("===c){if(0===b){a=!0;break}b--}else")"===c&&b++}return a};this.findToken=function(a,b){do{var c=
this.currentToken();if(c&&a(c))return c}while(this.moveToNextToken(b));return null};this.findTokenBwd=function(a,b){do{var c=this.currentToken();if(c&&a(c))return c}while(this.moveToPreviousToken(b));return null};this.currentToken=function(){var a=this.$tokens[this.$row];if(null==a)return{};a=a[this.$offset];return null==a?{}:a};this.currentValue=function(){return this.currentToken().value};this.currentType=function(){return this.currentToken().type};this.hasType=function(){var a=this.currentType();
if(null==a)return!1;for(var b=0;b<arguments.length;b++){var c=arguments[b];if(a===c||-1!==a.indexOf(c+".")||-1!==a.indexOf("."+c))return!0}return!1};this.currentPosition=function(){var a=this.currentToken();return null==a?null:{row:this.$row,column:a.column}};this.isFirstSignificantTokenOnLine=function(){return 0===this.$offset};this.isLastSignificantTokenOnLine=function(){return this.$offset==(this.$tokens[this.$row]||[]).length-1};this.bwdUntil=function(a){for(;!a(this);)this.moveToPreviousToken()};
this.bwdWhile=function(a){for(;a(this);)this.moveToPreviousToken()};this.moveToPosition=function(a,b){var c=a.row,d=a.column,e=this.$tokens[c];null==e&&this.$codeModel&&this.$codeModel.$tokenizeUpToRow&&(this.$codeModel.$tokenizeUpToRow.call(this.$codeModel,c),e=this.$tokens[c]);if(e&&0<e.length&&e[0].column<=d){for(var f=0;f<e.length&&!(e[f].column>=d);f++);this.$row=c;this.$offset=f===e.length?f-1:b&&e[f].column===d?f:f-1;return!0}d=this.cloneCursor();d.$row=c;d.$offset=0;return d.moveToPreviousToken()?
(this.$row=d.$row,this.$offset=d.$offset,!0):!1};this.findOpeningBracket=function(b,c){a(b)||(b=[b]);var d=this.cloneCursor();do if(!d.bwdToMatchingToken()){var e=d.currentValue();if(c&&"{"===e)break;for(var f=0;f<b.length;f++)if(e===b[f])return this.$row=d.$row,this.$offset=d.$offset,!0}while(d.moveToPreviousToken());return!1};this.findOpeningBracketCountCommas=function(b,c){a(b)||(b=[b]);var d=this.cloneCursor(),e=0;do if(!d.bwdToMatchingToken()){var f=d.currentValue();","===f&&(e+=1);if(c&&"{"===
f)break;for(var h=0;h<b.length;h++)if(f===b[h])return this.$row=d.$row,this.$offset=d.$offset,e}while(d.moveToPreviousToken());return-1}}).call(n.prototype);var l=function(a,b,c,d){this.$tokens=a;this.$row=b||0;this.$offset=c||0;this.$codeModel=d};k.mixin(l.prototype,n.prototype);(function(){this.cloneCursor=function(){return new l(this.$tokens,this.$row,this.$offset,this.$codeModel)};var a=g.contains;this.bwdOverConstNoexceptDecltype=function(){var a=this.cloneCursor();if("{"!==a.currentValue()||
!a.moveToPreviousToken())return!1;var b=a.cloneCursor();")"===b.currentValue()&&b.bwdToMatchingToken()&&b.moveToPreviousToken()&&"decltype"===b.currentValue()&&b.moveToPreviousToken()&&(a.$row=b.$row,a.$offset=b.$offset);b=a.cloneCursor();")"===b.currentValue()&&b.bwdToMatchingToken()&&b.moveToPreviousToken()&&"noexcept"===b.currentValue()&&(a.$row=b.$row,a.$offset=b.$offset);if("noexcept"===a.currentValue()&&!a.moveToPreviousToken()||"const"===a.currentValue()&&!a.moveToPreviousToken()||")"===a.currentValue()&&
!a.moveToNextToken())return!1;this.$row=a.$row;this.$offset=a.$offset;return!0};this.bwdToMatchingArrow=function(){if(">"!==this.currentValue())return!1;for(var a=0,b=this.cloneCursor();b.moveToPreviousToken();)if("<"===b.currentValue()){if(0===a)return this.$row=b.$row,this.$offset=b.$offset,!0;a--}else">"===b.currentValue()&&a++;return!1};this.bwdOverClassySpecifiers=function(){var a=this.currentValue();":"!==a&&","!==a&&"{"!==a||this.moveToPreviousToken();do{this.bwdToMatchingArrow()&&this.moveToPreviousToken();
a=this.currentType();var b=this.currentValue();if("keyword"!==a&&"::"!==b&&"identifier"!==a&&"constant"!==a)break;if("class"===b||"struct"===b||"enum"===b||":"===b||","===b)return!0}while(this.moveToPreviousToken());return!1};this.bwdOverClassInheritance=function(){var a=this.cloneCursor();return b(a,this)};var b=function(a,d){a.bwdOverClassySpecifiers();var c=a.currentValue();return","===c?b(a,d):":"===c?(d.$row=a.$row,d.$offset=a.$offset,!0):!1};this.bwdOverInitializationList=function(){var a=this.cloneCursor();
return this.doBwdOverInitializationList(a,this)};this.doBwdOverInitializationList=function(b,d){b.moveBackwardOverMatchingParens();if(!b.moveBackwardOverMatchingParens()&&!b.moveToPreviousToken())return!1;for(;"keyword"===b.currentType();)if(!b.moveToPreviousToken())return!1;if(b.moveToPreviousToken()){var c=b.currentValue();if(","===c)return this.doBwdOverInitializationList(b,d);if(":"===c&&(c=b.peekBwd().currentValue(),!a(["public","private","protected"],c)))return d.$row=b.$row,d.$offset=b.$offset,
!0}return!1}}).call(l.prototype);var f=function(a,b,c,d){this.$tokens=a;this.$row=b||0;this.$offset=c||0;this.$codeModel=d};k.mixin(f.prototype,n.prototype);(function(){function a(a){return 0===a.indexOf("'")?a.lastIndexOf("'")===a.length-1:0===a.indexOf('"')?a.lastIndexOf('"')===a.length-1:!1}function b(a){return"("===a||"["===a||"{"===a}function c(a){return")"===a||"]"===a||"}"===a}this.cloneCursor=function(){return new f(this.$tokens,this.$row,this.$offset,this.$codeModel)};var d=g.contains;this.isValidAsIdentifier=
function(){var a=this.currentType();return this.hasType("identifier","constant")||"symbol"===a||"keyword"===a||"string"===a};this.isExtractionOperator=function(){var a=this.currentValue();return"$"===a||"@"===a||"::"===a||":::"===a};this.findStartOfEvaluationContext=function(){var a=this.cloneCursor();do if(!a.bwdToMatchingToken()){if(a.isValidAsIdentifier()){if(!a.moveToPreviousToken())break;if(a.isExtractionOperator())continue;if(!a.moveToNextToken())return!1;break}return!1}while(a.moveToPreviousToken());
this.$row=a.$row;this.$offset=a.$offset;return!0};this.isLookingAtBinaryOp=function(){var a=this.currentType();return"keyword.operator"===a||"keyword.operator.infix"===a};this.moveToStartOfCurrentStatement=function(){for(var a=this.cloneCursor();a.isLookingAtBinaryOp();)if(!a.moveToPreviousToken())return!1;do if(!a.bwdToMatchingToken()){if(a.isValidAsIdentifier()){if(!a.moveToPreviousToken())break;if(a.isLookingAtBinaryOp()){for(;a.isLookingAtBinaryOp();)if(!a.moveToPreviousToken())return!1;if(!a.moveToNextToken())return!1;
continue}if(!a.moveToNextToken())return!1;break}return!1}while(a.moveToPreviousToken());this.$row=a.$row;this.$offset=a.$offset;return!0};this.moveToEndOfCurrentStatement=function(){for(var a=this.cloneCursor();a.isLookingAtBinaryOp();)if(!a.moveToNextToken())return!1;do if(!a.fwdToMatchingToken()){if(a.isValidAsIdentifier()){if(!a.moveToNextToken())break;if(a.isLookingAtBinaryOp()){for(;a.isLookingAtBinaryOp();)if(!a.moveToNextToken())return!1;if(!a.moveToPreviousToken())return!1;continue}if(!a.moveToPreviousToken())return!1;
break}return!1}while(a.moveToNextToken());this.$row=a.$row;this.$offset=a.$offset;return!0};this.isSingleLineString=function(){return a(this.currentValue())};this.isLeftBracket=function(){return b(this.currentValue())};this.isRightBracket=function(){return c(this.currentValue())};this.isValidForEndOfStatement=function(){if("paren.keyword.operator"===this.currentType())return c(this.currentValue());var b=this.currentValue();return a(b)||this.hasType("identifier","constant","variable")};this.isValidForStartOfStatement=
function(){if("paren.keyword.operator"===this.currentType())return b(this.currentValue());var c=this.currentValue();return a(c)||this.hasType("identifier","constant","variable")};this.isConditionalControlFlowKeyword=function(){var a=this.currentValue();return d(["if","for","while","function"],a)};this.isControlFlowKeyword=function(){var a=this.currentValue();return d("if for while else function repeat break next".split(" "),a)};this.isAtStartOfNewExpression=function(a){var b=this.cloneCursor();return b.moveToPreviousToken()?
this.isValidForStartOfStatement()&&b.isValidForEndOfStatement()&&this.$row>b.$row?b.isControlFlowKeyword()||")"===b.currentValue()&&b.bwdToMatchingToken()&&b.moveToPreviousToken()&&b.isConditionalControlFlowKeyword()?!1:!0:!1:a}}).call(f.prototype);p.TokenCursor=n;p.CppTokenCursor=l;p.RTokenCursor=f});define("mode/token_utils",["require","exports","module"],function(a,p,k){a=function(a,n,l,f,e,b){this.$doc=a;this.$tokenizer=n;this.$tokens=l;this.$endStates=Array(a.getLength());this.$statePattern=f;this.$codeBeginPattern=e;this.$codeEndPattern=b};(function(){this.getTokenForPos=function(a,n,l){this.$tokenizeUpToRow(a.row);if(this.$tokens.length<=a.row)return null;for(var f=this.$tokens[a.row],e=0;e<f.length;e++){var b=f[e];if(n&&a.column==b.column)return b;if(a.column<=b.column)break;if(l&&a.column==
b.column+b.value.length||a.column<b.column+b.value.length)return b}return null};this.$tokenizeUpToRow=function(a){a=Math.min(a,this.$doc.getLength()-1);for(var g=0,l=!0;g<=a;g++)if(!l||!this.$endStates[g]){l=!1;var f=0===g?"start":this.$endStates[g-1],e=this.$doc.getLine(g);e=this.$tokenizer.getLineTokens(e,f,g);!this.$statePattern||this.$statePattern.test(e.state)||this.$statePattern.test(f)?this.$tokens[g]=this.$filterWhitespaceAndComments(e.tokens):this.$tokens[g]=[];e.state===this.$endStates[g]?
l=!0:this.$endStates[g]=e.state}l||g<this.$tokens.length&&this.$invalidateRow(g);return!0};this.$filterWhitespaceAndComments=function(a){a=a.filter(function(a){a=/\bcode(?:begin|end)\b/.test(a.type)?!1:/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a});for(var g=a.length-1;0<=g;g--)if(1<a[g].value.length&&/\bparen\b/.test(a[g].type)){var l=a[g];a.splice(g,1);for(var f=l.value.length-1;0<=f;f--){var e={type:l.type,value:l.value.charAt(f),
column:l.column+f};a.splice(g,0,e)}}return a};this.$invalidateRow=function(a){this.$tokens[a]=null;this.$endStates[a]=null};this.$insertNewRows=function(a,k){for(var g=[a,0],f=0;f<k;f++)g.push(null);this.$tokens.splice.apply(this.$tokens,g);this.$endStates.splice.apply(this.$endStates,g)};this.$removeRows=function(a,k){this.$tokens.splice(a,k);this.$endStates.splice(a,k)};this.$walkParens=function(a,k,l){var f=/\bparen\b/;return a<k?function(){for(;a<=k;a++)for(var e=this.$tokens[a],b=0;b<e.length;b++)if(f.test(e[b].type)&&
!l(e[b].value,{row:a,column:e[b].column}))return!1;return!0}.call(this):function(){a=Math.max(0,a);for(k=Math.max(0,k);a>=k;a--)for(var e=this.$tokens[a],b=e.length-1;0<=b;b--)if(f.test(e[b].type)&&!l(e[b].value,{row:a,column:e[b].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,k,l,f,e){var b=[],c=null;this.$walkParens(a,k,function(a,g){if(l&&l(b,a,g))return c=g,!1;if(/[\[({]/.test(a))if(b[b.length-1]===e[a])b.pop();else return!0;else b.push(a);return f&&f(b,a,g)?(c=g,
!1):!0});return c};this.$findNextSignificantToken=function(a,k){if(0==this.$tokens.length)return null;k=Math.min(k,this.$tokens.length-1);for(var g=a.row,f=a.column;g<=k;g++){for(var e=this.$tokens[g],b=0;b<e.length;b++)if(e[b].column+e[b].value.length>f)return{token:e[b],row:g,column:Math.max(e[b].column,f),offset:b};f=0}return null};this.findNextSignificantToken=function(a){return this.$findNextSignificantToken(a,this.$tokens.length-1)};this.$findPreviousSignificantToken=function(a,k){if(0==this.$tokens.length)return null;
k=Math.max(0,k);for(var g=Math.min(a.row,this.$tokens.length-1);g>=k;g--){var f=this.$tokens[g];if(0!=f.length){if(g!=a.row)return{row:g,column:f[f.length-1].column,token:f[f.length-1],offset:f.length-1};for(var e=f.length-1;0<=e;e--)if(f[e].column<a.column)return{row:g,column:f[e].column,token:f[e],offset:e}}}return null}}).call(a.prototype);p.TokenUtils=a});define("mode/utils",["require","exports","module"],function(a,p,k){a("ace/range");var g=a("ace/token_iterator").TokenIterator,n=a("ace/unicode");(function(){var a=this,f=new RegExp("^["+n.wordChars+"._]+","");this.construct=function(a,c){function b(){return a.apply(this,c)}b.prototype=a.prototype;return new b};this.contains=function(a,c){for(var b=0;b<a.length;b++)if(a[b]===c)return!0;return!1};this.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)};this.asArray=function(b){return a.isArray(b)?
b:[b]};this.getPrimaryState=function(b,c){return a.primaryState(b.getState(c))};this.primaryState=function(b){return a.isArray(b)?b[0]:b};this.activeMode=function(b,c){var d=a.primaryState(b),e=d.lastIndexOf("-");return-1===e?c:d.substring(0,e).toLowerCase()};this.endsWith=function(a,c){return-1!==a.indexOf(c,a.length-c.length)};this.escapeRegExp=function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};this.embedRules=function(b,c,d,e,f,g,l){"undefined"===typeof g&&(g=["start"]);
"undefined"===typeof l&&(l="start");g=a.asArray(g);l=b.$rules;for(var h=function(a,b,c,d){c.splice(0);return this.token},k=0;k<g.length;k++)l[g[k]].unshift({token:"support.function.codebegin",regex:e,onMatch:h,next:d+"-start"});b.embedRules(c,d+"-",[{token:"support.function.codeend",regex:f,onMatch:h,next:"start"}])};this.isSingleLineString=function(a){if(2>a.length)return!1;var b=a[0];return"'"!==b&&'"'!==b||a[a.length-1]!==b||"\\"===a[a.length-2]&&"\\"!==a[a.length-3]?!1:!0};this.createTokenIterator=
function(a){var b=a.getSelectionRange().start;a=a.getSession();return new g(a,b.row,b.column)};this.isWordCharacter=function(a){return f.test(a)};var e={"'":"'",'"':'"',"`":"`","{":"}","(":")","[":"]","<":">","}":"{",")":"(","]":"[",">":"<"};this.isBracket=function(a,c){return!c||"<"!==a&&">"!==a?"{"===a||"}"===a||"("===a||")"===a||"["===a||"]"===a:!0};this.isOpeningBracket=function(a,c){return"{"===a||"("===a||"["===a||!!c&&"<"===a};this.isClosingBracket=function(a,c){return"}"===a||")"===a||"]"===
a||!!c&&">"===a};this.getComplement=function(a,c){"undefined"===typeof c&&(c=e);var b=c[a];return"undefined"===typeof b?a:b};this.stripEnclosingQuotes=function(a){var b=a.length;if(2>b)return a;var d=a[0];return"'"!==d&&'"'!==d&&"`"!==d||a[b-1]!==d?a:a.substr(1,b-2)};this.startsWith=function(a,c){if("string"!==typeof a||"string"!==typeof c||a.length<c.length)return!1;for(var b=0;b<c.length;b++)if(a[b]!==c[b])return!1;return!0}}).call(p)});define("mode/xml",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,l=a("mode/xml_highlight_rules").XmlHighlightRules,f=a("mode/xml_behavior").XmlBehaviour,e=a("mode/xml_fold_mode").FoldMode;a=function(){this.$tokenizer=new n((new l).getRules());this.$behaviour=new f;this.foldingRules=new e};k.inherits(a,g);(function(){this.getNextLineIndent=function(a,c,d){return this.$getIndent(c)}}).call(a.prototype);p.Mode=a});define("mode/xml_behavior",["require","exports","module"],function(a,p,k){function g(a,b){var c=!0,d=a.type.split(".");b.split(".").forEach(function(a){if(-1==d.indexOf(a))return c=!1});return c}k=a("ace/lib/oop");var n=a("ace/mode/behaviour").Behaviour,l=a("ace/mode/behaviour/cstyle").CstyleBehaviour,f=a("ace/token_iterator").TokenIterator;a=function(){this.inherit(l,["string_dquotes"]);this.add("autoclosing","insertion",function(a,b,c,d,h){if(">"==h){a=c.getCursorPosition();c=new f(d,a.row,a.column);
d=c.getCurrentToken();b=!1;if(d&&(g(d,"meta.tag")||g(d,"text")&&d.value.match("/")))b=!0;else{do d=c.stepBackward();while(d&&(g(d,"string")||g(d,"keyword.operator")||g(d,"entity.attribute-name")||g(d,"text")))}if(d&&g(d,"meta.tag-name")&&!c.stepBackward().value.match("/"))return c=d.value,b&&(c=c.substring(0,a.column-d.start)),{text:"></"+c+">",selection:[1,1]}}});this.add("autoindent","insertion",function(a,b,c,d,f){if("\n"==f&&(b=c.getCursorPosition(),"</"==d.doc.getLine(b.row).substring(b.column,
b.column+2)))return a=this.$getIndent(d.doc.getLine(b.row))+d.getTabString(),d=this.$getIndent(d.doc.getLine(b.row)),{text:"\n"+a+"\n"+d,selection:[1,a.length,1,a.length]}})};k.inherits(a,n);p.XmlBehaviour=a});define("mode/xml_fold_mode",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/lib/lang"),n=a("ace/range").Range,l=a("ace/mode/folding/fold_mode").FoldMode,f=a("ace/token_iterator").TokenIterator;a=p.FoldMode=function(a){l.call(this);this.voidElements=a||{}};k.inherits(a,l);(function(){this.getFoldWidget=function(a,b,c){a=this._getFirstTagInLine(a,c);return a.closing?"markbeginend"==b?"end":"":!a.tagName||this.voidElements[a.tagName.toLowerCase()]||a.selfClosing||-1!==
a.value.indexOf("/"+a.tagName)?"":"start"};this._getFirstTagInLine=function(a,b){for(var c=a.getTokens(b),d="",e=0;e<c.length;e++){var f=c[e];d=0===f.type.indexOf("meta.tag")?d+f.value:d+g.stringRepeat(" ",f.value.length)}return this._parseTag(d)};this.tagRe=/^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;this._parseTag=function(a){var b=this.tagRe.exec(a),c=this.tagRe.lastIndex||0;this.tagRe.lastIndex=0;return{value:a,match:b?b[2]:"",closing:b?!!b[3]:!1,selfClosing:b?!!b[5]||"/>"==b[2]:!1,tagName:b?
b[4]:"",column:b[1]?c+b[1].length:c}};this._readTagForward=function(a){var b=a.getCurrentToken();if(!b)return null;var c="",d;do if(0===b.type.indexOf("meta.tag")&&(d||(d={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()}),c+=b.value,-1!==c.indexOf(">")))return c=this._parseTag(c),c.start=d,c.end={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()+b.value.length},a.stepForward(),c;while(b=a.stepForward());return null};this._readTagBackward=function(a){var b=a.getCurrentToken();
if(!b)return null;var c="",d;do if(0===b.type.indexOf("meta.tag")&&(d||(d={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()+b.value.length}),c=b.value+c,-1!==c.indexOf("<")))return b=this._parseTag(c),b.end=d,b.start={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()},a.stepBackward(),b;while(b=a.stepBackward());return null};this._pop=function(a,b){for(;a.length;){var c=a[a.length-1];if(b&&c.tagName!=b.tagName)if(this.voidElements[b.tagName])break;else if(this.voidElements[c.tagName])a.pop();
else return null;else return a.pop()}};this.getFoldWidgetRange=function(a,b,c){var d=this._getFirstTagInLine(a,c);if(!d.match)return null;b=[];if(d.closing||d.selfClosing)for(a=new f(a,c,d.column+d.match.length),d={row:c,column:d.column};c=this._readTagBackward(a);){if(c.selfClosing)if(b.length)continue;else return c.start.column+=c.tagName.length+2,c.end.column-=2,n.fromPoints(c.start,c.end);if(c.closing)b.push(c);else if(this._pop(b,c),0==b.length)return c.start.column+=c.tagName.length+2,n.fromPoints(c.start,
d)}else for(a=new f(a,c,d.column),d={row:c,column:d.column+d.tagName.length+2};c=this._readTagForward(a);){if(c.selfClosing)if(b.length)continue;else return c.start.column+=c.tagName.length+2,c.end.column-=2,n.fromPoints(c.start,c.end);if(c.closing){if(this._pop(b,c),0==b.length)return n.fromPoints(d,c.start)}else b.push(c)}}}).call(a.prototype)});define("mode/xml_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("mode/xml_util");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var n=function(){this.$rules={start:[{token:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml_pe",regex:"<\\?.*?\\?>"},{token:"comment",merge:!0,regex:"<\\!--",next:"comment"},{token:"xml_pe",regex:"<\\!.*?>"},{token:"meta.tag",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"constant.character.entity",
regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"},{token:"text",regex:"[^<]+"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment",regex:".*?--\x3e",next:"start"},{token:"comment",merge:!0,regex:".+"}]};g.tag(this.$rules,"tag","start")};k.inherits(n,a);p.XmlHighlightRules=n});define("mode/xml_util",["require","exports","module"],function(a,p,k){function g(a,g){return[{token:"string",merge:!0,regex:".*?"+a,next:g},{token:"string",merge:!0,regex:".+"}]}p.tag=function(a,l,f,e){a[l]=[{token:"text",regex:"\\s+"},{token:function(a){return e&&e[a]?"meta.tag.tag-name."+e[a]:"meta.tag.tag-name"},merge:!0,regex:"[-_a-zA-Z0-9:]+",next:l+"_embed_attribute_list"},{token:"empty",regex:"",next:l+"_embed_attribute_list"}];a[l+"_qstring"]=g("'",l+"_embed_attribute_list");a[l+"_qqstring"]=
g('"',l+"_embed_attribute_list");a[l+"_embed_attribute_list"]=[{token:"meta.tag",merge:!0,regex:"/?>",next:f},{token:"keyword.operator",regex:"="},{token:"entity.other.attribute-name",regex:"[-_a-zA-Z0-9:]+"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"text",regex:"\\s+"}].concat([{token:"string",regex:'".*?"'},{token:"string",merge:!0,regex:'["].*',next:l+"_qqstring"},{token:"string",regex:"'.*?'"},{token:"string",merge:!0,regex:"['].*",next:l+"_qstring"}])}});define("mode/yaml",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/yaml_highlight_rules").YamlHighlightRules,l=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,f=a("ace/mode/folding/coffee").FoldMode;a=function(){this.HighlightRules=n;this.$outdent=new l;this.foldingRules=new f;this.$behaviour=this.$defaultBehaviour};k.inherits(a,g);(function(){this.lineCommentStart="#";this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);
"start"==a&&b.match(/^.*[\{\(\[]\s*$/)&&(d+=c);return d};this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)};this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)};this.$id="mode/yaml"}).call(a.prototype);p.Mode=a});define("mode/yaml_highlight_rules",["require","exports","module"],function(a,p,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:["whitespace","comment"],regex:"(^|\\s+)(#.*)$"},{token:"list.markup",regex:/^(?:-{3}|\.{3})\s*(?=#|$)/},{token:"list.markup",regex:/^\s*[\-?](?:$|\s)/},{token:"constant",regex:"!![\\w//]+"},{token:"constant.language",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:["meta.tag","keyword","meta.tag","keyword"],regex:/^(\s*\w.*?)(:{2,3})(\s*\w.*?)(:(?:\s+|$))/},
{token:["meta.tag","keyword"],regex:/^(\s*\w.*?)(:(?:\s+|$))/},{token:["meta.tag","keyword"],regex:/(\w+?)(\s*:(?:\s+|$))/},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:/[|>][-+\d\s]*$/,onMatch:function(a,g,f,e){a=/^\s*/.exec(e)[0];f.length=2;f[0]=g;f[1]=a.length;return this.token},next:"mlString"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",
regex:/(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)/},{token:"constant.numeric",regex:/[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/},{token:"constant.language.boolean",regex:"\\b(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"}],mlString:[{token:"indent",regex:/^\s*$/},{token:"indent",regex:/^\s*/,onMatch:function(a,g,f){f[1]>=a.length?(this.next=f[0],f.splice(0)):this.next=g;return this.token},next:"mlString"},
{token:"string",regex:".+"}]};this.normalizeRules()};k.inherits(g,a);p.YamlHighlightRules=g});define("theme/default",["require","exports","module"],function(a,p,k){a("ace/lib/dom");p.cssClass="ace-rs"});if(!String.prototype.trimRight){var trimEndRegexp=/\s\s*$/;String.prototype.trimRight=function(){return String(this).replace(trimEndRegexp,"")}}
define("rstudio/loader",["require","exports","module"],function(a,p,k){var g=a("ace/edit_session").EditSession,n=a("ace/editor").Editor;a("ace/lib/event_emitter");a("util/expand_selection");var l=a("ace/range").Range,f=a("ace/virtual_renderer").VirtualRenderer,e=a("ace/mode/text").Mode,b=a("ace/undomanager").UndoManager,c=a("mode/utils");a("ace/lib/event");k=a("ace/lib/oop");a("mixins/token_iterator");var d=function(a,b){n.call(this,a,b);this.setBehavioursEnabled(!0)};k.inherits(d,n);(function(){this.$highlightBrackets=
function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);this.session.selection.isEmpty()&&n.prototype.$highlightBrackets.call(this)};this.insert=function(a,b){if(!this.session.selection.isEmpty()){var d=[];"quotes"===this.$surroundSelection?d=["'",'"',"`"]:"quotes_and_brackets"===this.$surroundSelection&&(d="'\"`({[".split(""));if("quotes_and_brackets"===this.$surroundSelection){var e=this.session.$mode;if(/\/markdown$/.test(e.$id))d.push("*",
"_");else{var f=this.getCursorPosition();e.getLanguageMode&&"Markdown"===e.getLanguageMode(f)&&d.push("*","_")}}if(c.contains(d,a))return d=c.getComplement(a),this.session.replace(this.session.selection.getRange(),a+this.session.getTextRange()+d)}return n.prototype.insert.call(this,a,b)};this.remove=function(a){return this.session.getMode().wrapRemove?this.session.getMode().wrapRemove(this,n.prototype.remove,a):n.prototype.remove.call(this,a)};this.undo=function(){n.prototype.undo.call(this);this._dispatchEvent("undo")};
this.redo=function(){n.prototype.redo.call(this);this._dispatchEvent("redo")};this.onPaste=function(a,b){n.prototype.onPaste.call(this,a.replace(/\r\n|\n\r|\r/g,"\n"),b)}}).call(d.prototype);var h=function(a,b){g.call(this,a,b)};k.inherits(h,g);(function(){this.insert=function(a,b){return this.getMode().wrapInsert?this.getMode().wrapInsert(this,g.prototype.insert,a,b):g.prototype.insert.call(this,a,b)};this.reindent=function(a){var b=this.getMode();if(b.getNextLineIndent){var d=a.start.row;a=a.end.row;
0===d&&(this.applyIndent(0,""),d++);for(var e=d;e<=a;e++){var f=c.getPrimaryState(this,e-1);if(!c.endsWith(f,"qstring")){var g=b.getNextLineIndent(f,this.getLine(e-1),this.getTabString(),e-1,!0);this.applyIndent(e,g);b.autoOutdent(f,this,e)}}b=b.codeModel;"undefined"!==typeof b&&(b=b.alignContinuationSlashes,"undefined"!==typeof b&&b(this.getDocument(),{start:d,end:a}))}};this.applyIndent=function(a,b){var c=this.getLine(a).match(/^\s*/g)[0].length;this.replace(new l(a,0,a,c),b)};this.setDisableOverwrite=
function(a){a?(this.setOverwrite(!1),this.setOverwrite=function(){},this.getOverwrite=function(){return!1}):(this.setOverwrite=g.prototype.setOverwrite,this.getOverwrite=g.prototype.getOverwrite)}}).call(h.prototype);var q=function(){b.call(this)};k.inherits(q,b);(function(){this.peek=function(){return this.$undoStack.length?this.$undoStack[this.$undoStack.length-1]:null}}).call(q.prototype);var r=function(a,b){f.call(this,a,b)};k.inherits(r,f);(function(){this.setTheme=function(a){a&&f.prototype.setTheme.call(this,
a)}}).call(r.prototype);p.RStudioEditor=d;p.loadEditor=function(b){function c(a){f.editor.commands.removeCommand(a)}var f={};b.env=f;b=new r(b,"");var g=new h("");b=new d(b,g);f.editor=b;g=b.getSession();g.setMode(new e);g.setUndoManager(new q);b=a("ace/config");b.set("basePath","ace");b.set("workerPath","js/workers");b.setDefaultValue("session","useWorker",!1);c("findnext");c("findprevious");c("find");c("replace");c("togglecomment");c("gotoline");c("foldall");c("unfoldall");return f.editor}});define("rstudio/snippets",["require","exports","module"],function(a,p,k){p.toSnippetText=function(a){for(var g=a.length,k="",f=0;f<g;f++){var e=a[f];k+="snippet "+e.name+"\n\t"+e.content.replace(/\n/g,"\n\t")+"\n\n"}return k};p.normalizeSnippets=function(a){for(var g=a.length,k=0;k<g;k++){var f=a[k];null==f.tabTrigger&&(f.tabTrigger=f.name);f.content=f.content.replace("\n    ","\n\t")}}});define("rstudio/snippets/c_cpp",["require","exports","module"],function(a,p,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"once",content:"#ifndef ${1:`HeaderGuardFileName`}\n#define ${1:`HeaderGuardFileName`}\n\n${0}\n\n#endif /* ${1:`HeaderGuardFileName`} */"},{name:"ans",content:"namespace {\n${0}\n} // anonymous namespace"},{name:"ns",content:"namespace ${1:ns} {\n${0}\n} // namespace ${1:ns}"},{name:"cls",content:"class ${1:ClassName} {\npublic:\n    ${2}\nprivate:\n    ${3}\n};"},
{name:"str",content:"struct ${1} {\n    ${0}\n};"},{name:"ept",content:"// [[Rcpp::export]]\n"}];k.normalizeSnippets(g);p.snippetText=k.toSnippetText(g);a.register(g,"c_cpp")});define("rstudio/snippets/markdown",["require","exports","module"],function(a,p,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"[",content:"[${1:label}](${2:location})"},{name:"![",content:"![${1:label}](${2:location})"},{name:"r",content:"```{r ${1:label}, ${2:options}}\n${0}\n```"},{name:"rcpp",content:"```{r, engine='Rcpp'}\n#include <Rcpp.h>\nusing namespace Rcpp;\n\n${0}\n\n```"}];k.normalizeSnippets(g);p.snippetText=k.toSnippetText(g);a.register(g,"markdown")});define("rstudio/snippets/r",["require","exports","module"],function(a,p,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"lib",content:"library(${1:package})"},{name:"req",content:"require(${1:package})"},{name:"src",content:'source("${1:file.R}")'},{name:"ret",content:"return(${1:code})"},{name:"mat",content:"matrix(${1:data}, nrow = ${2:rows}, ncol = ${3:cols})"},{name:"sg",content:'setGeneric("${1:generic}", function(${2:x, ...}) {\n    standardGeneric("${1:generic}")\n})'},
{name:"sm",content:'setMethod("${1:generic}", ${2:class}, function(${2:x, ...}) {\n    ${0}\n})'},{name:"sc",content:'setClass("${1:Class}", slots = c(${2:name = "type"}))'},{name:"if",content:"if (${1:condition}) {\n    ${0}\n}"},{name:"el",content:"else {\n    ${0}\n}"},{name:"ei",content:"else if (${1:condition}) {\n    ${0}\n}"},{name:"fun",content:"${1:name} <- function(${2:variables}) {\n    ${0}\n}"},{name:"for",content:"for (${1:variable} in ${2:vector}) {\n    ${0}\n}"},{name:"while",content:"while (${1:condition}) {\n    ${0}\n}"},
{name:"switch",content:"switch (${1:object},\n    ${2:case} = ${3:action}\n)"},{name:"apply",content:"apply(${1:array}, ${2:margin}, ${3:...})"},{name:"lapply",content:"lapply(${1:list}, ${2:function})"},{name:"sapply",content:"sapply(${1:list}, ${2:function})"},{name:"mapply",content:"mapply(${1:function}, ${2:...})"},{name:"tapply",content:"tapply(${1:vector}, ${2:index}, ${3:function})"},{name:"vapply",content:"vapply(${1:list}, ${2:function}, FUN.VALUE = ${3:type}, ${4:...})"},{name:"rapply",
content:"rapply(${1:list}, ${2:function})"},{name:"ts",content:'`r paste("#", date(), "------------------------------\\n")`'},{name:"shinyapp",content:"library(shiny)\n\nui <- fluidPage(\n  ${0}\n)\n\nserver <- function(input, output, session) {\n  \n}\n\nshinyApp(ui, server)"},{name:"shinymod",content:"${1:name}_UI <- function(id) {\n  ns <- NS(id)\n  tagList(\n    ${0}\n  )\n}\n\n${1:name} <- function(input, output, session) {\n  \n}"}];k.normalizeSnippets(g);p.snippetText=k.toSnippetText(g);a.register(g,
"r")});define("rstudio/snippets/stan",["require","exports","module"],function(a,p,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"for",content:"for (${1:var} in ${2:start}:${3:end}) {\n  ${0}\n}"},{name:"if",content:"if (${1:condition}) {\n  ${0}\n}"},{name:"el",content:"else (${1:condition}) {\n  ${0}\n}"},{name:"ei",content:"else if (${1:condition}) {\n  ${0}\n}"},{name:"<l",content:"<lower = ${1:expression}>${0}"},{name:"<u",content:"<upper = ${1:expression}>${0}"},{name:"<lu",
content:"<lower = ${1:expression}, upper = ${2:expression}>${0}"},{name:"while",content:"while (${1:condition}) {\n  ${0}\n}"},{name:"gen",content:"generated quantities {\n  ${0}\n}"},{name:"mdl",content:"model {\n  ${0}\n}"},{name:"par",content:"parameters {\n  ${0}\n}"},{name:"tpar",content:"transformed parameters {\n  ${0}\n}"},{name:"data",content:"data {\n  ${0}\n}"},{name:"tdata",content:"transformed data {\n  ${0}\n}"},{name:"ode",content:"integrate_ode(${1:function}, ${2:y0}, ${3:t0}, ${4:t}, ${5:theta}, ${6:x_r}, ${7:x_i});"},
{name:"funs",content:"functions {\n  ${0}\n}"},{name:"fun",content:"${1:return} ${2:name} (${3:args}) {\n  ${0}\n}"}];k.normalizeSnippets(g);p.snippetText=k.toSnippetText(g);a.register(g,"stan")});