define("mixins/token_iterator",["require","exports","module"],function(b){var l=b("ace/token_iterator").TokenIterator,j=b("ace/range").Range;(function(){function b(a,d,c,e,m){for(var f=1,p,n=a.clone();p=c.call(n);)if(p=d(p),p===m){if(f--,0===f)return a.moveToTokenIterator(n),!0}else p===e&&f++;return!1}var f={"(":")","{":"}","[":"]","<":">",")":"(","}":"{","]":"[",">":"<"};this.moveToPreviousToken=function(){var a=this.$rowTokens,d=this.$tokenIndex-1;if(0<=d)return this.$tokenIndex--,a[d];var d=this.$session,
c=this.$row;if(0>c)return null;for(;;){c--;if(0>c)return null;if((a=d.getTokens(c))&&a.length)return this.$row=c,this.$tokenIndex=a.length-1,this.$rowTokens=a,a[a.length-1]}};this.moveToNextToken=function(){var a=this.$rowTokens,d=this.$tokenIndex+1;if(d<a.length)return this.$tokenIndex++,a[d];var d=this.$session,c=d.getLength(),e=this.$row;if(e>=c)return null;for(;;){e++;if(e>=c)return null;if((a=d.getTokens(e))&&a.length)return this.$row=e,this.$tokenIndex=0,this.$rowTokens=a,a[0]}};this.moveToNextSignificantToken=
function(){if(!this.moveToNextToken())return!1;for(var a=this.getCurrentToken();/^\s+$/.test(a.value)||/\bcomment\b/.test(a.type);){if(!this.moveToNextToken())return!1;a=this.getCurrentToken()}return!0};this.moveToPreviousSignificantToken=function(){if(!this.moveToPreviousToken())return!1;for(var a=this.getCurrentToken();/^\s+$/.test(a.value)||/\bcomment\b/.test(a.type);){if(!this.moveToPreviousToken())return!1;a=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 a=this.$row,d=this.$session,c=d.getLength();;){a++;if(a>=c)return null;var e=d.getTokens(a);if(e&&e.length)return this.$row=a,this.$tokenIndex=0,this.$rowTokens=e,this.getCurrentToken()}};var h,g=0,c=0;this.tokenizeUpToRow=function(a){var d=this.$session.bgTokenizer;g=Math.min(g,d.currentLine);c=Math.max(c,a);
for(var i=d.currentLine;i<=a;i++)d.$tokenizeRow(i);clearTimeout(h);h=setTimeout(function(){d.fireUpdateEvent(g,c);g=c;c=0},700)};this.moveToPosition=function(a,d){this.tokenizeUpToRow(a.row);var c=this.$session.getTokenAt(a.row,a.column);c&&d&&c.column<a.column&&(c=this.$session.getTokenAt(a.row,a.column+1));if(null==c){if(d)return this.$row=a.row,this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1,this.moveToNextToken();this.$row=a.row+1;this.$tokenIndex=
0;this.$rowTokens=this.$session.getTokens(this.$row);return this.moveToPreviousToken()}this.$row=a.row;this.$rowTokens=this.$session.getTokens(this.$row);this.$tokenIndex=c.index;return this.getCurrentToken()};this.clone=function(){var a=new l(this.$session,0,0);a.moveToTokenIterator(this);return a};this.moveToTokenIterator=function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d])};this.peekFwd=function(a){for(var d=this.clone(),c=null,e=0;e<a;e++)c=d.moveToNextToken();return c};this.peekBwd=
function(a){for(var d=this.clone(),c=null,e=0;e<a;e++)c=d.moveToPreviousToken();return c};this.getCurrentToken=function(){var a=this.$rowTokens[this.$tokenIndex];a&&(a.row=this.$row);return a};this.getCurrentTokenValue=function(){return this.getCurrentToken().value};this.getCurrentTokenPosition=function(){return{row:this.getCurrentTokenRow(),column:this.getCurrentTokenColumn()}};this.getCurrentTokenRange=function(){var a=this.getCurrentTokenPosition(),d={row:a.row,column:a.column+this.getCurrentToken().value.length};
return j.fromPoints(a,d)};this.fwdToMatchingToken=function(){var a=this.getCurrentToken();return 1===a.value.length&&("{"===a.value||"("===a.value||"["===a.value||"<"===a.value)?b(this,function(a){return a.value},this.moveToNextToken,a.value,f[a.value]):"support.function.codebegin"===a.type?b(this,function(a){return a.type},this.moveToNextToken,"support.function.codebegin","support.function.codeend"):!1};this.bwdToMatchingToken=function(){var a=this.getCurrentToken();return 1===a.value.length&&("}"===
a.value||")"===a.value||"]"===a.value||">"===a.value)?b(this,function(a){return a.value},this.moveToPreviousToken,a.value,f[a.value]):"support.function.codeend"===a.type?b(this,function(a){return a.type},this.moveToPreviousToken,"support.function.codeend","support.function.codebegin"):!1};this.findTokenBwd=function(a,d){d=!!d;do if((!d||!this.bwdToMatchingToken())&&this.getCurrentToken().value===a)return!0;while(this.moveToPreviousToken());return!1};this.findTokenFwd=function(a,d){d=!!d;do if((!d||
!this.fwdToMatchingToken())&&this.getCurrentToken().value===a)return!0;while(this.moveToNextToken());return!1}}).call(l.prototype)});define("ace/token_tooltip",["require","exports","module"],function(b,l){function j(c){c.tokenTooltip||(g.call(this,c.container),c.tokenTooltip=this,this.editor=c,this.update=this.update.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseOut=this.onMouseOut.bind(this),f.addListener(c.renderer.scroller,"mousemove",this.onMouseMove),f.addListener(c.renderer.content,"mouseout",this.onMouseOut))}b("ace/lib/dom");var k=b("ace/lib/oop"),f=b("ace/lib/event"),h=b("ace/range").Range,g=b("ace/tooltip").Tooltip;
k.inherits(j,g);(function(){this.token={};this.range=new h;this.update=function(){this.$timer=null;var c=this.editor.renderer;if(1E3<this.lastT-(c.timeStamp||0))c.rect=null,c.timeStamp=this.lastT,this.maxHeight=window.innerHeight,this.maxWidth=window.innerWidth;var a=c.rect||(c.rect=c.scroller.getBoundingClientRect()),d=Math.floor((this.y+c.scrollTop-a.top)/c.lineHeight),a=Math.round((this.x+c.scrollLeft-a.left-c.$padding)/c.characterWidth),c=this.editor.session,d=c.screenToDocumentPosition(d,a),
a=c.getTokenAt(d.row,d.column);!a&&!c.getLine(d.row)&&(a={type:"",value:"",state:c.bgTokenizer.getState(0)});if(a){var i=a.type;a.state&&(i+="|"+a.state);a.merge&&(i+="\n  merge");a.stateTransitions&&(i+="\n  "+a.stateTransitions.join("\n  "));this.tokenText!=i&&(this.setText(i),this.width=this.getWidth(),this.height=this.getHeight(),this.tokenText=i);this.show(null,this.x,this.y);this.token=a;c.removeMarker(this.marker);this.range=new h(d.row,a.start,d.row,a.start+a.value.length);this.marker=c.addMarker(this.range,
"ace_bracket","text")}else c.removeMarker(this.marker),this.hide()};this.onMouseMove=function(c){this.x=c.clientX;this.y=c.clientY;this.isOpen&&(this.lastT=c.timeStamp,this.setPosition(this.x,this.y));this.$timer||(this.$timer=setTimeout(this.update,100))};this.onMouseOut=function(c){if(!c||!c.currentTarget.contains(c.relatedTarget))this.hide(),this.editor.session.removeMarker(this.marker),this.$timer=clearTimeout(this.$timer)};this.setPosition=function(c,a){c+10+this.width>this.maxWidth&&(c=window.innerWidth-
this.width-10);if(a>0.75*window.innerHeight||a+20+this.height>this.maxHeight)a=a-this.height-30;g.prototype.setPosition.call(this,c+10,a+20)};this.destroy=function(){this.onMouseOut();f.removeListener(this.editor.renderer.scroller,"mousemove",this.onMouseMove);f.removeListener(this.editor.renderer.content,"mouseout",this.onMouseOut);delete this.editor.tokenTooltip}}).call(j.prototype);l.TokenTooltip=j});define("mode/auto_brace_insert",["require","exports","module"],function(b,l){var j=b("ace/range").Range,k=b("ace/mode/text").Mode;(function(){this.$complements={"(":")","[":"]",'"':'"',"{":"}"};this.$reOpen=/^[(["{]$/;this.$reClose=/^[)\]"}]$/;this.$reStop=/^[;,\s)\]}]$/;this.wrapInsert=function(f,b,g,c){if(!this.insertMatching)return b.call(f,g,c);var a=f.selection.getCursor();if(a=f.selection.isEmpty()&&g.row==a.row&&g.column==a.column){var d=j.fromPoints(g,{row:g.row,column:g.column+1}),i=f.doc.getTextRange(d);
if(this.$reClose.test(i)&&i==c){f.selection.moveCursorTo(d.end.row,d.end.column,!1);return}}d=null;a&&(d=this.$moveLeft(f.doc,g),d=f.doc.getTextRange(j.fromPoints(d,g)));b=b.call(f,g,c);if(a&&this.$reOpen.test(c)){if(g=j.fromPoints(b,{row:b.row,column:b.column+1}),g=f.doc.getTextRange(g),(this.$reStop.test(g)||0==g.length)&&this.allowAutoInsert(f,b,this.$complements[c]))f.doc.insert(b,this.$complements[c]),f.selection.moveCursorTo(b.row,b.column,!1)}else if(a&&"\n"===c&&(c=this.$moveRight(f.doc,b),
c=f.doc.getTextRange(j.fromPoints(b,c)),"{"===d&&"}"===c||"("===d&&")"===c||"["===d&&"]"===c))g=this.getIndentForOpenBrace?this.getIndentForOpenBrace(this.$moveLeft(f.doc,g)):this.$getIndent(f.doc.getLine(b.row-1)),f.doc.insert(b,"\n"+g),f.selection.moveCursorTo(b.row,b.column,!1);return b};this.allowAutoInsert=function(){return!0};this.smartAllowAutoInsert=function(b,h,g){return"'"!==g&&'"'!==g||0==h.column?!0:(b=this.codeModel.getTokenForPos(h,!1,!0))&&"string"===b.type&&b.column===h.column-1};
this.wrapRemove=function(b,h,g){var c=b.selection.getCursor(),a=b.session.getDocument();if(!this.insertMatching||"left"!=g||!b.selection.isEmpty()||b.$readOnly||0==c.column||a.getLine(c.row).length<=c.column)return h.call(b,g);var d=j.fromPoints(this.$moveLeft(a,c),c),c=j.fromPoints(c,this.$moveRight(a,c)),d=a.getTextRange(d),a=this.$reOpen.test(d)&&this.$complements[d]==a.getTextRange(c);h.call(b,g);a&&h.call(b,"right")};this.$moveLeft=function(b,h){if(0==h.row&&0==h.column)return h;var g=h.row,
c=h.column;c?c--:(g--,c=b.getLine(g).length);return{row:g,column:c}};this.$moveRight=function(b,h){var g=h.row,c=h.column;b.getLine(g).length!=c?c++:(g++,c=0);return g>=b.getLength()?h:{row:g,column:c}}}).call(k.prototype);l.setInsertMatching=function(b){k.prototype.insertMatching=b}});define("mode/background_highlighter",["require","exports","module"],function(b,l){var j=b("ace/range").Range,k=function(b,h){this.$session=b;this.$doc=b.getDocument();this.$highlighters=h;var g=function(a){this.$onDocChange(a)}.bind(this);this.$doc.on("change",g);var c=function(a){this.$onChangeFold(a)}.bind(this);this.$session.on("changeFold",c);var a=!1,d=function(){a&&(this.$clearMarkers(),this.$doc.off("change",g),this.$session.off("changeMode",d),this.$session.off("changeFold",c));a=!0}.bind(this);
this.$session.on("changeMode",d);this.$rowState=Array(this.$doc.getLength());this.$markers=[];var i=b.getMarkers(!1),e;for(e in i){var m=i[e];m.range&&-1!==m.clazz.indexOf("ace_foreign_line background_highlight")&&"fullLine"==m.type&&(this.$markers[m.range.start.row]=e)}this.$synchronize(0)};(function(){this.$synchronize=function(b){this.$update(b);this.$syncMarkers(b)};this.$update=function(b){for(;0<b&&null==this.$rowState[b-1];)b--;this.$activeHighlighter=this.$findActiveHighlighter(b);for(var h=
this.$doc.getLength();b<h;b++){var g=this.$rowState[b],c=this.$getState(b);if(g===c)break;this.$rowState[b]=c}};this.$getState=function(b){var h=this.$doc.getLine(b),b=this.$rowState[b-1]||1;if(1===b||4===b){if(this.$beginChunkHighlight(h))return 2}else if(2===b||3===b)return this.$endChunkHighlight(h)?4:3;return 1};this.$findActiveHighlighter=function(b){for(;0<=b;b--){var h=this.$rowState[b];if(1===h)break;var g=this.$doc.getLine(b);if(2==h&&(h=this.$beginChunkHighlight(g)))return h}return null};
this.$beginChunkHighlight=function(b){for(var h=0;h<this.$highlighters.length;h++){var g=this.$highlighters[h];if(g.begin.test(b))return this.$activeHighlighter=g}return null};this.$endChunkHighlight=function(b){if(null==this.$activeHighlighter||!this.$activeHighlighter.end.test(b))return null;b=this.$activeHighlighter;this.$activeHighlighter=null;return b};this.$insertNewRows=function(b,h){var g=Array(h+2);g[0]=b;g[1]=0;Array.prototype.splice.apply(this.$rowState,g)};this.$removeRows=function(b,
h){this.$rowState.splice(b,h)};this.$clearMarkers=function(){for(var b=0;b<this.$markers.length;b++)this.$session.removeMarker(this.$markers[b]);this.$markers=[]};this.$syncMarkers=function(b){for(var h=this.$doc.getLength()-1,g=b;g<=h;g++){var c=this.$rowState[g],a=1!==c;this.$markers[g]&&(this.$session.removeMarker(this.$markers[g]),this.$markers[g]=null);b=this.$session.getFoldLine(g);if(null!==b&&(b=b.start.row,b<g))continue;a&&(c=2===c?"ace_foreign_line background_highlight rstudio_chunk_start":
"ace_foreign_line background_highlight",this.$markers[g]=this.$session.addMarker(new j(g,0,g,Infinity),c,"fullLine",!1))}};this.$onDocChange=function(b){var b=b.data,h=b.action,g=b.range;"insertLines"===h?(this.$rowState[g.start.row]=void 0,this.$insertNewRows(g.start.row,g.end.row-g.start.row)):"insertText"===h&&this.$doc.isNewLine(b.text)?(this.$rowState[g.start.row]=void 0,this.$insertNewRows(g.end.row,1)):"removeLines"===h?(this.$rowState[g.start.row]=void 0,this.$removeRows(g.start.row,g.end.row-
g.start.row)):"removeText"===h&&this.$doc.isNewLine(b.text)&&(this.$rowState[g.start.row]=void 0,this.$removeRows(g.end.row,1));this.$synchronize(g.start.row)};this.$onChangeFold=function(b){this.$synchronize(b.data.start.row)}}).call(k.prototype);l.BackgroundHighlighter=k});define("mode/c_cpp",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("ace/range").Range;b("mode/r_highlight_rules");var g=b("mode/c_cpp_highlight_rules").c_cppHighlightRules,c=b("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,a=b("mode/behaviour/cstyle").CStyleBehaviour,d=null;window.NodeWebkit||(d=b("mode/c_cpp_fold_mode").FoldMode);var i=b("mode/background_highlighter").BackgroundHighlighter,e=b("mode/r_code_model").RCodeModel,
m=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,o=b("mode/cpp_code_model").CppCodeModel;b("mode/token_cursor");var p=b("mode/utils"),n=function(b,n){this.$session=n;this.$doc=n.getDocument();this.$tokenizer=new f((new g).getRules());this.r_codeModel=new e(n,this.$tokenizer,/^r-/,/^\s*\/\*{3,}\s*([Rr])\s*$/,/^\s*\*+\//);this.$r_outdent=new m(this.r_codeModel);this.codeModel=new o(n,this.$tokenizer);this.$behaviour=new a(this.codeModel);this.$cpp_outdent=new c(this.codeModel);this.$sweaveBackgroundHighlighter=
new i(n,[{begin:/^\s*\/\*{3,}\s*[Rr]\s*$/,end:/^\s*\*\//}]);window.NodeWebkit||(this.foldingRules=new d);this.$tokens=this.codeModel.$tokens;this.getLineSansComments=this.codeModel.getLineSansComments};j.inherits(n,k);(function(){this.wrapInsert=function(a,e,d,c){return this.cursorInRLanguageMode()?k.prototype.wrapInsert(a,e,d,c):e.call(a,d,c)};this.wrapRemove=function(a,e,d){return this.cursorInRLanguageMode()?k.prototype.wrapRemove(a,e,d):e.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,e,d,c){for(var b=!0,a=/^(\s*)\/\//,m=d;m<=c;m++)if(!a.test(e.getLine(m))){b=!1;break}if(b){b=new h(0,0,0,0);for(m=d;m<=c;m++)d=e.getLine(m).match(a),b.start.row=m,b.end.row=m,b.end.column=d[0].length,e.replace(b,d[1])}else e.indentRows(d,c,"//")};this.getLanguageMode=function(a){return p.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,e,d,c,b){a=p.primaryState(a);return this.inRLanguageMode(a)?this.r_codeModel.getNextLineIndent(a,e,d,c):this.codeModel.getNextLineIndent(a,e,d,c,b)};this.checkOutdent=function(a,e,d){return this.inRLanguageMode(a)?this.$r_outdent.checkOutdent(a,e,d):this.$cpp_outdent.checkOutdent(a,e,d)};this.autoOutdent=function(a,e,d){return this.inRLanguageMode(a)?this.$r_outdent.autoOutdent(a,e,d,this.r_codeModel):this.$cpp_outdent.autoOutdent(a,
e,d)};this.$transformAction=this.transformAction;this.transformAction=function(a,e,d,c,b){a=p.primaryState(a);if(!this.inRLanguageMode(a))return this.$transformAction(a,e,d,c,b)};this.$id="mode/c_cpp"}).call(n.prototype);l.Mode=n});define("mode/c_cpp_fold_mode",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/range").Range,f=b("ace/mode/folding/fold_mode").FoldMode,h=l.FoldMode=function(){};j.inherits(h,f);(function(){function b(a,e,d,c){for(var a=a.doc.$lines,p=e+c,n=a[p],g=0<c?"*/":"/*",f;null!=n;){var h=n.indexOf(g);if(-1!==h){f=0<c?new k(e,d,p,h):new k(p,n.length,e,d);break}p+=c;n=a[p]}return f}function c(a,d,c,b,p){for(var n=d+p,g=a.doc.$lines;0<=n&&n<a.getLength();){for(var f=a.getTokens(n),
h=g[n],t=0;t<f.length;t++)if(f[t].type===b)return 0<p?new k(d,c,n,0):new k(n,h.length,d,c);n+=p}}var a=/(\{|\[)[^\}\]]*$/,d=/^[^\[\{]*(\}|\])/;this.getFoldWidget=function(c,e,b){e="markbeginend"===e?"end":"";b=c.getLine(b);if(a.test(b))return"start";if(d.test(b))return e;c=b.indexOf("/*");b=b.indexOf("*/");return-1!==c&&(-1===b||c>b)?"start":-1!==b&&(-1===c||b<c)?e:""};this.getFoldWidgetRange=function(i,e,m){var o=i.getLine(m),p;if(p=o.match(a))return this.openingBracketBlock(i,p[1],m,p.index);if(p=
"markbeginend"===e&&o.match(d))return this.closingBracketBlock(i,p[1],m,p.index+p[0].length);e=i.getTokens(m);for(p=0;p<e.length;p++){var n=e[p];if("support.function.codebegin"===n.type)return c(i,m,o.length,"support.function.codeend",1);if("support.function.codeend"===n.type)return c(i,m,0,"support.function.codebegin",-1)}e=o.indexOf("/*");if(-1!==e)return b(i,m,o.length,1);e=o.indexOf("*/");if(-1!==e)return b(i,m,e,-1)}}).call(h.prototype)});define("mode/c_cpp_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/lib/lang"),f=b("mode/doc_comment_highlight_rules").DocCommentHighlightRules,h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=b("mode/tex_highlight_rules").TexHighlightRules,c=b("mode/r_highlight_rules").RHighlightRules,a=function(){function a(d){return d.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var b=k.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,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(",")),
e=k.arrayToMap(["NULL"]),m=">>=,<<=,new,delete,<<,>>,&&,||,==,!=,<=,>=,::,*=,+=,-=,/=,++,--,&=,^=,%=,->,!,$,&,|,+,-,*,/,^,~,=".split(","),o=m.map(function(e){return a(e)}).join("|"),m=["->*"].concat(m).concat("< > , () [] ->".split(" ")).map(function(e){return a(e)}),m=["new\\s*\\[\\]","delete\\s*\\[\\]"].concat(m),m="operator\\s*(?:"+m.join("|")+")|operator\\s+[\\w_]+(?:&&|&|\\*)?";this.$rules={start:[{token:"comment.doc.tag",regex:"\\/\\/\\s*\\[\\[.*\\]\\].*$"},{token:"comment",regex:"\\/\\/'",
next:"rd-start"},{token:"comment",regex:"\\/\\/.*$"},f.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,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:m},{token:function(a){return"this"==
a?"variable.language":b.hasOwnProperty(a)?"keyword":e.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",merge:!1,regex:o},{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"}]};o=(new g("comment")).getRules();for(m=0;m<o.start.length;m++)o.start[m].token+=".virtual-comment";this.addRules(o,"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(f,"doc-",[f.getEndRule("start")]);this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\\s*\\/\\*{3,}\\s*[Rr]\\s*$",next:"r-start"});this.addRules((new c).getRules(),"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",regex:"\\*\\/",
next:"start"})};j.inherits(a,h);l.c_cppHighlightRules=a});define("mode/c_cpp_matching_brace_outdent",["require","exports","module"],function(b,l){var j=b("ace/range").Range,k=b("mode/token_cursor").CppTokenCursor,f=function(a){this.codeModel=a},h=b("mode/utils"),g=!0,c=!0,a=!0,d=!0,i=!0,e=!0,m=!0,o=!0,p=!0,n=!0,x=!0,w=!0;(function(){this.setIndent=function(a,d,e,c,b){var a=a.getDocument(),c="string"===typeof c?c:"",m=a.$lines[e],e=this.$getIndent(a.$lines[d]),m=this.$getIndent(m);("function"!==typeof b||b(e,m))&&a.replace(new j(d,0,d,e.length),m+c)};this.checkOutdent=
function(a,d,e){return h.endsWith(a,"start")&&(":"===e||/^\s*[#\{\}\>\]\)<.:]/.test(e)||"="===e)?!0:h.endsWith(a,"comment")&&"/"==e?!0:!1};this.escapeRegExp=function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};this.alignStartToken=function(a,e,d,c,b){if(null===b||null===c)return!1;return RegExp("^\\s*"+this.escapeRegExp(a)).test(c)&&(a=b.indexOf(a),0<=a)?(e=e.getDocument(),c=this.$getIndent(c),a=Array(a+1).join(" "),e.replace(new j(d,0,d,c.length),a),!0):!1};this.alignEquals=
function(a,e,d,c){if(null===c||null===d)return!1;var b=d.indexOf("=");if(b!==d.lastIndexOf("="))return!1;var m=c.indexOf("=");if(-1!==b&&-1!==m&&/,\s*$/.test(c)){a=a.getDocument();d=this.$getIndent(d);if(d.length>=m)return!1;b=m-b;if(0>=b)return!1;b=Array(d.length+b+1).join(" ");a.replace(new j(e,0,e,d.length),b);return!0}return!1};this.autoOutdent=function(b,o,f){var b=o.doc,h=b.getLine(f),y=null;0<f&&(y=b.getLine(f-1));this.$getIndent(h);if(!(n&&this.alignStartToken("<<",o,f,h,y)||p&&this.alignStartToken(">>",
o,f,h,y)))if(!m||!this.alignStartToken(".",o,f,h,y)){if(g&&/^\s*:/.test(b.getLine(f))&&!/^\s*::/.test(b.getLine(f))&&this.codeModel.$tokenUtils.$tokenizeUpToRow(f)){var l=new k(this.codeModel.$tokens,f,0),r=-1,z=l.cloneCursor();if(")"===z.peekBwd().currentValue()||"keyword"===z.peekBwd().currentType()){do{var l=z.currentType(),V=z.currentValue();if("identifier"===l||";"===V){r=z.$row;break}"keyword"!==l&&z.bwdToMatchingToken()}while(z.moveToPreviousToken())}else l.moveToPreviousToken(),l.bwdOverClassySpecifiers()&&
(r=l.$row);0<=r&&this.setIndent(o,f,r,o.getTabString(),function(a,d){return a===d})}if(e&&/^\s*>/.test(h)&&!/^\s*>>/.test(h)&&(r=this.codeModel.getRowForMatchingEOLArrows(o,b,f),0<=r)){this.setIndent(o,f,r);return}if(d&&/^\s*\}/.test(h)&&(r=o.findMatchingBracket({row:f,column:h.indexOf("}")+1}),null!==r)){if(/^\s*\{/.test(b.$lines[r.row])){this.setIndent(o,f,r.row);return}r=this.codeModel.getRowForOpenBraceIndent(o,r.row);if(0<=r){this.setIndent(o,f,r);return}}if(c&&/^\s*\)/.exec(h)&&(r=o.findMatchingBracket({row:f,
column:h.indexOf(")")+1}))){this.setIndent(o,f,r.row);return}if(i&&/^\s*\]/.exec(h)&&(r=o.findMatchingBracket({row:f,column:h.indexOf("]")+1}))){this.setIndent(o,f,r.row);return}if(x&&/^\s*public\s*:\s*$|^\s*private\s*:\s*$|^\s*protected\s*:\s*$/.test(h)&&(z=o.$findOpeningBracket("}",{row:f,column:h.length},RegExp(/paren\.keyword\.operator/)))){r=this.codeModel.getRowForOpenBraceIndent(o,z.row);0<=r?this.setIndent(o,f,r):this.setIndent(o,f,z.row);return}if(w&&(/^\s*case.+:/.test(h)||/^\s*default\s*:/.test(h)))if(z=
o.$findOpeningBracket("}",{row:f,column:/(\S)/.exec(h).index+1})){r=this.codeModel.getRowForOpenBraceIndent(o,z.row);0<=r?this.setIndent(o,f,r):this.setIndent(o,f,z.row);return}if(a&&/^\s*\{/.test(h)&&!/;\s*$/.test(y)){if(this.codeModel.$tokenUtils.$tokenizeUpToRow(f)&&(l=new k(this.codeModel.$tokens),l.$row=f,l.$offset=0,l.moveToPreviousToken()&&"="===l.currentValue()))return;y=this.codeModel.getRowForOpenBraceIndent(o,f);if(0<=y){this.setIndent(o,f,y);return}}/^\s*#/.test(h)&&(o=this.$getIndent(h),
b.replace(new j(f,0,f,o.length),""))}};this.$getIndent=function(a){return(a=a.match(/^(\s+)/))?a[1]:""}}).call(f.prototype);l.CppMatchingBraceOutdent=f;l.getOutdentColon=function(){return g};l.setOutdentColon=function(a){g=a};l.getOutdentRightParen=function(){return c};l.setOutdentRightParen=function(a){c=a};l.getOutdentLeftBrace=function(){return a};l.setOutdentLeftBrace=function(d){a=d};l.getOutdentRightBrace=function(){return d};l.setOutdentRightBrace=function(a){d=a};l.getOutdentRightBracket=
function(){return i};l.setOutdentRightBracket=function(a){i=a};l.getOutdentRightArrow=function(){return e};l.setOutdentRightArrow=function(a){e=a};l.getAlignDots=function(){return m};l.setAlignDots=function(a){m=a};l.getAlignEquals=function(){return o};l.setAlignEquals=function(a){o=a};l.getAlignStreamIn=function(){return p};l.setAlignStreamIn=function(a){p=a};l.getAlignStreamOut=function(){return n};l.setAlignStreamOut=function(a){n=a};l.getAlignClassAccessModifiers=function(){return x};l.setAlignClassAccessModifiers=
function(a){x=a};l.getAlignCase=function(){return w};l.setAlignCase=function(a){w=a}});define("mode/behaviour/cstyle",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/behaviour").Behaviour;b("mode/cpp_code_model");b("mode/token_cursor");b("ace/mode/text");var f=b("mode/utils"),h=!0,g=function(b){var a=b.$complements,d=function(d,b,c,i){var n=a[d];if(b==d)return b=c.getSelectionRange(),i=i.doc.getTextRange(b),""!==i?{text:d+i+n,selection:!1}:{text:d+n,selection:[1,1]};if(b==n&&(d=c.getCursorPosition(),i.doc.getLine(d.row)[d.column]==n&&(">"===n||null!==
i.findMatchingBracket({row:d.row,column:d.column+1}))))return{text:"",selection:[1,1]}},i=function(d,b,c){var i=a[d],n=c.doc.getTextRange(b);if(!b.isMultiLine()&&n==d&&c.doc.getLine(b.start.row).substring(b.start.column+1,b.start.column+2)==i)return b.end.column++,b};this.add("R","insertion",function(a,d,b,c,i){if("R"===i||"r"===i)if(a=b.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(a,d,i,p,n){if("\n"===n){var n=i.selection.getCursor().row,g=i.selection.getCursor().column,d=p.getTabString(),h=i.getCursorPosition(),i=p.doc.getLine(h.row);if(!this.codeModel.inMacro(p.getDocument().$lines,n-1)){var k=/^(\s*\/\/'\s*)/.exec(i);if(k&&g>=k[1].length)return{text:"\n"+k[1]};if(f.endsWith(a,"comment")||f.endsWith(a,"doc-start"))if(h&&h.row==n&&(i=i.substring(0,h.column)),a=/^(\s*\*+\s*)/.exec(i))return{text:"\n"+a[1],selection:[1,a[1].length,1,a[1].length]};
if(/^\s*\/\*/.test(i)&&-1===i.indexOf("*/"))return p=this.$getIndent(i),d=p+" * ",{text:"\n"+d+"\n"+p+" */",selection:[1,d.length,1,d.length]};for(a=g-1;/\s/.test(i[a]);)--a;a=i[a];g=i[g];if(k=i.match(/\s*namespace\s*\w*\s*{/))return p=this.$getIndent(i),{text:"\n"+p,selection:[1,p.length,1,p.length]};if("("==a&&")"==g||"["==a&&"]"==g)return n=this.$getIndent(i),p=n+d,{text:"\n"+p+"\n"+n,selection:[1,p.length,1,p.length]};if("{"==a&&"}"==g){if(/^\s*{/.test(i))return n=this.$getIndent(i),p=n+p.getTabString(),
{text:"\n"+p+"\n"+n,selection:[1,p.length,1,p.length]};n=b.getRowForOpenBraceIndent(p,n);if(null!==n&&0<=n)return n=this.$getIndent(p.getDocument().getLine(n)),p=n+p.getTabString(),{text:"\n"+p+"\n"+n,selection:[1,p.length,1,p.length]};n=this.$getIndent(i);p=n+d;return{text:"\n"+p+"\n"+n,selection:[1,p.length,1,p.length]}}}}});this.add("braces","insertion",function(a,b,c,i,n){if(this.insertMatching){if("{"==n&&(a=c.getSelectionRange(),""===i.doc.getTextRange(a))){a=this.codeModel.getTokenCursor();
if(!a.moveToPosition(c.getCursorPosition()))return d("{",n,c,i);do if(!a.bwdToMatchingArrow()){b=a.currentValue();if(!b||!b.length)break;if("namespace"===b)return{text:"{",selection:[1,1]};if("class"===b||"struct"===b||"="===b)return{text:"{};",selection:[1,1]};if(h&&"do"===b)return{text:"{} while ();",selection:[1,1]};if(";"===b||"["===b||"]"===b||"("===b||")"===b||"{"===b||"}"===b||"if"===b||"else"===b||"#"===b[0])return{text:"{}",selection:[1,1]}}while(a.moveToPreviousToken())}return d("{",n,c,
i)}});this.add("braces","deletion",function(a,d,b,c,i){if(this.insertMatching&&(a=c.doc.getTextRange(i),!i.isMultiLine()&&"{"==a)){a=c.doc.getLine(i.start.row);if(/^\s*do\s*\{\} while \(\);\s*$/.test(a))return i.end.column=a.length,i;c=a.substring(i.end.column,i.end.column+1);a=a.substring(i.end.column+1,i.end.column+2);if("}"==c)return i.end.column++,";"==a&&i.end.column++,i}});this.add("parens","insertion",function(a,b,c,i,n){return!this.insertMatching?void 0:d("(",n,c,i)});this.add("parens","deletion",
function(a,d,b,c,n){return!this.insertMatching?void 0:i("(",n,c)});this.add("brackets","insertion",function(a,b,c,i,n){return!this.insertMatching?void 0:d("[",n,c,i)});this.add("brackets","deletion",function(a,d,b,c,n){return!this.insertMatching?void 0:i("[",n,c)});this.add("arrows","insertion",function(a,b,c,i,n){if(this.insertMatching)return!/^\s*#\s*include/.test(i.getLine(c.getCursorPosition().row))?void 0:d("<",n,c,i)});this.add("arrows","deletion",function(a,d,b,c,n){return!this.insertMatching?
void 0:i("<",n,c)});this.add("string_dquotes","insertion",function(a,d,b,c,i){if(this.insertMatching&&('"'==i||"'"==i)){a=b.getSelectionRange();d=c.doc.getTextRange(a);if(""!==d)return{text:i+d+i,selection:!1};b=b.getCursorPosition();d=c.doc.getLine(b.row);if("\\"==d.substring(b.column-1,b.column))return null;for(var c=c.getTokens(a.start.row),f=0,g,h=-1,t=0;t<c.length;t++){g=c[t];"string"==g.type?h=-1:0>h&&(h=g.value.indexOf(i));if(g.value.length+f>a.start.column)break;f+=c[t].value.length}if(!g||
0>h&&"comment"!==g.type&&("string"!==g.type||a.start.column!==g.value.length+f-1&&g.value.lastIndexOf(i)===g.value.length-1))return{text:i+i,selection:[1,1]};if(g&&"string"===g.type&&d.substring(b.column,b.column+1)==i)return{text:"",selection:[1,1]}}});this.add("string_dquotes","deletion",function(a,d,b,c,i){if(this.insertMatching&&(a=c.doc.getTextRange(i),!i.isMultiLine()&&('"'==a||"'"==a)))if(c=c.doc.getLine(i.start.row).substring(i.start.column+1,i.start.column+2),'"'===c||"'"===c)return i.end.column++,
i});this.add("punctuation.operator","insertion",function(a,d,b,c,i){if(this.insertMatching&&";"===i&&(a=b.selection.getCursor(),";"==c.getLine(a.row)[a.column]))return{text:"",selection:[1,1]}});this.add("macro","insertion",function(a,d,b,c,i){var d=b.getPrintMarginColumn(),d=Math.min(62,d),f=c.getDocument().$lines,g=b.getCursorPosition(),h=g.row,t=f[h],b=t.substring(0,g.column);if(/^\s*#\s*define[^\\]*$/.test(t)&&"\\"==i)return a=d-b.length+1,0<=a?{text:Array(a+1).join(" ")+"\\\n"+this.$getIndent(t)+
c.getTabString(),selection:!1}:{text:"\\\n"+c.getTabString(),selection:!1};if(/^\s*#\s*define/.test(t)||this.codeModel.inMacro(f,h-1)){if("\\"==i&&/^\s*$/.test(t.substring(b.length,t.length)))return a=d-b.length+1,0<=a?{text:Array(a+1).join(" ")+"\\",selection:!1}:{text:"\\",selection:!1};if("\n"==i){if(/^\s*$/.test(t)||/^\s*#\s*define/.test(t)&&!/\\\s*$/.test(t))return{text:"\n",selection:!1};if(/\\\s*$/.test(t)&&!/\\\s*$/.test(b))return{text:"",selection:[1,g.column,1,g.column]};c=c.getMode().getNextLineIndent(a,
t+"\\",c.getTabString(),h,!1);a=d-b.length+1;i=/\\\s*$/.test(b)?"":"\\";return 0<=a?{text:Array(a+1).join(" ")+i+"\n"+c,selection:!1}:{text:i+"\n"+c,selection:!1}}}})};j.inherits(g,k);l.CStyleBehaviour=g;l.setFillinDoWhile=function(b){h=b};l.getFillinDoWhile=function(){return h}});define("mode/cpp_code_model",["require","exports","module"],function(b,l){b("ace/lib/oop");var j=b("ace/range").Range,k=b("mode/token_utils").TokenUtils;b("ace/token_iterator");var f=b("mode/token_cursor").CppTokenCursor,h=b("mode/cpp_scope_tree").CppScopeNode,g=b("mode/cpp_scope_tree").CppScopeManager,c=b("mode/r_code_model").getVerticallyAlignFunctionArgs,a=b("mode/utils"),d=function(a,b,d,c,f){this.$session=a;this.$doc=a.getDocument();this.$tokenizer=b;this.$tokens=Array(this.$doc.getLength());
this.$statePattern=d;this.$codeBeginPattern=c;this.$codeEndPattern=f;this.$tokenUtils=new k(this.$doc,this.$tokenizer,this.$tokens,this.$statePattern,this.$codeBeginPattern);this.$scopes=new g(h);var n=!0,j=function(){n?n=!1:(this.$doc.off("change",l),this.$session.off("changeMode",j))}.bind(this),l=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",j);this.$doc.on("change",l)};(function(){var b=a.contains;this.getTokenCursor=function(){return new f(this.$tokens,0,0,this)};
this.$tokenizeUpToRow=function(a){this.$tokenUtils.$tokenizeUpToRow(a)};var d=function(a,d){for(;;){var c=a.currentValue(),e=d.$doc.getLine(a.$row);if(b(["{","}",";"],c))break;if(":"===c&&(c=a.peekBwd().currentValue(),b(["public","private","protected"],c)))break;if(/^\s*#/.test(e))break;if(!a.moveToPreviousToken())break}},m="if,else,for,do,while,struct,class,try,catch,switch".split(","),g=function(a){a=a.trim();return a=a.replace(/[\n\s]+/g," ")},h=function(a,b){var d=g(a),c=b;"undefined"===typeof c&&
(c=80);d.length>c&&(d=d.substring(0,c)+"...");return d};this.$complements={"<":">",">":"<","{":"}","}":"{","[":"]","]":"[","(":")",")":"(","'":"'",'"':'"'};this.alignContinuationSlashes=function(a,b){"undefined"===typeof b&&(b={start:0,end:a.getLength()});var d=a.$lines;if(!(d instanceof Array))return!1;for(var c=b.start;c<b.end;c++)if(k.test(d[c])){for(var e=c,c=c+1;k.test(d[c])&&c<=b.end;)c++;for(var i=c,m=d.slice(e,i).map(function(a){return a.lastIndexOf("\\")}),g=Math.max.apply(null,m),f=0;f<
i-e;f++){var n={row:e+f,column:m[f]},h=Array(g-m[f]+1).join(" ");a.insert(n,h)}}return!0};this.allIndicesOf=function(a,b){for(var d=[],c=0;c<a.length;c++)a[c]==b&&d.push(c);return d};this.getRowForMatchingEOLArrows=function(a,b,d){for(var a=0,c="",e=1;100>e;e++){c=this.getLineSansComments(b,d-e);if(/;\s*$/.test(c))break;if(/<\s*$/.test(c)&&!/<<\s*$/.test(c)){if(0===a)return d-e;a--}else/^\s*>/.test(c)&&!/^\s*>>/.test(c)&&a++}return-1};var n=/^\s*#\s*define/,k=/\\\s*$/,l=/^\s*[+\-/&^%$!<\>.?|=~]|^\s*\*[^/]|^\s*\/[^\*]/,
s=/[+\-*&^%$!<\>.?|=~]\s*$|\*[^/]\s*$|\/[^\*]\s*$/;this.inMacro=function(a,b){var d=a[b];return 0>b?!1:k.test(d)?n.test(d)?!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.onSectionHead(c,b.currentPosition())}else if(/\bcodebegin\b/.test(c)){var c=b.currentPosition(),i={row:c.row+1,column:0};this.$scopes.getTopLevelScopeCount();this.$scopes.onChunkStart("(R Code Chunk)","(R Code Chunk)",c,i)}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(),i=c.currentPosition(),c.isFirstSignificantTokenOnLine()&&(i.column=0),"namespace"===c.peekBwd(2).currentValue())c.moveToPreviousToken(),i=c.currentValue(),this.$scopes.onNamespaceScopeStart("namespace "+i,c.currentPosition(),b.currentPosition(),i);else if("namespace"===c.peekBwd().currentValue())this.$scopes.onNamespaceScopeStart("anonymous namespace",i,b.currentPosition(),"<anonymous>");else if("class"===c.peekBwd(2).currentValue()||"struct"===c.peekBwd(2).currentValue()||
c.bwdOverClassInheritance()){c.moveToPreviousToken();var m=c.cloneCursor();d(m,this);m=m.peekFwd().currentPosition();i=this.$session.getTextRange(new j(m.row,m.column,i.row,i.column));i=g(i);this.$scopes.onClassScopeStart(i,c.currentPosition(),b.currentPosition(),i)}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 j(c.row,c.column,i.row,i.column-1)),c=g("lambda "+c),this.$scopes.onLambdaScopeStart(c,i,b.currentPosition());else{if(c.moveToPreviousToken()){var r="",i=c.currentValue(),m="",f=this.$scopes.getActiveScopes(c.currentPosition());null!=f&&(f=f[f.length-1],f.isClass()&&f.label==="class "+i?"~"===c.peekBwd().currentValue()&&(i="~"+i):(r=c.cloneCursor(),d(r,this),r.moveToNextToken(),r=r.currentPosition(),f=c.currentPosition(),
r=this.$session.getTextRange(new j(r.row,r.column,f.row,f.column))));var n=c.peekFwd(),f=n.currentPosition();n.fwdToMatchingToken()&&("const"===n.peekFwd().currentValue()&&n.moveToNextToken(),"noexcept"===n.peekFwd().currentValue()&&n.moveToNextToken(),"noexcept"===n.currentValue()&&"("===n.peekFwd().currentValue()&&(n.moveToNextToken(),n.fwdToMatchingToken()),(n=n.peekFwd().currentPosition())&&(m=this.$session.getTextRange(new j(f.row,f.column,n.row,n.column))));this.$scopes.onFunctionScopeStart(0<
r.length?h(i.trim()+m.trim()+": "+r.trim()):h(i.trim()+m.trim()),c.currentPosition(),b.currentPosition(),i.trim(),m.split(","))}}else this.$scopes.onScopeStart(i);else this.$scopes.onScopeStart(i);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,c){c||(c=function(){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);
var b=this.$scopes.getActiveScopes(a);if(b)for(var d=b.length-1;0<=d;d--)if(c(b[d]))return b[d];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.getScopeList()};this.getRowForOpenBraceIndent=function(a,c,d){if(1>=a.getDocument().$lines.length)return-1;if(this.$tokenUtils.$tokenizeUpToRow(c))try{for(var e=Array(this.$tokens.length),f=0;f<this.$tokens.length;f++)if(null!=this.$tokens[f]&&0<this.$tokens[f].length){var r=this.$tokens[f];
"\\"===r[r.length-1].value&&(e[f]=this.$tokens[f].splice(r.length-1,1)[0])}var g=this.getTokenCursor();if(d){var n=a.getSelection().getCursor();if(!g.moveToPosition(n))return 0}else{g.$row=c;f=g.$tokens[c].length-1;for(f=g.$tokens[c].length-1;0<=f&&!(g.$offset=f,"{"===g.currentValue());f--);}if("{"===g.peekBwd().currentValue()||";"===g.currentValue())return-1;g.bwdOverInitializationList();g.bwdOverClassInheritance();if("{"===g.currentValue()&&!g.moveToPreviousToken()||"{"===g.currentValue())return-1;
for(;"keyword"===g.currentType();){var h=g.currentValue();if(b(m,h)||0===g.$row&&0===g.$offset)return g.$row;if(!g.moveToPreviousToken())return-1}if(":"===g.currentValue()){var p=g.peekBwd().currentValue();if(b(["public","private","protected"],p))return g.moveToNextToken(),g.$row}if(":"===g.currentValue())for(;g.moveToPreviousToken();){if(g.bwdToMatchingToken())if("keyword"===g.peekBwd().currentType())continue;else break;if("identifier"===g.currentType())break}if(")"===g.currentValue()&&!g.bwdToMatchingToken()||
"("===g.currentValue()&&!g.moveToPreviousToken())return-1;"="===g.currentValue()&&g.moveToPreviousToken();return g.$row}finally{for(f=0;f<e.length;f++)"undefined"!==typeof e[f]&&this.$tokens[f].push(e[f])}return-1};this.getLineSansComments=function(a,c,b){if(0>c)return"";for(var a=a.getLine(c),d=/(?!\\)\"/g,i=a,e=null,c=[];e=d.exec(i);)c.push(e.index);if(0<c.length&&0===c.length%2)for(d=0;d<c.length/2;d+=2)i=c[d+1],a=a.substring(0,c[d]+1)+a.substring(i,a.length);c=a.indexOf("//");-1!=c&&(a=a.substring(0,
c));k.test(a)&&(a=a.substring(0,a.lastIndexOf("\\")));b&&(a=a.replace(/\bconst\b/,"").replace(/\bnoexcept\b/,""));return a};this.findStartOfCommentBlock=function(a,c,b){for(var d=0,i=/^\s*\/+\*/;0<=c&&d<b;){if(i.test(a[c]))return c;--c;++d}return-1};this.getNextLineIndent=function(d,e,g,f,m){var r=c(),h=this.$session,p=h.getTabSize(),o=h.getDocument();"number"!==typeof f&&(f=h.getSelection().getCursor().row-1);if(-1===f)return e=o.getLine(0),0<e.length?this.$getIndent(e):"";if(0===e.length||/^\s*#/.test(e))return this.getNextLineIndent(a.getPrimaryState(h,
f-1),o.getLine(f-1),g,f-1,m);var j=this.$getIndent(e),H=this.$getUnindent(e,p),u=o.$lines;if(a.endsWith(d,"comment")||a.endsWith(d,"doc-start")){E&&E.row==f&&(e=e.substring(0,E.column));if(/^\s*$/.test(e))return this.$getIndent(u[f]);E=this.findStartOfCommentBlock(u,f,200);if(null!==E)return this.$getIndent(u[E])+" "}if(a.endsWith(d,"start")){d=null;if(n.test(e))return/\\\s*$/.test(e)?j+g:j;if(/^\s*#\s*\S/.test(e))return j;if(this.inMacro(u,f-1)&&!k.test(e))return H;var e=this.getLineSansComments(o,
f),E=h.getSelection().getCursor();E&&E.row==f&&!m&&(e=e.substring(0,E.column));H=this.getLineSansComments(o,f-1);if("string"!==typeof e)return"";if(0===e.length||/^\s*$/.test(e))return this.$getIndent(u[f]);if(/\*\/\s*$/.test(e)&&(d=this.findStartOfCommentBlock(u,f,200),0<=d))return this.$getIndent(u[d]);if(/^\s*<</.test(e)){for(e=f-1;/^\s*<</.test(u[e]);)e--;return this.$getIndent(u[e])}if(/^\s*\./.test(e)){for(e=f-1;/^\s*\./.test(u[e]);)e--;return this.$getIndent(u[e])}if(/\bnamespace\b.*\{\s*$/.test(e)||
/\bswitch\b.*\{\s*$/.test(e))return j;if(e.match(/\(\s*$/))return-1!==e.indexOf("=")||/^\s*(return\s+)?[a-zA-Z0-9_.->:]+\(\s*$/.test(e)?j+g:j+g+g;if(/^\s*(class|struct).*\{\s*$/.test(e)||/^\s*(class|struct)\s+.+:\s*$/.test(e))return j+g;if((d=e.match(/(^\s*(?:class|struct)\s+.*\w[^:]):[^:]\s*.+/))&&!/,\s*/.test(e)||(d=e.match(/^(\s*(class|struct).*:\s*).*,\s*$/)))return r?Array(d[1].length+1).join(" "):j+g;if(d=e.match(/^(\s*:\s*)(\w+).*,\s*$/))return r?Array(d[1].length+1).join(" "):j+g;if(d=e.match(/^(\s*)[:,]\s*[\w\s]*$/))return r?
Array(d[1].length+1).join(" "):j+g;if(/<\s*$/.test(e))return j+g;if(/^\s*\".*\"\s*$/.test(e)||/^\s*template\s*<.*>\s*$/.test(e)&&e.split(">").length==e.split("<").length)return j;if(/([\[\{\(<]).+,\s*$/.exec(e))for(var I=["(","{","[","<"],d=0;d<I.length;d++){var J=I[d],K=this.$complements[J],J=this.allIndicesOf(e,J);if(J.length&&(K=this.allIndicesOf(e,K),K=J.length-K.length-1,!(0>K))){u=J[K];return r?(e=e.substr(u+1).match(/([^\s])/),Array(u+e.index+2).join(" ")):j+g}}for(d=f-1;0<=d&&/^\s*$|^\s*#/.test(H);)H=
this.getLineSansComments(o,d),d--;if((l.test(e)||s.test(e))&&(l.test(H)||s.test(H)))return this.$getIndent(e);if(this.$tokenUtils.$tokenizeUpToRow(f+2)){I=Array(this.$tokens.length);try{for(d=0;d<this.$tokens.length;d++)if(null!=this.$tokens[d]&&0<this.$tokens[d].length){var P=this.$tokens[d];"\\"===P[P.length-1].value&&(I[d]=this.$tokens[d].splice(P.length-1,1)[0])}var q=this.getTokenCursor();m?(q.$row=f,q.$offset=this.$tokens[f].length-1):q.moveToPosition(E);for(;0>q.$offset&&0<q.$row;)q.$row--,
q.$offset=q.$tokens[q.$row].length-1;for(;0<q.$row&&/^\s*#/.test(o.getLine(q.$row));)q.$row--,q.$offset=q.$tokens[q.$row].length-1;var m="",R=q.cloneCursor(),L=R.currentValue(),N=R.currentType();if("constant"===N||"keyword"===N||"identifier"===N||b(["{",")",">",":"],L))m=g;for(;";"===q.currentValue()&&q.moveToPreviousToken(););var Q=q.cloneCursor();if(r&&q.isLastSignificantTokenOnLine()&&("keyword.operator"===q.currentType()||"punctuation.operator"===q.currentType())){var S=q.cloneCursor();S.$offset=
0;if("keyword"===S.currentType()){var F=e.split("(").length-e.split(")").length;if(0<F){var G=e.match(/.*?\(\s*(\S)/);if(G)return Array(G[0].length).join(" ")}}}if(","===q.currentValue()){if(r){var A=q.peekBwd();if("]"===A.currentValue()&&A.bwdToMatchingToken())return Array(A.currentPosition().column+1).join(" ");F=e.split("(").length-e.split(")").length;if(0<F&&(G=e.match(/.*?\(\s*(\S)/)))return Array(G[0].length).join(" ")}if(/[,(]\s*$/.test(e)&&/[,(]\s*$/.test(H))return this.$getIndent(e);var v=
q.cloneCursor();return v.findOpeningBracket("{",!1)&&v.bwdOverClassySpecifiers()&&"enum"===v.currentValue()?this.$getIndent(u[v.$row])+g:-1!==e.indexOf("=")?this.$getIndent(e)+g:this.$getIndent(e)}if("keyword.operator"===N&&":"!==L)return this.$getIndent(u[f])+g;for(;;){if("undefined"===typeof q.currentValue())return"undefined"!==typeof Q.currentValue()?this.$getIndent(u[Q.$row])+m:m;Q=q.cloneCursor();if(";"===q.currentValue()&&q.moveToNextToken()){for(f=q.$row;null!=u[f]&&/^\s*#/.test(u[f]);)++f;
return this.$getIndent(u[f])+m}if(b(["for","while","do","try"],q.currentValue())&&";"!==L)return this.$getIndent(u[q.$row])+m;A=q.peekBwd();if(":"===q.currentValue()){if(b(["public","private","protected"],A.currentValue()))return this.$getIndent(u[A.$row])+g;var B=u[q.$row];if(/^\s*case/.test(B))return this.$getIndent(B)+g;if(")"===A.currentValue()&&(v=A.cloneCursor(),v.bwdToMatchingToken())){var M=v.peekBwd(1),T=v.peekBwd(2);if(null!==M&&"identifier"===M.currentType()&&null!==T&&!/\boperator\b/.test(T.currentType()))return this.$getIndent(u[v.peekBwd().$row])+
m}}if("]"===q.currentValue()&&"("===q.peekFwd().currentValue()&&(v=q.cloneCursor(),v.bwdToMatchingToken()))return this.$getIndent(u[v.$row])+m;if("("===q.currentValue()&&"for"===A.currentValue()&&";"===L)return q.peekFwd().cloneCursor(),r?Array(q.peekFwd().currentPosition().column+1).join(" "):this.$getIndent(u[q.peekFwd().$row])+g;if(r&&"("===q.currentValue()&&!q.isLastSignificantTokenOnLine())return q.moveToNextToken(),Array(q.currentPosition().column+1+p).join(" ");if("if"===q.currentValue()||
"else"===q.currentValue()||"template"===q.currentValue()&&"<"===q.peekFwd().currentValue())return this.$getIndent(u[q.$row])+m;if("{"===q.currentValue()){var U=this.getRowForOpenBraceIndent(h,q.$row);return 0<=U?(e=this.getLineSansComments(o,U),j=this.$getIndent(e),/\bnamespace\b/.test(e)?j:j+g):this.$getIndent(u[q.$row])+g}if(0===q.$row&&0===q.$offset)return this.$getIndent(u[0])+m;if(">"===q.currentValue()&&(v=q.cloneCursor(),v.bwdToMatchingArrow()&&"template"===v.peekBwd().currentValue()))return">"===
L&&(m=""),this.$getIndent(u[v.$row])+m;q.bwdToMatchingToken();if(!q.moveToPreviousToken())break;for(;0<q.$row&&/^\s*#/.test(u[q.$row]);)q.$row--,q.$offset=this.$tokens[q.$row].length-1}}finally{for(d=0;d<I.length;d++)"undefined"!==typeof I[d]&&this.$tokens[d].push(I[d])}}}return j};this.$onDocChange=function(a){a=a.data;"insertLines"===a.action?this.$tokenUtils.$insertNewRows(a.range.start.row,a.range.end.row-a.range.start.row):"insertText"===a.action?this.$doc.isNewLine(a.text)?(this.$tokenUtils.$invalidateRow(a.range.start.row),
this.$tokenUtils.$insertNewRows(a.range.end.row,1)):this.$tokenUtils.$invalidateRow(a.range.start.row):"removeLines"===a.action?(this.$tokenUtils.$removeRows(a.range.start.row,a.range.end.row-a.range.start.row),this.$tokenUtils.$invalidateRow(a.range.start.row)):"removeText"===a.action&&(this.$doc.isNewLine(a.text)&&this.$tokenUtils.$removeRows(a.range.end.row,1),this.$tokenUtils.$invalidateRow(a.range.start.row));this.$scopes.invalidateFrom(a.range.start)};this.$getIndent=function(a){return(a=/^([ \t]*)/.exec(a))?
a[1]:""};this.$padIndent=function(a,c,d){c=Array(c+1).join(" ");c=a.replace("\t",c);return c>=d?a:a+Array(d-c+1).join(" ")};this.$getUnindent=function(a,c){var d=this.$getIndent(a);if(null===d||0===d.length)return"";var b=d.indexOf("\t");if(-1!=b)return d.substring(0,b)+d.substring(b+1,d.length);for(var e=b=0;e<c&&e<d.length;e++)" "===d[e]&&b++;return d.substring(b,d.length)}}).call(d.prototype);l.CppCodeModel=d});define("mode/cpp_scope_tree",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("mode/r_scope_tree"),f=k.ScopeManager,h=k.ScopeNode,g=function(c,a,d,b,e,f){this.label=c;this.start=a;this.preamble=d||a;this.end=null;this.scopeType=b;this.scopeCategory=e;this.attributes=f||{};this.parentScope=null;this.$children=[]};j.mixin(g.prototype,h.prototype);g.CATEGORY_CLASS=1;g.CATEGORY_NAMESPACE=2;g.CATEGORY_FUNCTION=3;g.CATEGORY_LAMBDA=4;g.CATEGORY_ANON=5;(function(){this.isClass=function(){return this.scopeType==
h.TYPE_BRACE&&this.scopeCategory==g.CATEGORY_CLASS};this.isNamespace=function(){return this.scopeType==h.TYPE_BRACE&&this.scopeCategory==g.CATEGORY_NAMESPACE};this.isFunction=function(){return this.scopeType==h.TYPE_BRACE&&this.scopeCategory==g.CATEGORY_FUNCTION};this.isLambda=function(){return this.scopeType==h.TYPE_BRACE&&this.scopeCategory==g.CATEGORY_LAMBDA}}).call(g.prototype);k=function(c){this.$ScopeNodeFactory=c;this.parsePos={row:0,column:0};this.$root=new c("(Top Level)",this.parsePos,null,
h.TYPE_ROOT)};j.mixin(k.prototype,f.prototype);(function(){this.onClassScopeStart=function(c,a,d,b){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,h.TYPE_BRACE,g.CATEGORY_CLASS,{name:b}));this.printScopeTree()};this.onNamespaceScopeStart=function(c,a,d,b){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,h.TYPE_BRACE,g.CATEGORY_NAMESPACE,{name:b}));this.printScopeTree()};this.onFunctionScopeStart=function(c,a,d,b,e){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,h.TYPE_BRACE,g.CATEGORY_FUNCTION,
{name:b,args:e}));this.printScopeTree()};this.onLambdaScopeStart=function(c,a,d,b){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,h.TYPE_BRACE,g.CATEGORY_LAMBDA,{args:b}));this.printScopeTree()};this.onScopeStart=function(c){this.$root.addNode(new this.$ScopeNodeFactory(null,c,null,h.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(c){c=this.$root.closeScope(c,h.TYPE_BRACE);this.printScopeTree();return c}}).call(k.prototype);l.CppScopeManager=k;l.CppScopeNode=g});define("mode/dcf",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("mode/dcf_highlight_rules").DcfHighlightRules,g=function(){this.$tokenizer=new f((new h).getRules())};j.inherits(g,k);(function(){this.getNextLineIndent=function(c,a){return this.$getIndent(a)}}).call(g.prototype);l.Mode=g});define("mode/dcf_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:["keyword","text"],regex:"^([\\w@-]+)(\\:)"},{token:"text",regex:".+"}]}};j.inherits(f,k);l.DcfHighlightRules=f});define("mode/doc_comment_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text_highlight_rules").TextHighlightRules,f=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:"."}]}};j.inherits(f,k);f.getStartRule=function(b){return{token:"comment.doc",
merge:!0,regex:"\\/\\*[\\*\\!]",next:b}};f.getEndRule=function(b){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:b}};l.DocCommentHighlightRules=f});define("util/expand_selection",["require","exports","module"],function(b){var l=b("ace/editor").Editor,j=b("ace/range").Range;b("ace/keyboard/vim");var k=b("ace/token_iterator").TokenIterator,f=b("mode/utils");(function(){function b(){if(e)for(var a=0;a<arguments.length;a++)console.log(arguments[a])}function g(a,c){for(var d=a.session.getTokens(c),b=0;b<d.length;b++){var e=d[b];if(!/^\s*$/.test(e.value))return/\bcomment\b/.test(e.type)}return!1}function c(a,c){var d=a.start.row<c.start.row||a.start.row===
c.start.row&&a.start.column<c.start.column,b=a.start.row===c.start.row&&a.start.column===c.start.column,e=a.end.row>c.end.row||a.end.row===c.end.row&&a.end.column>c.end.column,i=a.end.row===c.end.row&&a.end.column===c.end.column;return d?e||i:e?d||b:!1}function a(a,c){for(var d=a.getCurrentToken(),b=a.getCurrentTokenRow();a.moveToPreviousSignificantToken();){var e=a.getCurrentToken();if(b!==a.getCurrentTokenRow()&&0!==e.type.indexOf("keyword.operator")){if(!a.moveToNextSignificantToken())return!1;
break}if(m.test(d.value)&&(m.test(e.value)||f.isOpeningBracket(e.value)||f.contains(c,e.value))){if(!a.moveToNextSignificantToken())return!1;break}a.bwdToMatchingToken();d=a.getCurrentToken();b=a.getCurrentTokenRow()}return!0}function d(a,c,d){p.push({name:a,immediate:c,execute:d})}var i=this,e=!1,m=/['"\w.]/,o=!1;this.$onClearSelectionHistory=function(){return i.$clearSelectionHistory()};this.$clearSelectionHistory=function(){this.$selectionRangeHistory=null;this.off("change",this.$clearSelectionHistory)};
this.$acceptSelection=function(a,c,d){b("Accepting selection: ",d,c);null==this.$selectionRangeHistory&&(this.$selectionRangeHistory=[]);a.setSelectionRange(c);a.getRange().isEqual(d)||this.$selectionRangeHistory.push(d);(!this.isRowFullyVisible(c.start.row)||!this.isRowFullyVisible(c.end.row))&&this.centerSelection(a);return c};var p=[];d("string",!0,function(a,c,d,b){return(a=c.getTokenAt(b.start.row,b.start.column+1))&&/\bstring\b/.test(a.type)?new j(b.start.row,a.column+1,b.start.row,a.column+
a.value.length-1):null});d("token",!0,function(a,c,d,b){return(a=c.getTokenAt(b.start.row,b.start.column+1))&&/[\d\w]/.test(a.value)?new j(b.start.row,a.column,b.start.row,a.column+a.value.length):null});d("comment",!0,function(a,c,d,b){c=b.start.row;b=b.end.row;for(d=c;d<=b;d++)if(!g(a,d))return null;for(;g(a,c);)c--;for(;g(a,b);)b++;a=a.getSession().getLine(b-1).length;return new j(c+1,0,b-1,a)});d("includeBoundaries",!0,function(a,c,d,e){a=new k(c);d=a.moveToPosition(e.start);0===e.start.column&&
(d=a.moveToPreviousToken());c=new k(c);e=c.moveToPosition(e.end,!0);if(d&&e){var i="support.function.codebegin"===d.type&&"support.function.codeend"===e.type;i||(i=f.isOpeningBracket(d.value)&&f.getComplement(d.value)===e.value);if(i)return b("Expanding to match selection"),a=a.getCurrentTokenPosition(),d=c.getCurrentTokenPosition(),d.column+=e.value.length,j.fromPoints(a,d)}return null});d("matching",!1,function(a,c,d,b){a=new k(c);b=a.moveToPosition(b.start);if(null==b)return null;do{if(null==b)break;
if(!a.bwdToMatchingToken()&&(f.isOpeningBracket(b.value)||"support.function.codebegin"===b.type)){d=a.getCurrentTokenPosition();"support.function.codebegin"===b.type?(d.row++,d.column=0):d.column+=b.value.length;var e=a.clone();if(e.fwdToMatchingToken())return a=e.getCurrentTokenPosition(),"support.function.codebegin"===b.type&&(a.row--,a.column=c.getLine(a.row).length),j.fromPoints(d,a)}}while(b=a.stepBackward());return null});d("statement",!1,function(c,d,b,e){c=new k(d);if(!c.moveToPosition(e.start,
!0))return null;d=new k(d);if(!d.moveToPosition(e.end)||!a(c,[";",",","=","<-","<<-"]))return null;a:{for(var b=[";",","],i=d.getCurrentToken(),g=d.getCurrentTokenRow();d.moveToNextSignificantToken();){var h=d.getCurrentToken();if(g!==d.getCurrentTokenRow()&&0!==i.type.indexOf("keyword.operator")){if(!d.moveToPreviousSignificantToken()){b=!1;break a}break}if(m.test(i.value)||f.isClosingBracket(i.value))if(m.test(h.value)||f.isClosingBracket(h.value)||f.contains(b,h.value)){if(!d.moveToPreviousSignificantToken()){b=
!1;break a}break}d.fwdToMatchingToken();i=d.getCurrentToken();g=d.getCurrentTokenRow()}b=!0}if(!b)return null;b=c.getCurrentTokenPosition();i=d.getCurrentTokenPosition();if(b.row===e.start.row&&b.column===e.start.column&&i.row===e.end.row&&i.column<=e.end.column&&!a(c,[";",","]))return null;e=c.getCurrentTokenPosition();c=d.getCurrentTokenPosition();c.column+=d.getCurrentTokenValue().length;return j.fromPoints(e,c)});d("scope",!1,function(a,c,d,b){d=c.getMode();if(null==d.codeModel||null==d.codeModel.getCurrentScope)return null;
a=[];for(b=d.codeModel.getCurrentScope(b.start);null!=b;){var d=b.preamble,e=b.end;if(null==e&&b.parentScope)for(var i=b.parentScope.$children,f=i.length-2;0<=f;f--)if(i[f].equals(b)){e=i[f+1].preamble;break}null==e&&(e={row:c.getLength(),column:0});a.push(j.fromPoints(d,e));b=b.parentScope}return 0===a.length?null:a});d("everything",!1,function(a,c){var d=c.getLength();if(0===d)return new j(0,0,0,0);var b=c.getLine(d-1);return new j(0,0,d-1,b.length)});this.$expandSelection=function(){b("Begin new expand selection session");
b("----------------------------------");o||(i.on("change",i.$onClearSelectionHistory),o=!0);for(var a=this.getSession(),d=this.getSelection(),e=d.getRange(),g=[],m=0;m<p.length;m++){var k=p[m],j=k.execute(this,a,d,e);f.isArray(j)||(j=[j]);for(var l=0;l<j.length;l++){var D=j[l];if(D&&k.immediate&&c(D,e))return b("Accepting immediate expansion: '"+k.name+"'"),this.$acceptSelection(d,D,e);D&&c(D,e)&&g.push({name:k.name,range:D})}}g.sort(function(a,c){var a=a.range,c=c.range,d=a.end.row-a.start.row,b=
c.end.row-c.start.row;return d!==b?d>b:a.end.column-a.start.column>c.end.column-c.start.column});a=g[0].range;b("Selected candidate '"+g[0].name+"'",a);return this.$acceptSelection(d,a,e)};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;o&&(i.off("change",i.$onClearSelectionHistory),o=!1);
return this.getSelectionRange()}}).call(l.prototype)});define("mode/markdown",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/mode/javascript").Mode,h=b("ace/mode/xml").Mode,g=b("ace/mode/html").Mode,c=b("mode/markdown_highlight_rules").MarkdownHighlightRules,a=b("mode/markdown_folding").FoldMode,d=function(){this.HighlightRules=c;this.createModeDelegates({"js-":f,"xml-":h,"html-":g});this.foldingRules=new a};j.inherits(d,k);(function(){this.type="text";this.blockComment={start:"<\!--",end:"--\>"};
this.getNextLineIndent=function(a,c){return this.$getIndent(c)};this.$id="mode/markdown"}).call(d.prototype);l.Mode=d});define("mode/markdown_folding",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/folding/fold_mode").FoldMode,f=b("ace/range").Range,h=l.FoldMode=function(){},g=b("mode/utils");j.inherits(h,k);(function(){this.foldingStartMarker=/^(?:[=-]+\s*$|#{1,6} |`{3})/;this.getFoldWidget=function(c,a,d){var a="markbeginend"===a?"end":"",b=c.getLine(d);return!this.foldingStartMarker.test(b)?"":"`"==b[0]?"start"===g.getPrimaryState(c,d)?a:"start":""};this.getFoldWidgetRange=function(c,
a,d){function b(a){return(j=c.getTokens(a)[0])&&0===j.type.lastIndexOf(l,0)}function e(){var a=j.value[0];return"="==a?6:"-"==a?5:7-j.value.search(/[^#]/)}var m=c.getLine(d),a=m.length,h=c.getLength(),p=d,k=d;if(m.match(this.foldingStartMarker)){if("`"==m[0]){if("start"!==g.getPrimaryState(c,d)){for(;++d<h&&!(m=c.getLine(d),"`"==m[0]&"```"==m.substring(0,3)););return new f(p,a,d,0)}for(;0<d--&&!(m=c.getLine(d),"`"==m[0]&"```"==m.substring(0,3)););return new f(d,m.length,p,0)}var j,l="markup.heading";
if(b(d)){for(k=e();++d<h&&!(b(d)&&e()>=k););k=d-(!j||-1==["=","-"].indexOf(j.value[0])?1:2);if(k>p)for(;k>p&&/^\s*$/.test(c.getLine(k));)k--;if(k>p)return d=c.getLine(k).length,new f(p,a,k,d)}}}}).call(h.prototype)});define("mode/markdown_highlight_rules",["require","exports","module"],function(b,l){function j(a,c){return{token:"support.function",regex:"^\\s*```(?:\\{"+a+"[^\\}]*\\}|"+a+")\\s*$",push:c+"start"}}var k=b("ace/lib/oop"),f=b("ace/lib/lang"),h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=b("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,c=b("ace/mode/xml_highlight_rules").XmlHighlightRules,a=b("ace/mode/html_highlight_rules").HtmlHighlightRules,d=b("ace/mode/css_highlight_rules").CssHighlightRules,
i=b("ace/mode/perl_highlight_rules").PerlHighlightRules,e=b("ace/mode/python_highlight_rules").PythonHighlightRules,m=b("ace/mode/ruby_highlight_rules").RubyHighlightRules,o=b("ace/mode/scala_highlight_rules").ScalaHighlightRules,p=b("ace/mode/sh_highlight_rules").ShHighlightRules;b("mode/stan_highlight_rules");var n=b("mode/sql_highlight_rules").SqlHighlightRules,x=function(a){return"(?:[^"+f.escapeRegExp(a)+"\\\\]|\\\\.)*"},w=function(){var b=f.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(",")),
h={token:["text","constant.numeric"],regex:"(\\s+|^)(__.+?__)\\b"},k={token:["text","constant.language.boolean"],regex:"(\\s+|^)(_(?=[^_])(?:(?:\\\\.)|(?:[^_\\\\]))*?_)\\b"},l={token:["constant.numeric"],regex:"([*][*].+?[*][*])"},w={token:["constant.language.boolean"],regex:"([*](?=[^*])(?:(?:\\\\.)|(?:[^*\\\\]))*?[*])"};this.$rules={basic:[{token:"constant.language.escape",regex:/\\[\\`*_{}\[\]()#+\-.!]/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function",
"support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)"},{token:"text,constant,text,url,string,text".split(","),regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},{token:["text","keyword","text","constant","text"],regex:"(\\[)("+x("]")+")(\\]s*\\[)("+x("]")+")(\\])"},{token:"text,keyword,text,markup.href,string,text".split(","),regex:"(\\[)("+x("]")+')(\\]\\()((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)(\\s*"'+x('"')+'"\\s*)?(\\))'},{token:["text","keyword","text"],
regex:"(<)((?:https?|ftp|dict):[^'\">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)"},l,h,w,k],start:[{token:"empty_line",regex:"^$",next:"allowBlock"},{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"},j("(?:javascript|js)","jscode-"),j("xml","xmlcode-"),j("html","htmlcode-"),j("css","csscode-"),j("perl","perlcode-"),j("python","pythoncode-"),j("ruby","rubycode-"),j("scala","scalacode-"),j("sh","shcode-"),j("bash","bashcode-"),j("stan","stancode-"),j("sql","sqlcode-"),{token:"support.function",regex:"^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",next:"githubblock"},{token:"string.blockquote",regex:"^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
next:"blockquote"},{token:"text,constant,text,url,string,text".split(","),regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},{token:["text","keyword","text","constant","text"],regex:"(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"},{token:"constant",regex:"^[ ]{0,2}(?:[ ]?\\*[ ]?){3,}\\s*$"},{token:"constant",regex:"^[ ]{0,2}(?:[ ]?\\-[ ]?){3,}\\s*$"},{token:"constant",regex:"^[ ]{0,2}(?:[ ]?\\_[ ]?){3,}\\s*$"},{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:"constant",regex:"^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",next:"allowBlock"},{token:"text",regex:"^\\s*(?:[*+-]|\\d+\\.)\\s+",next:"listblock"},l,h,w,k,{token:"comment",regex:"<\\!--",next:"html-comment"},{include:"basic"}],"html-comment":[{token:"comment",
regex:"--\>",next:"start"},{defaultToken:"comment"}],allowBlock:[{token:"support.function",regex:"^ {4}.+",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"},{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:"string.blockquote",regex:"^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",next:"blockquote"},{include:"basic",noEscape:!0},{defaultToken:"string.blockquote"}],githubblock:[{token:"support.function",regex:"^\\s*```",next:"start"},{token:"support.function",regex:".+"}],fieldblock:[{token:function(a){a=a.slice(0,-1);return b[a]?"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(g,"jscode-",
[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(a,"htmlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(d,"csscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(c,"xmlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(i,"perlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(e,"pythoncode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(m,
"rubycode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(o,"scalacode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(p,"shcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(p,"bashcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(n,"sqlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.normalizeRules()};k.inherits(w,h);l.MarkdownHighlightRules=w});define("mode/mermaid",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("mode/mermaid_highlight_rules").MermaidHighlightRules,g=function(){this.$highlightRules=new h;this.$tokenizer=new f(this.$highlightRules.getRules())};j.inherits(g,k);(function(){this.getNextLineIndent=function(c,a){return this.$getIndent(a)}}).call(g.prototype);l.Mode=g});define("mode/mermaid_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text_highlight_rules").TextHighlightRules,f=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}]}};j.inherits(f,k);l.MermaidHighlightRules=f});define("mode/r",["require","exports","module"],function(b,l){b("ace/editor");b("ace/edit_session");b("ace/range");var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=b("mode/r_highlight_rules").RHighlightRules,c=b("mode/r_code_model").RCodeModel,a=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent;b("mode/auto_brace_insert");var d=b("ace/unicode"),i=function(d,b){this.$tokenizer=d?new f((new h).getRules()):
new f((new g).getRules());this.foldingRules=this.codeModel=new c(b,this.$tokenizer);this.$outdent=new a(this.codeModel)};j.inherits(i,k);(function(){this.checkOutdent=function(a,c,d){return this.$outdent.checkOutdent(a,c,d)};this.autoOutdent=function(a,c,d){return this.$outdent.autoOutdent(a,c,d)};this.tokenRe=RegExp("^["+d.packages.L+d.packages.Mn+d.packages.Mc+d.packages.Nd+d.packages.Pc+"._]+","g");this.nonTokenRe=RegExp("^(?:[^"+d.packages.L+d.packages.Mn+d.packages.Mc+d.packages.Nd+d.packages.Pc+
"._]|\\s])+","g");this.$complements={"(":")","[":"]",'"':'"',"'":"'","{":"}","`":"`"};this.$reOpen=/^[{(\["'`]$/;this.$reClose=/^[})\]"'`]$/;this.getNextLineIndent=function(a,c,d,b){return this.codeModel.getNextLineIndent(a,c,d,b)};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,c,d,b,i){return"insertion"===c&&"\n"===
i&&(a=d.getSelectionRange().start,(b=/^((\s*#+')\s*)/.exec(b.doc.getLine(a.row)))&&d.getSelectionRange().start.column>=b[2].length)?{text:"\n"+b[1]}:!1};this.$id="mode/r"}).call(i.prototype);l.Mode=i});define("mode/r_code_model",["require","exports","module"],function(b,l){function j(a,c){for(var d=0;d<c.length;d++)if(a===c[d])return!0;return!1}var k=b("ace/range").Range,f=b("ace/token_iterator").TokenIterator,h=b("mode/token_cursor").RTokenCursor,g=b("mode/utils"),c=!1,a=b("mode/r_scope_tree").ScopeManager,d=b("mode/r_scope_tree").ScopeNode,i=function(c,b,i,f,g){this.$session=c;this.$doc=c.getDocument();this.$tokenizer=b;this.$tokens=Array(this.$doc.getLength());this.$endStates=Array(this.$doc.getLength());
this.$statePattern=i;this.$codeBeginPattern=f;this.$codeEndPattern=g;this.$scopes=new a(d);var h=!0,k=function(){h?h=!1:(this.$doc.off("change",j),this.$session.off("changeMode",k))}.bind(this),j=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",k);this.$doc.on("change",j)};(function(){function a(c){return"keyword"==c.type&&"function"==c.value}function d(a){return/\boperator\b/.test(a.type)&&/^(=|<-|<<-)$/.test(a.value)}function b(a){return/\bidentifier\b/.test(a.type)}function i(c){var d=
c.cloneCursor();if("{"!==d.currentValue()||!d.moveBackwardOverMatchingParens()||!d.moveToPreviousToken()||!a(d.currentToken()))return!1;c.$row=d.$row;c.$offset=d.$offset;return!0}function n(a){for(;a.findOpeningBracket("(")&&a.moveToPreviousToken();)if(j(a.currentValue(),["if","for","while"]))return!0;return!1}function l(c){var b=c.cloneCursor();if(!a(b.currentToken())||!b.moveToPreviousToken()||!d(b.currentToken())||!b.moveToPreviousToken())return!1;c.$row=b.$row;c.$offset=b.$offset;return!0}function w(a){return/\binfix\b/.test(a.type)}
function s(c){if(a(c.currentToken())&&!c.moveToNextToken()||"("===c.currentValue()&&!c.moveToNextToken()||")"===c.currentValue())return[];var d=[];for(b(c.currentToken())&&d.push(c.currentValue());c.moveToNextToken();)if(!c.fwdToMatchingToken()){if(")"===c.currentValue())break;if(","===c.currentValue()){for(;","===c.currentValue()&&c.moveToNextToken(););b(c.currentToken())&&d.push(c.currentValue())}}return d}function t(a){for(var c=0,d=Math.min(a.getLength(),100),b="Title";c++<d;){var e=a.getLine(c);
if(/^\s*[-]{3}\s*$/.test(e))break;e=/^\s*title:\s+(.*?)\s*$/.exec(e);if(null!==e){b=e[1];break}}return g.stripEnclosingQuotes(b.trim())}var O=g.contains;this.getTokenCursor=function(){return new h(this.$tokens,0,0,this)};this.$complements={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{"};var C=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 a=a.cloneCursor(),c="";a.hasType("identifier")&&(c=a.currentValue());var d="left";"="===a.currentValue()&&(d="right");if(a.hasType("identifier")){if(!a.moveToPreviousToken())return null;"="===a.currentValue()&&(d="right")}if(!a.findOpeningBracket("(",!0)||!a.moveToPreviousToken())return null;for(;a.findOpeningBracket("(",!0)&&a.moveToPreviousToken();)if(/_join$/.test(a.currentValue())){var b=
a.currentValue();if(!a.moveToNextToken())break;if(!a.moveToNextToken())break;var e=a.currentValue(),i="";if(!1===this.moveToDataObjectFromInfixChain(a))break;i=a.currentValue();return{token:c,leftData:i,rightData:e,verb:b,cursorPos:d}}return null};this.getDataFromInfixChain=function(a){var c=this.moveToDataObjectFromInfixChain(a),d=[],b=[],e="",i=!1;!1!==c&&(c.excludeArgsFromObject&&(i=c.excludeArgsFromObject),e=a.currentValue(),d=c.additionalArgs,b=c.excludeArgs);return{name:e,additionalArgs:d,excludeArgs:b,
excludeArgsFromObject:i}};var y="mutate,summarise,summarize,rename,transmute,select,rename_vars,inner_join,left_join,right_join,semi_join,anti_join,outer_join,full_join".split(","),D=function(a,c,d,b){if(!a.moveToNextToken()||"("!==a.currentValue()||!a.moveToNextToken()||")"===a.currentValue())return!1;a.hasType("identifier")&&c.additionalArgs.push(a.currentValue());if("rename"===b){if(!a.moveToNextToken())return!1;c.excludeArgs.push(a.currentValue())}"select"===b&&(c.excludeArgsFromObject=!0);do{if(")"===
a.currentValue())break;if(a.$row>d.$row||a.$row===d.$row&&a.$offset>=d.$offset)break;if(a.fwdToMatchingToken()){if(!a.moveToNextToken())break}else if(","===a.currentValue()){if(!a.moveToNextToken())return!1;a.hasType("identifier")&&c.additionalArgs.push(a.currentValue());if(!a.moveToNextToken())return!1;if("="===a.currentValue()&&j(b,["rename","rename_vars"])){if(!a.moveToNextToken())return!1;a.hasType("identifier")&&c.excludeArgs.push(a.currentValue())}}}while(a.moveToNextToken());return!0};this.moveToDataObjectFromInfixChain=
function(a){var c=a.cloneCursor(),d;a:{for(d=c.cloneCursor();d.findOpeningBracket("(",!1)&&d.moveToPreviousToken();){if(!d.moveToPreviousToken())break;if(":"===d.currentValue()){for(;":"===d.currentValue();)if(!d.moveToPreviousToken()){d=!1;break a}if(!d.moveToPreviousToken())break}if(w(d.currentToken())){c.$row=d.$row;c.$offset=d.$offset;d=!0;break a}}d=!1}if(!d)return!1;for(d={additionalArgs:[],excludeArgs:[]};;){if(0===c.$row&&0===c.$offset)return a.$row=0,a.$offset=0,d;c.moveBackwardOverMatchingParens();
if(!c.moveToPreviousToken())return!1;var b=c.currentValue();O(y,b)&&D(c.cloneCursor(),d,a,b);if(!c.moveToPreviousToken())return 0===c.$row&&0===c.$offset?(a.$row=0,a.$offset=0,d):!1;if(":"===c.currentValue()){for(;":"===c.currentValue();)if(!c.moveToPreviousToken())return!1;if(!c.moveToPreviousToken())return!1}if(!w(c.currentToken()))break}if(!c.moveToNextToken())return!1;a.$row=c.$row;a.$offset=c.$offset;return d};this.getVariablesInScope=function(a){var c=this.getTokenCursor();if(!c.moveToPosition(a))return[];
a=c.cloneCursor();!a.findOpeningBracket("(",!0)||!a.moveToPreviousToken()?a=!1:"function"!==a.currentValue()?a=!1:(c.$row=a.$row,c.$offset=a.$offset,a=!0);a&&l(c)&&c.findStartOfEvaluationContext();a={};do if(!c.bwdToMatchingToken()){var e=a,i=c.cloneCursor();if(!("for"!==i.currentValue()||!i.moveToNextToken()||"("!==i.currentValue())&&i.moveToNextToken()){var f=i.currentValue();i.moveToNextToken()&&"in"===i.currentValue()&&(e[f]="variable")}d(c.currentToken())&&(e="variable",i=c.cloneCursor(),i.moveToNextToken()&&
"function"===i.currentValue()&&(e="function"),i=c.cloneCursor(),i.moveToPreviousToken()&&b(i.currentToken())&&(i=i.currentValue(),a[i]=e))}while(c.moveToPreviousToken());var c=[],g;for(g in a)c.push({token:g,type:a[g]});c.sort();return c};this.$buildScopeTreeUpToRow=function(a){function c(a,d){if("undefined"===typeof a)return"";var b=a.exec(d);if(!b)return null;var e=b[1].split(",");if(0==e.length)return null;if(!/=/.test(e[0]))return e[0].replace(/(^\s+)|(\s+$)/g,"");for(var i=0;i<e.length;i++)if(b=
/^\s*label\s*=\s*(.*)$/.exec(e[i]))return g.stripEnclosingQuotes(b[1].trim());return null}var d=this.$session.getMode().$id,a=Math.min(a+30,this.$doc.getLength()-1),b=this.$scopes.parsePos.row;if(b>=a)return b;b=new f(this.$session);b.tokenizeUpToRow(a);this.$tokenizeUpToRow(a);var e=this.$scopes.parsePos.row;b.moveToPosition({row:e,column:this.$scopes.parsePos.column},!0);var m=b.getCurrentToken();if(null==m)return e;var e=m.value,h=m.type,j=b.getCurrentTokenPosition();do{if(b.$row>a)break;e=m.value;
h=m.type;j=b.getCurrentTokenPosition();if("rd-start"===this.$session.getState(j.row))b.moveToEndOfRow();else if(m=!0,this.$codeBeginPattern&&(m=/^r-/.test(this.$session.getState(b.$row))),g.startsWith(h,"markup.heading")){var m="",o={row:j.row,column:0},n={row:j.row+1,column:0},h=0;if(/^\s*#+\s*$/.test(e))h=e.split("#").length-1,e=this.$session.getLine(j.row),m=e.replace(/^\s*[#]+\s*/,"");else if(/^[-=]{3,}\s*$/.test(e)&&(h="="===e[0]?1:2,m=this.$session.getLine(j.row-1).trim(),o.row--,0===m.length))continue;
0===m.length&&(m="(Untitled)");m=m.replace(/{.*}\s*$/,"");this.$scopes.onMarkdownHead(m,o,n,h)}else if(m&&/\bsectionhead\b/.test(h)){m="(Untitled)";if(h=/[^#=-\s]/.exec(e))m=e.substr(h.index),m=m.replace(/\s*[#=-]+\s*$/,"");this.$scopes.onSectionHead(m,j)}else if(!m&&"mode/sweave"===d&&"keyword"===h&&0===e.indexOf("\\")&&("\\chapter"===e||"\\section"===e||"\\subsection"===e||"\\subsubsection"===e))h=1,"\\chapter"===e?h=2:"\\section"===e?h=3:"\\subsection"===e?h=4:"\\subsubsection"===e&&(h=5),e=this.$doc.getLine(j.row),
e=/{([^}]*)}/.exec(e),m="",null!=e&&(m=e[1]),o={row:j.row,column:0},n={row:j.row,column:Infinity},this.$scopes.onMarkdownHead(m,o,n,h);else if(/\bcodebegin\b/.test(h)&&"---"===e)this.$scopes.onSectionHead(t(this.$session),j,{isYaml:!0});else if(/\bcodeend\b/.test(h)&&"---"===e)j.column=Infinity,this.$scopes.onSectionEnd(j);else if("mode/rmarkdown"===d&&/\bcodebegin\b/.test(h)&&0===e.trim().indexOf("/***"))this.$scopes.onSectionHead("(R Code Chunk)",j);else if("mode/rmarkdown"===d&&/\bcodeend\b/.test(h)&&
0===e.trim().indexOf("*/"))this.$scopes.onSectionEnd(j);else/\bcodebegin\b/.test(h)?(m={row:j.row+1,column:0},o=this.$scopes.getChunkCount()+1,h=c(this.$codeBeginPattern,e),o="Chunk "+o,h&&"YAML Header"!==e&&(o+=": "+h),this.$scopes.onChunkStart(h,o,j,m)):/\bcodeend\b/.test(h)?(j.column+=e.length,this.$scopes.onChunkEnd(j)):m&&"{"===e?(e=this.getTokenCursor(),e.moveToPosition(j,!0),j=e.cloneCursor(),i(j)?(m=j.cloneCursor(),m.moveToNextToken(),h=null,l(j)&&(o=j.cloneCursor(),n=j.cloneCursor(),n.findStartOfEvaluationContext()&&
(h=n.currentPosition(),n=o.currentPosition(),h.row!==n.row?(h.row=n.row,h.column=0,j.$row=h.row,j.$offset=0):j.moveToPosition(h,!0),h=this.$doc.getTextRange(new k(h.row,h.column,n.row,n.column+o.currentValue().length)))),o=j.currentPosition(),j.isFirstSignificantTokenOnLine()&&(o.column=0),j=s(m),m="("+j.join(", ")+")",this.$scopes.onFunctionScopeStart(null==h?C("<function>"+m):C(h+m),o,e.currentPosition(),h,j)):(o=e.currentPosition(),e.isFirstSignificantTokenOnLine()&&(o.column=0),this.$scopes.onScopeStart(o))):
m&&"}"===e&&(j.column+=1,this.$scopes.onScopeEnd(j))}while(m=b.moveToNextToken());a=Math.max(a,b.$row);this.$scopes.parsePos={row:a,column:-1};return a};this.$getFoldToken=function(a,c,d){this.$tokenizeUpToRow(d);if(this.$statePattern&&!this.$statePattern.test(this.$endStates[d]))return"";a=this.$tokens[d];for(d=0;d<a.length;d++)if(/\bsectionhead\b/.test(a[d].type))return a[d];for(var b=0,e=null,i=null,d=0;d<a.length;d++){var f=a[d];if(/\bparen\b/.test(f.type))switch(f.value){case "{":b++;1==b&&(e=
f);break;case "}":b--,0==b&&(e=null),0>b&&(i=f,b=0)}}return e?e:"markbeginend"==c&&i?i:1<=a.length&&(/\bcodebegin\b/.test(a[0].type)||/\bcodeend\b/.test(a[0].type))?a[0]:null};this.getFoldWidget=function(a,c,d){a=this.$getFoldToken(a,c,d);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,c,d){var b=this.$getFoldToken(a,c,d);if(b){c={row:d,column:b.column+
1};if("{"==b.value)return a=a.$findClosingBracket(b.value,c),!a?void 0:k.fromPoints(c,a);if("}"==b.value)return a=a.$findOpeningBracket(b.value,c),!a?void 0:k.fromPoints({row:a.row,column:a.column+1},{row:c.row,column:c.column-1});if(/\bcodebegin\b/.test(b.type))for(var c=new f(a,d,0),e;e=c.stepForward();){if(/\bcode(begin|end)\b/.test(e.type))return e=/\bcodebegin\b/.test(e.type),c=c.getCurrentTokenRow(),a=e?{row:c-1,column:a.getLine(c-1).length}:{row:c,column:a.getLine(c).length},k.fromPoints({row:d,
column:b.column+b.value.length},a)}else if(/\bcodeend\b/.test(b.type))for(c=new f(a,d,0);b=c.stepBackward();){if(/\bcodebegin\b/.test(b.type))return c=c.getCurrentTokenRow(),k.fromPoints({row:c,column:a.getLine(c).length},{row:d,column:a.getLine(d).length})}else if(/\bsectionhead\b/.test(b.type)){b=a.getLine(d);if(/^\s*[#=-]+\s*$/.test(b))b=b.length;else{b=/[#=-]+\s*$/.exec(b);if(!b)return;b=b.index}c.column=b;d=new f(a,d+1);for(d.$tokenIndex=-1;(token=d.stepForward())&&!("}"===token.value||/\bsectionhead\b/.test(token.type)||
/\bcode(?:begin|end)/.test(token.type));)"{"===token.value&&d.fwdToMatchingToken();d=d.getCurrentTokenRow();token&&d--;a={row:d,column:a.getLine(d).length};return k.fromPoints(c,a)}}};this.getCurrentScope=function(a,c){c||(c=function(){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);var d=this.$scopes.getActiveScopes(a);if(d)for(var b=d.length-1;0<=b;b--)if(c(d[b]))return d[b];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.getScopeList()};
this.findFunctionDefinitionFromUsage=function(a,c){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.findFunctionDefinitionFromUsage(a,c)};this.getIndentForOpenBrace=function(a){if(this.$tokenizeUpToRow(a.row)){var c=this.getTokenCursor();if(c.seekToNearestToken(a,a.row)&&"{"==c.currentValue()&&c.moveBackwardOverMatchingParens())return this.$getIndent(this.$getLine(c.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,b,e,i){if(g.endsWith(a,"qstring"))return"";"number"!==typeof i&&(i=this.$session.getSelection().getCursor().row-1);var f=this.$session.getTabSize(),a=Array(f+1).join(" ");this.$lineOverrides=null;this.$doc.getLine(i)!==b&&(this.$lineOverrides={},this.$lineOverrides[i]=b,this.$invalidateRow(i));try{var h=0>i?"":this.$getIndent(this.$getLine(i));if(!this.$tokenizeUpToRow(i))return h;var k={row:i,column:this.$getLine(i).length},
o=this.$findPreviousSignificantToken(k,i-10),h="",p=!1;if(o&&("keyword.operator"===o.token.type||"keyword.operator.infix"===o.token.type))h=e,p=!0;else if(o&&/\bparen\b/.test(o.token.type)&&/\)$/.test(o.token.value)){var l=this.$walkParensBalanced(o.row,o.row-10,null,function(a){return 0===a.length});if(null!=l){var x=this.$findPreviousSignificantToken(l,0);if(x&&"keyword"===x.token.type&&/^(if|while|for|function)$/.test(x.token.value))return this.$getIndent(this.$getLine(x.row))+e}}else if(o&&"keyword"===
o.token.type&&("repeat"===o.token.value||"else"===o.token.value))return this.$getIndent(this.$getLine(o.row))+e;var s=this.getTokenCursor();if(!s.moveToPosition(k))return"";do{var q=s.currentType();if("support.function.codebegin"===q||"support.function.codeend"===q)return this.$getIndent(this.$doc.getLine(s.$row))+h;var t=s.currentValue();if(s.isAtStartOfNewExpression(!1)){if("{"===t||"["===t||"("===t)h+=e;return this.$getIndent(this.$doc.getLine(s.$row))+h}if("("===t&&s.isAtStartOfNewExpression(!0))return this.$getIndent(this.$doc.getLine(s.$row))+
e;if(!s.bwdToMatchingToken()){if("{"===t)break;if(O(["[","("],t)){var w=s.currentPosition(),k=null;c&&(k=this.$findNextSignificantToken({row:w.row,column:w.column+1},i));if(k){for(var b=this.$getLine(k.row),y=b.replace(/[^\s].*$/,""),C=k.column-y.length,D=Math.floor(C/f),w=C-f*D,C="",b=0;b<D;b++)C+=e;for(e=0;e<w;e++)C+=" ";for(var e=y+C,F=e.replace("\t",a).length,G,b=k.row+1;b<=i;b++)if(/[^\s]/.test(this.$getLine(b))){var A=this.$endStates[b-1];if(!("qstring"===A||"qqstring"===A)){G=this.$getLine(b).replace(/[^\s].*$/,
"");var v=G.replace("\t",a).length;v<F&&(e=G,F=v)}}return n(s)?e:e+h}return this.getIndentForOpenBrace(w)+e+h}}}while(s.moveToPreviousToken());if(!s.moveToPosition(k))return"";do if(!s.bwdToMatchingToken()){if("{"===s.currentValue())return this.getIndentForOpenBrace(s.currentPosition())+e+h;if(d(s.currentToken())){for(;d(s.currentToken())&&s.moveToPreviousToken();){if(!s.findStartOfEvaluationContext())break;var B=s.cloneCursor();if(B.moveToPreviousToken()&&("else"===B.currentValue()||"repeat"===B.currentValue()||
")"===B.currentValue()&&B.bwdToMatchingToken()&&B.moveToPreviousToken()&&(t=B.currentValue(),O(["if","for","while","repeat","else"],t))))return this.$getIndent(this.$doc.getLine(B.$row))+h+h;d(s.peekBwd().currentToken())&&s.moveToPreviousToken()}return this.$getIndent(this.$getLine(s.$row))+h}}while(s.moveToPreviousToken());if(p){F=0;s=this.getTokenCursor();s.moveToPosition(k);s.moveToPreviousToken();do{if(j(s.currentValue(),["if","else"])){h+=e;break}if(s.hasType("constant","identifier")){if(!s.moveToPreviousToken())break;
if(j(s.currentValue(),["if","else"])){h+=e;break}if(")"===s.currentValue()){if(!s.bwdToMatchingToken())break;if(!s.moveToPreviousToken())break;if(j(s.currentValue(),["if","else"])){h+=e;break}}if(!s.hasType("operator"))break}else if(!s.findStartOfEvaluationContext())break}while(s.moveToPreviousToken()&&20>F++)}var M=this.$findNextSignificantToken({row:0,column:0},i);return M?this.$getIndent(this.$getLine(M.row))+h:""+h}finally{this.$lineOverrides&&(this.$lineOverrides=null,this.$invalidateRow(i))}};
this.getBraceIndent=function(a){var c=this.getTokenCursor(),d={row:a,column:this.$getLine(a).length};if(!c.moveToPosition(d))return"";if(")"===c.currentValue()){if(c.bwdToMatchingToken()&&c.moveToPreviousToken()&&(d=c.currentValue(),j(d,["if","while","for","function"])))return this.$getIndent(this.$getLine(c.$row))}else if(j(c.currentValue(),["else","repeat","<-","<<-","="])||c.hasType("infix")||"keyword.operator"===c.currentType())return this.$getIndent(this.$getLine(c.$row));return this.getIndentForRow(a)};
this.getTokenForPos=function(a,c,d){this.$tokenizeUpToRow(a.row);if(this.$tokens.length<=a.row)return null;for(var b=this.$tokens[a.row],e=0;e<b.length;e++){var i=b[e];if(c&&a.column==i.column)return i;if(a.column<=i.column)break;if(d&&a.column==i.column+i.value.length||a.column<i.column+i.value.length)return i}return null};this.$tokenizeUpToRow=function(a){for(var a=Math.min(a,this.$endStates.length-1),c=0,d=!0;c<=a;c++)if(!d||!this.$endStates[c]){var d=!1,b=0===c?"start":this.$endStates[c-1],e=
this.$tokenizer.getLineTokens(this.$getLine(c),b);this.$tokens[c]=!this.$statePattern||this.$statePattern.test(e.state)||this.$statePattern.test(b)?this.$filterWhitespaceAndComments(e.tokens):[];e.state===this.$endStates[c]?d=!0:this.$endStates[c]=e.state}d||c<this.$tokens.length&&this.$invalidateRow(c);return!0};this.$onDocChange=function(a){a=a.data;"insertLines"===a.action?this.$insertNewRows(a.range.start.row,a.range.end.row-a.range.start.row):"insertText"===a.action?this.$doc.isNewLine(a.text)?
(this.$invalidateRow(a.range.start.row),this.$insertNewRows(a.range.end.row,1)):this.$invalidateRow(a.range.start.row):"removeLines"===a.action?(this.$removeRows(a.range.start.row,a.range.end.row-a.range.start.row),this.$invalidateRow(a.range.start.row)):"removeText"===a.action&&(this.$doc.isNewLine(a.text)&&this.$removeRows(a.range.end.row,1),this.$invalidateRow(a.range.start.row));this.$scopes.invalidateFrom(a.range.start)};this.$invalidateRow=function(a){this.$tokens[a]=null;this.$endStates[a]=
null};this.$insertNewRows=function(a,c){for(var d=[a,0],b=0;b<c;b++)d.push(null);this.$tokens.splice.apply(this.$tokens,d);this.$endStates.splice.apply(this.$endStates,d)};this.$removeRows=function(a,c){this.$tokens.splice(a,c);this.$endStates.splice(a,c)};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,c,d){var b=
/\bparen\b/;return a<c?function(){for(;a<=c;a++)for(var e=this.$tokens[a],i=0;i<e.length;i++)if(b.test(e[i].type)&&!d(e[i].value,{row:a,column:e[i].column}))return!1;return!0}.call(this):function(){a=Math.max(0,a);for(c=Math.max(0,c);a>=c;a--)for(var e=this.$tokens[a],i=e.length-1;0<=i;i--)if(b.test(e[i].type)&&!d(e[i].value,{row:a,column:e[i].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,c,d,b){var e=[],i=null,f=this;this.$walkParens(a,c,function(a,c){if(d&&d(e,a,c))return i=
c,!1;if(/[\[({]/.test(a))if(e[e.length-1]===f.$complements[a])e.pop();else return!0;else e.push(a);return b&&b(e,a,c)?(i=c,!1):!0});return i};this.$findNextSignificantToken=function(a,c){if(0==this.$tokens.length)return null;for(var c=Math.min(c,this.$tokens.length-1),d=a.row,b=a.column;d<=c;d++){for(var e=this.$tokens[d],i=0;i<e.length;i++)if(e[i].column+e[i].value.length>b)return{token:e[i],row:d,column:Math.max(e[i].column,b),offset:i};b=0}return null};this.findNextSignificantToken=function(a){return this.$findNextSignificantToken(a,
this.$tokens.length-1)};this.$findPreviousSignificantToken=function(a,c){if(0===this.$tokens.length)return null;for(var c=Math.max(0,c),d=Math.min(a.row,this.$tokens.length-1);d>=c;d--){var b=this.$tokens[d];if(0!==b.length){if(d!=a.row)return{row:d,column:b[b.length-1].column,token:b[b.length-1],offset:b.length-1};for(var e=b.length-1;0<=e;e--)if(b[e].column<a.column)return{row:d,column:b[e].column,token:b[e],offset:e}}}};this.$filterWhitespaceAndComments=function(a){for(var a=a.filter(function(a){a=
/\bcode(?:begin|end)\b/.test(a.type)||/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a}),c=a.length-1;0<=c;c--)if(1<a[c].value.length&&/\bparen\b/.test(a[c].type)){var d=a[c];a.splice(c,1);for(var b=d.value.length-1;0<=b;b--){var e={type:d.type,value:d.value.charAt(b),column:d.column+b};a.splice(c,0,e)}}return a}}).call(i.prototype);l.RCodeModel=i;l.setVerticallyAlignFunctionArgs=function(a){c=a};l.getVerticallyAlignFunctionArgs=function(){return c}});var $colorFunctionCalls=!1;
define("mode/r_highlight_rules",["require","exports","module"],function(b,l){function j(){for(var a=Array(arguments.length),c=0;c<arguments.length;c++)a[c]={include:arguments[c]};return a}var k=b("ace/lib/oop"),f=b("ace/lib/lang"),h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=b("mode/tex_highlight_rules").TexHighlightRules,c=function(){var a=f.arrayToMap("function,if,else,in,break,next,repeat,for,while".split(",")),c=f.arrayToMap("return,switch,try,tryCatch,stop,warning,require,library,attach,detach,source,setMethod,setGeneric,setGroupGeneric,setClass,setRefClass,R6Class,UseMethod,NextMethod".split(",")),b=
f.arrayToMap("NULL,NA,TRUE,FALSE,T,F,Inf,NaN,NA_integer_,NA_real_,NA_character_,NA_complex_".split(",")),e={"#comment":[{token:"comment.sectionhead",regex:"#+(?!').*(?:----|====|####)\\s*$",next:"start"},{token:"comment",regex:"#+'",next:"rd-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 b.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(c){return b.hasOwnProperty(c)?"constant.language":a.hasOwnProperty(c)?"keyword":c.match(/^\.\.\d+$/)?"variable.language":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*",next:"start"}],"#package-access":[{token:function(){return $colorFunctionCalls?"identifier.support.class":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*(?=\\s*::)",next:"start"}],"#function-call":[{token:function(){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(){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},regex:"[;]",merge:!1,next:"start"},{token:function(){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},regex:"[,]",merge:!1,next:"start"}],"#text":[{token:"text",regex:"\\s+"}]};
e.start=j("#comment","#string","#number","#package-access","#quoted-identifier","#function-call-or-keyword","#keyword-or-identifier","#operator","#text");e.afterDollar=j("#comment","#string","#number","#quoted-identifier","#function-call","#keyword-or-identifier","#operator","#text");e.qqstring=[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+",merge:!0}];e.qstring=[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+",
merge:!0}];this.$rules=e;for(var e=(new g("comment")).getRules(),m=0;m<e.start.length;m++)e.start[m].token+=".virtual-comment";this.addRules(e,"rd-");this.$rules["rd-start"]=[{token:"comment",regex:"@@"},{token:["keyword","comment"],regex:"(@(?:export|inheritParams|name|param|rdname|slot|template|useDynLib))(\\s+)(?=[a-zA-Z0-9._-])",next:"rd-highlight"},{token:"keyword",regex:"@(?!@)[^ ]*"},{token:"comment",regex:"^",next:"start"}].concat(this.$rules["rd-start"]).concat([{token:"comment",regex:"[^%\\\\[({\\])}]+"}]);
this.$rules["rd-highlight"]=[{token:"identifier.support.function",regex:"[a-zA-Z0-9._-]+"},{token:"comment",regex:","},{token:"comment",regex:"\\s*",next:"rd-start"}];this.normalizeRules()};k.inherits(c,h);l.RHighlightRules=c;l.setHighlightRFunctionCalls=function(a){$colorFunctionCalls=a}});define("mode/r_matching_brace_outdent",["require","exports","module"],function(b,l){var j=b("ace/range").Range,k=function(b){this.codeModel=b};(function(){this.checkOutdent=function(b,h,g){return/^\s+$/.test(h)&&/^\s*[\{\}\)]/.test(g)||/^\s*}\s*$/.test(h)&&"\n"==g||/}\s*$/.test(h)&&/\n/.test(g)?!0:!1};this.autoOutdent=function(b,h,g){if(0===g)return 0;var b=h.getLine(g),c=b.match(/^(\s*[\}\)])/);if(c){var c=c[1].length,a=h.findMatchingBracket({row:g,column:c});if(!a||a.row==g)return 0;a=this.codeModel.getIndentForOpenBrace(a);
h.replace(new j(g,0,g,c-1),a)}if(c=b.match(/^(\s*\{)/))c=c[1].length,a=this.codeModel.getBraceIndent(g-1),h.replace(new j(g,0,g,c-1),a)}}).call(k.prototype);l.RMatchingBraceOutdent=k});define("mode/r_scope_tree",["require","exports","module"],function(b,l){function j(c){f&&console.log(c)}function k(c,a){return c.row!=a.row?c.row-a.row:c.column-a.column}var f=!1,h=function(c){this.$ScopeNodeFactory=c;this.parsePos={row:0,column:0};this.$root=new this.$ScopeNodeFactory("(Top Level)",this.parsePos,null,g.TYPE_ROOT)};(function(){function c(a){count=a.isChunk()?1:0;for(var a=a.$children||[],b=0;b<a.length;b++)count+=c(a[b]);return count}this.onSectionHead=function(a,c,b){"undefined"==
typeof b&&(b={});var f=this.getActiveScopes(c);if(1<f.length)for(var f=f[f.length-2].$children,h=f.length-1;0<=h;h--)if(f[h].isSection()){this.$root.closeScope(c,g.TYPE_SECTION);break}this.$root.addNode(new this.$ScopeNodeFactory(a,c,c,g.TYPE_SECTION,b))};this.onSectionEnd=function(a){this.$root.closeScope(a,g.TYPE_SECTION)};this.closeMarkdownHeaderScopes=function(a,c,b){for(var f=a.$children,h=f.length-1;0<=h;h--){var k=f[h];if(k.isSection()&&k.attributes.depth>=b)return j("Closing Markdown scope: '"+
k.label+"'"),this.$root.closeScope(c,g.TYPE_SECTION),k.attributes.depth===b||a.isRoot()||null==a?void 0:this.closeMarkdownHeaderScopes(a.parentScope,c,b)}a.isRoot()||null==a||this.closeMarkdownHeaderScopes(a.parentScope,c,b)};this.onMarkdownHead=function(a,c,b,f){j("Adding Markdown header: '"+a+"' ["+f+"]");var h=this.getActiveScopes(c);1<h.length&&this.closeMarkdownHeaderScopes(h[h.length-2],c,f);this.$root.addNode(new this.$ScopeNodeFactory(a,b,c,g.TYPE_SECTION,{depth:f,isMarkdown:!0}))};this.onChunkStart=
function(a,c,b,f){var h=this.$root.closeScope(b,g.TYPE_CHUNK);h&&j("chunk-scope implicit end: "+h.label);j("adding chunk-scope "+c);c=new this.$ScopeNodeFactory(c,f,b,g.TYPE_CHUNK);c.chunkLabel=a;this.$root.addNode(c);this.printScopeTree()};this.onChunkEnd=function(a){(a=this.$root.closeScope(a,g.TYPE_CHUNK))?j("chunk-scope end: "+a.label):j("extra chunk-scope end");this.printScopeTree();return a};this.onFunctionScopeStart=function(a,c,b,f,h){j("adding function brace-scope "+a);this.$root.addNode(new this.$ScopeNodeFactory(a,
b,c,g.TYPE_BRACE,{name:f,args:h}));this.printScopeTree()};this.onNamedScopeStart=function(a,c){this.$root.addNode(new this.$ScopeNodeFactory(a,c,null,g.TYPE_BRACE))};this.onScopeStart=function(a){j("adding anon brace-scope");this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,g.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){(a=this.$root.closeScope(a,g.TYPE_BRACE))?j("brace-scope end: "+a.label):j("extra brace-scope end");this.printScopeTree();return a};this.getActiveScopes=
function(a){return this.$root.findNode(a)};this.getScopeList=function(){return this.$root.$children};this.findFunctionDefinitionFromUsage=function(a,c){return this.$root.findFunctionDefinitionFromUsage(a,c)};this.getFunctionsInScope=function(a,c){return this.$root.getFunctionsInScope(a,c)};this.invalidateFrom=function(a){a={row:Math.max(0,a.row-1),column:0};j("Invalidate from "+a.row+", "+a.column);0<k(this.parsePos,a)&&(this.parsePos=this.$root.invalidateFrom(a));this.printScopeTree()};this.getChunkCount=
function(){return c(this.$root)};this.getTopLevelScopeCount=function(){return this.$root.$children.length};this.printScopeTree=function(){f&&this.$root.printDebug()};this.getAllFunctionScopes=function(){var c=[];a(this.$root,c);return c};var a=function(c,b){c.isFunction()&&b.push(c);for(var e=c.$children,f=0;f<e.length;f++)a(e[f],b)}}).call(h.prototype);var g=function(c,a,b,i,e){this.label=c;if((this.start=a)&&b&&(b.row>a.row||b.row===a.row&&b.column>a.column))throw Error("Malformed preamble: should lie before start position");
this.preamble=b||a;this.end=null;this.scopeType=i;this.parentScope=null;this.attributes=e||{};this.$children=[]};g.TYPE_ROOT=1;g.TYPE_BRACE=2;g.TYPE_CHUNK=3;g.TYPE_SECTION=4;(function(){this.isRoot=function(){return this.scopeType==g.TYPE_ROOT};this.isBrace=function(){return this.scopeType==g.TYPE_BRACE};this.isChunk=function(){return this.scopeType==g.TYPE_CHUNK};this.isSection=function(){return this.scopeType==g.TYPE_SECTION};this.isFunction=function(){return this.isBrace()&&!!this.label};this.equals=
function(c){return this.scopeType!==c.scopeType||this.start.row!==c.start.row||this.start.column!==c.start.column?!1:!0};this.addNode=function(c){!c.end||window.alert("[ASSERTION FAILED] New node is already closed");0==c.$children.length||window.alert("[ASSERTION FAILED] New node already had children");if(!this.equals(c)){this.end=null;var a=this.$binarySearch(c.preamble);0<=a?this.$children[a].addNode(c):(a=-(a+1),a<this.$children.length&&(c.$children=this.$children.splice(a,this.$children.length-
a)),c.parentScope=this,this.$children.push(c))}};this.closeScope=function(c,a){if(0==this.$children.length)return null;var b=this.$children[this.$children.length-1];if(b.end)return null;var i=b.closeScope(c,a);if(i)return i;return a==b.scopeType?(b.end=c,b.$forceDescendantsClosed(c),b):null};this.$forceDescendantsClosed=function(c){if(0!=this.$children.length){var a=this.$children[this.$children.length-1];a.end||(a.$forceDescendantsClosed(c),a.end=c)}};this.findNode=function(c){var a=this.$binarySearch(c);
return 0<=a&&(c=this.$children[a].findNode(c))?(this.label&&c.unshift(this),c):this.label?[this]:null};this.$getFunctionStack=function(c){var a=this.$binarySearch(c),c=0<=a?this.$children[a].$getFunctionStack(c):[];this.isFunction()&&c.push(this);return c};this.findFunctionDefinitionFromUsage=function(c,a){for(var b=this.$getFunctionStack(c),i=0;i<b.length;i++)for(var e=b[i],f=0;f<e.$children.length;f++)if(e.$children[f].label==a)return e.$children[f];return null};this.getFunctionsInScope=function(c){for(var c=
this.$getFunctionStack(c),a=[],b=0;b<c.length;b++)a.push({name:c[b].attributes.name,args:c[b].attributes.args.slice()});return a};this.invalidateFrom=function(c){var a=this.$binarySearch(c);0<=a?0>=k(c,this.$children[a].start)?c=this.$children[a].preamble:(c=this.$children[a].invalidateFrom(c),a++):a=-(a+1);a<this.$children.length&&this.$children.splice(a,this.$children.length-a);this.end=null;return c};this.$binarySearch=function(c,a,b){"undefined"===typeof a&&(a=0);"undefined"===typeof b&&(b=this.$children.length);
if(a===b)return-(a+1);var i=Math.floor((a+b)/2),e=this.$children[i].comparePosition(c);return 0===e?i:0>e?this.$binarySearch(c,a,i):this.$binarySearch(c,i+1,b)};this.comparePosition=function(c){return 0>k(c,this.preamble)?-1:null!=this.end&&0<=k(c,this.end)?1:0};this.printDebug=function(c){"undefined"===typeof c&&(c="");j(c+'"'+this.label+'" ['+this.preamble.row+"x"+this.preamble.column+(this.start?"-"+this.start.row+"x"+this.start.column:"")+", "+(this.end?this.end.row+"x"+this.end.column:"null")+
"]");for(var a=0;a<this.$children.length;a++)this.$children[a].printDebug(c+"    ")}}).call(g.prototype);l.ScopeManager=h;l.ScopeNode=g});define("mode/rdoc",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=b("mode/rdoc_highlight_rules").RDocHighlightRules,c=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,a=function(a){a?(this.$highlightRules=new h,this.$tokenizer=new f((new h).getRules())):(this.$highlightRules=new g,this.$tokenizer=new f((new g).getRules()));this.$outdent=new c};j.inherits(a,
k);(function(){this.getNextLineIndent=function(a,c){return this.$getIndent(c)}}).call(a.prototype);l.Mode=a});define("mode/rdoc_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop");b("ace/lib/lang");var k=b("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){var b;b="\\"+"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:b},
"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+"}]}};j.inherits(f,k);l.RDocHighlightRules=f});define("mode/rhtml",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/html").Mode,f=b("ace/tokenizer").Tokenizer,h=b("mode/rhtml_highlight_rules").RHtmlHighlightRules,g=b("mode/background_highlighter").BackgroundHighlighter,c=b("mode/r_code_model").RCodeModel,a=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,d=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,i=b("mode/utils"),e=function(b,e){this.$session=e;this.$tokenizer=new f((new h).getRules());
this.codeModel=new c(e,this.$tokenizer,/^r-/,/^<\!--\s*begin.rcode\s*(.*)/,/^\s*end.rcode\s*--\>/);this.$outdent=new a;this.$r_outdent=new d(this.codeModel);this.foldingRules=this.codeModel;this.$sweaveBackgroundHighlighter=new g(e,[{begin:/^<\!--\s*begin.rcode\s*(?:.*)/,end:/^\s*end.rcode\s*--\>/}])};j.inherits(e,k);(function(){this.insertChunkInfo={value:"<\!--begin.rcode\n\nend.rcode--\>\n",position:{row:0,column:15},content_position:{row:1,column:0}};this.checkOutdent=function(a,c,b){return"r"===
i.activeMode(a,"html")?this.$r_outdent.checkOutdent(a,c,b):this.$outdent.checkOutdent(c,b)};this.autoOutdent=function(a,c,b){return"r"===i.activeMode(a,"html")?this.$r_outdent.autoOutdent(a,c,b):this.$outdent.autoOutdent(c,b)};this.getLanguageMode=function(a){return i.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"HTML"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,c,b,d){return"r"===i.activeMode(a,"html")?this.codeModel.getNextLineIndent(a,c,b,d):this.$getNextLineIndent(a,
c,b)};this.$id="mode/rhtml"}).call(e.prototype);l.Mode=e});define("mode/rhtml_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("mode/r_highlight_rules").RHighlightRules,f=b("ace/mode/html_highlight_rules").HtmlHighlightRules,h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){this.$rules=(new f).getRules();this.$rules.start.unshift({token:"support.function.codebegin",regex:"^<\!--\\s*begin.rcode\\s*(?:.*)",next:"r-start"});this.addRules((new k).getRules(),"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",
regex:"^\\s*end.rcode\\s*--\>",next:"start"})};j.inherits(g,h);l.RHtmlHighlightRules=g});define("mode/rmarkdown",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("mode/markdown").Mode,f=b("ace/tokenizer").Tokenizer,h=b("mode/rmarkdown_highlight_rules").RMarkdownHighlightRules,g=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,c=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,a=b("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,d=b("mode/background_highlighter").BackgroundHighlighter,i=b("mode/r_code_model").RCodeModel,e=b("mode/cpp_code_model").CppCodeModel,
m=b("rstudio/folding/rmarkdown").FoldMode,o=b("ace/mode/folding/cstyle").FoldMode,p=b("mode/utils"),n=b("ace/unicode"),x=function(b,k){var j=this;this.$session=k;this.$tokenizer=new f((new h).getRules());this.$outdent=new g;this.codeModel=new i(k,this.$tokenizer,/^r-/,RegExp(h.prototype.$reRChunkStartString),RegExp(h.prototype.$reChunkEndString));this.$r_outdent=new c(this.codeModel);this.cpp_codeModel=new e(k,this.$tokenizer,/^r-cpp-/,RegExp(h.prototype.$reCppChunkStartString),RegExp(h.prototype.$reChunkEndString));
this.$cpp_outdent=new a(this.cpp_codeModel);var n=new m,l=new o;this.foldingRules={getFoldWidget:function(a,c,b){var d=j.getLanguageMode({row:b,column:0}),e=a.getLine(b);return"Markdown"===d||p.startsWith(e,"```")||0===b?n.getFoldWidget(a,c,b):"C_CPP"===d?l.getFoldWidget(a,c,b):j.codeModel.getFoldWidget(a,c,b)},getFoldWidgetRange:function(a,c,b){var d=j.getLanguageMode({row:b,column:0}),e=a.getLine(b);return"Markdown"===d||p.startsWith(e,"```")||0===b?n.getFoldWidgetRange(a,c,b):"C_CPP"===d?l.getFoldWidgetRange(a,
c,b):j.codeModel.getFoldWidgetRange(a,c,b)}};this.$sweaveBackgroundHighlighter=new d(k,[{begin:/^(?:[ ]{4})?`{3,}\s*\{(?:.*)\}\s*$/,end:/^(?:[ ]{4})?`{3,}\s*$/},{begin:/^\$\$\s*$/,end:/^\$\$\s*$/}])};j.inherits(x,k);(function(){function a(c){return p.activeMode(c,"markdown")}this.insertChunkInfo={value:"```{r}\n\n```\n",position:{row:0,column:5},content_position:{row:1,column:0}};this.getLanguageMode=function(c){c=p.getPrimaryState(this.$session,c.row);c=a(c);return"r"===c?"R":"r-cpp"===c?"C_CPP":
"yaml"===c?"YAML":"Markdown"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(c,b,d,e,i){var f=a(c);return"r"===f?this.codeModel.getNextLineIndent(c,b,d,e):"r-cpp"===f?this.cpp_codeModel.getNextLineIndent(c,b,d,e,i):this.$getNextLineIndent(c,b,d)};this.checkOutdent=function(c,b,d){var e=a(c);return"r"===e?this.$r_outdent.checkOutdent(c,b,d):"r-cpp"===e?this.$cpp_outdent.checkOutdent(c,b,d):this.$outdent.checkOutdent(b,d)};this.autoOutdent=function(c,b,d){var e=a(c);
return"r"===e?this.$r_outdent.autoOutdent(c,b,d):"r-cpp"===e?this.$cpp_outdent.autoOutdent(c,b,d):this.$outdent.autoOutdent(b,d)};this.transformAction=function(c,b,d,e,i){c=a(c);if("insertion"===b)if("\n"===i&&"r-cpp"===c){if(b=d.getSelectionRange().start,(e=/^((\s*\/\/+')\s*)/.exec(e.doc.getLine(b.row)))&&d.getSelectionRange().start.column>=e[2].length)return{text:"\n"+e[1]}}else if("R"===i&&"r-cpp"===c&&(b=d.getSelectionRange().start,(e=/^(\s*\/\*{3,}\s*)/.exec(e.doc.getLine(b.row)))&&d.getSelectionRange().start.column>=
e[1].length))return{text:"R\n\n*/\n",selection:[1,0,1,0]};return!1};this.tokenRe=RegExp("^["+n.packages.L+n.packages.Mn+n.packages.Mc+n.packages.Nd+n.packages.Pc+"._]+","g");this.nonTokenRe=RegExp("^(?:[^"+n.packages.L+n.packages.Mn+n.packages.Mc+n.packages.Nd+n.packages.Pc+"._]|\\s])+","g");this.$id="mode/rmarkdown"}).call(x.prototype);l.Mode=x});define("rstudio/folding/rmarkdown",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/folding/fold_mode").FoldMode,f=b("ace/range").Range,h=l.FoldMode=function(){},g=b("mode/utils");j.inherits(h,k);(function(){this.getFoldWidget=function(a,c,b){var c="markbeginend"===c?"end":"",e=a.getLine(b),f=a.getState(b),a=0<b?a.getState(b-1):"start";if(g.startsWith(e,"===")||g.startsWith(e,"---")||g.startsWith(e,"..."))return g.startsWith(a,"yaml")?c:"start";if("$start"===f&&g.startsWith(e,
"#"))return"start";a=e.trim();return g.startsWith(a,"```")?"$start"===f?c:"start":""};var c=function(a,c,b,e,h){var c=0===b?1:"start"===c||"$start"===c?-1:1,k={row:b,column:0};1===c&&(k.column=a.getLine(b).length);for(var b=b+c,j=0<c?a.getLength():0;!(b===j);){var n=a.getLine(b).trim();if(g.startsWith(n,e))break;if(h&&g.startsWith(n,h))break;b+=c}e={row:b,column:0};-1===c&&(e.column=a.getLine(b).length);return 1===c?f.fromPoints(k,e):f.fromPoints(e,k)};this.$getFoldWidgetRange=function(a,b,i){var e=
a.getState(i),b=a.getLine(i),h=b.trim();if(g.startsWith(b,"```"))return c(a,e,i,"```");var k=0<i?a.getState(i-1):"start",h=0===i&&"---"===h,k=g.startsWith(k,"yaml");if(h||k)return c(a,e,i,"---",h?"...":void 0);if("="===b[0])k=1;else if("-"===b[0])k=2;else{k=/^(#+)(?:.*)$/.exec(b);if(!k)return;k=k[1].length}if(null!==k){a:{for(var h=a.getLength(),j=i+1;j<h;j++)if(a.getState(j)===e){var n=a.getLine(j);if(1===k&&/^[=]{3,}\s*/.test(n)||2===k&&/^[-]{3,}\s*/.test(n)){e=j-2;break a}if((n=/^(#+)(?:.*)$/.exec(n))&&
n[1].length<=k){e=j-1;break a}}e=h}return new f(i,b.length,e,a.getLine(e).length)}};this.getFoldWidgetRange=function(a,c,b){a=this.$getFoldWidgetRange(a,c,b);if(!(null==a||a.start.row===a.end.row))return a}}).call(h.prototype)});define("mode/rmarkdown_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("mode/r_highlight_rules").RHighlightRules,f=b("mode/c_cpp_highlight_rules").c_cppHighlightRules,h=b("ace/mode/perl_highlight_rules").PerlHighlightRules,g=b("ace/mode/python_highlight_rules").PythonHighlightRules,c=b("ace/mode/ruby_highlight_rules").RubyHighlightRules,a=b("mode/markdown_highlight_rules").MarkdownHighlightRules,d=b("ace/mode/text_highlight_rules").TextHighlightRules,i=b("ace/mode/yaml_highlight_rules").YamlHighlightRules,
e=b("ace/mode/sh_highlight_rules").ShHighlightRules,m=b("mode/stan_highlight_rules").StanHighlightRules,o=b("mode/sql_highlight_rules").SqlHighlightRules,p=b("mode/utils"),n=function(){this.$rules=(new a).getRules();p.embedRules(this,k,"r",this.$reRChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,f,"r-cpp",this.$reCppChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,h,"perl",this.$rePerlChunkStartString,this.$reChunkEndString,
["start","listblock","allowBlock"]);p.embedRules(this,g,"python",this.$rePythonChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,c,"ruby",this.$reRubyChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,a,"markdown",this.$reMarkdownChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,e,"sh",this.$reShChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);
p.embedRules(this,m,"stan",this.$reStanChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,o,"sql",this.$reSqlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);this.$rules.$start=this.$rules.start.slice();for(var b in this.$rules)for(var d=this.$rules[b],j=0;j<d.length;j++)"start"===d[j].next&&(d[j].next="$start");b=this.$rules.start;for(j=0;j<b.length;j++)null==b[j].next&&(b[j].next="$start");p.embedRules(this,i,"yaml","---","(?:---|\\.\\.\\.)");
this.$rules["yaml-start"].unshift({token:["string"],regex:RegExp("((?:January|February|March|April|May|June|July|August|September|October|November|December)\\s+\\d+(?:st|nd|rd|s|n|r)?(?:\\s*(?:,)?(?:\\s*\\d+)?)?)")})};j.inherits(n,d);(function(){function a(c){return"^(?:[ ]{4})?`{3,}\\s*\\{[Rr]\\b(?:.*)engine\\s*\\=\\s*['\"]"+c+"['\"](?:.*)\\}\\s*$|^(?:[ ]{4})?`{3,}\\s*\\{"+c+"\\b(?:.*)\\}\\s*$"}this.$reRChunkStartString="^(?:[ ]{4})?`{3,}\\s*\\{[Rr]\\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")}).call(n.prototype);l.RMarkdownHighlightRules=n});define("mode/sql",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("mode/sql_highlight_rules").SqlHighlightRules;b("ace/range");var h=function(){this.HighlightRules=f};j.inherits(h,k);(function(){this.lineCommentStart="--";this.$id="mode/sql"}).call(h.prototype);l.Mode=h});define("mode/sql_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop");b("ace/lib/lang");var k=b("ace/mode/text_highlight_rules").TextHighlightRules,f=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()};j.inherits(f,k);l.SqlHighlightRules=f});define("mode/stan",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=b("mode/stan_highlight_rules").StanHighlightRules,c=b("ace/mode/folding/cstyle").FoldMode,a=function(){this.$highlightRules=new g;this.$tokenizer=new f(this.$highlightRules.getRules());this.$outdent=new h;this.foldingRules=new c};j.inherits(a,k);(function(){this.lineCommentStart=["//","#"];this.blockComment=
{start:"/*",end:"*/"};this.toggleCommentLines=function(a,c,b,f){for(var g=!0,a=/^(\s*)\/\//,h=b;h<=f;h++)if(!a.test(c.getLine(h))){g=!1;break}if(g){g=new Range(0,0,0,0);for(h=b;h<=f;h++)b=c.getLine(h).match(a),g.start.row=h,g.end.row=h,g.end.column=b[0].length,c.replace(g,b[1])}else c.indentRows(b,f,"//")};this.getLanguageMode=function(){return"Stan"};this.getNextLineIndent=function(a,c,b){var f=this.$getIndent(c),g=this.getTokenizer().getLineTokens(c,a).tokens;if(g.length&&"comment"==g[g.length-
1].type)return f;"start"==a&&c.match(/^.*(?:[\{\(\[])\s*$/)&&(f+=b);return f};this.checkOutdent=function(a,c,b){return this.$outdent.checkOutdent(c,b)};this.autoOutdent=function(a,c,b){this.$outdent.autoOutdent(c,b)};this.$id="mode/stan"}).call(a.prototype);l.Mode=a});define("mode/stan_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop");b("ace/lib/lang");var k=b("ace/mode/text_highlight_rules").TextHighlightRules,f=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:".+"}]}};j.inherits(f,k);l.StanHighlightRules=f});define("mode/sweave",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=b("mode/background_highlighter").BackgroundHighlighter,c=b("mode/sweave_highlight_rules").SweaveHighlightRules,a=b("mode/r_code_model").RCodeModel,d=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,e=b("ace/unicode"),m=b("mode/utils");
b("mode/auto_brace_insert");var o=function(b,e){this.$tokenizer=b?new f((new h).getRules()):new f((new c).getRules());this.$session=e;this.$outdent=new d;this.codeModel=new a(e,this.$tokenizer,/^r-/,/<<(.*?)>>/,/^\s*@\s*$/);this.$r_outdent=new i(this.codeModel);this.foldingRules=this.codeModel;this.$sweaveBackgroundHighlighter=new g(e,[{begin:/^\s*<<.*>>=.*$/,end:/^\s*@(?:\s.*)?$/}])};j.inherits(o,k);(function(){this.tokenRe=RegExp("^["+e.packages.L+e.packages.Mn+e.packages.Mc+e.packages.Nd+e.packages.Pc+
"._]+","g");this.nonTokenRe=RegExp("^(?:[^"+e.packages.L+e.packages.Mn+e.packages.Mc+e.packages.Nd+e.packages.Pc+"._]|\\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 m.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"TeX"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=
function(a,c,b,d){return"r"===m.activeMode(a,"tex")?this.codeModel.getNextLineIndent(a,c,b,d):this.$getNextLineIndent(a,c,b)};this.checkOutdent=function(a,c,b){return"r"===m.activeMode(a,"tex")?this.$r_outdent.checkOutdent(a,c,b):this.$outdent.checkOutdent(c,b)};this.autoOutdent=function(a,c,b){return"r"===m.activeMode(a,"tex")?this.$r_outdent.autoOutdent(a,c,b):this.$outdent.autoOutdent(c,b)};this.allowAutoInsert=this.smartAllowAutoInsert;this.$id="mode/sweave"}).call(o.prototype);l.Mode=o});define("mode/sweave_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("mode/tex_highlight_rules").TexHighlightRules,f=b("mode/r_highlight_rules").RHighlightRules,h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){this.$rules=(new k).getRules();this.$rules.start.unshift({token:"comment.codebegin",regex:"^\\s*\\<\\<.*\\>\\>=.*$",next:"r-start"});this.$rules.start.unshift({token:"comment",regex:"^\\s*@(?:\\s.*)?$"});this.addRules((new f).getRules(),
"r-");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"})};j.inherits(g,h);l.SweaveHighlightRules=g});define("mode/tex",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("ace/mode/text_highlight_rules").TextHighlightRules,g=b("mode/tex_highlight_rules").TexHighlightRules,c=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,a=function(a){this.$tokenizer=a?new f((new h).getRules()):new f((new g).getRules());this.$outdent=new c};j.inherits(a,k);(function(){this.getNextLineIndent=function(a,c){return this.$getIndent(c)};
this.allowAutoInsert=function(){return!1}}).call(a.prototype);l.Mode=a});define("mode/tex_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop");b("ace/lib/lang");var k=b("ace/mode/text_highlight_rules").TextHighlightRules,f=function(b){b||(b="text");this.$rules={start:[{token:"comment",regex:"%.*$"},{token:b,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:b,regex:"\\s+"}],nospell:[{token:"comment",regex:"%.*$",next:"start"},{token:"nospell."+b,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."+b,regex:"\\s+"},{token:"nospell."+b,regex:"\\w+"}]}};j.inherits(f,k);l.TexHighlightRules=f});define("mode/token_cursor",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("mode/utils"),f=function(c,a,b){this.$tokens=c;this.$row=a||0;this.$offset=b||0};(function(){this.cloneCursor=function(){return new f(this.$tokens,this.$row,this.$offset)};var c=k.isArray,a=k.contains,b={"(":")","{":"}","<":">","[":"]",")":"(","}":"{",">":"<","]":"["},i=["(","[","{"],e=[")","]","}"];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,c=0;0<=a;){var b=this.$tokens[a];if(b&&0!==b.length){c=b.length;break}a--}if(0>a)return!1;this.$row=a;this.$offset=c-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 c=this.$tokens[this.$row];if(c&&this.$offset<c.length-1)return this.$offset++,!0;for(var b=this.$row+1;b<=a&&!((c=this.$tokens[b])&&0!==c.length);)b++;if(b>a)return!1;this.$row=b;this.$offset=0;return!0};this.peekBwd=function(a){"undefined"===typeof a&&(a=1);for(var c=this.cloneCursor(),b=0;b<a;b++)if(!c.moveToPreviousToken())return c.$invalidate();return c};this.peekFwd=function(a){"undefined"===typeof a&&
(a=1);for(var c=this.cloneCursor(),b=0;b<a;b++)if(!c.moveToNextToken())return c.$invalidate();return c};this.$invalidate=function(){this.$column=this.$row=0;this.$tokens=[];return this};this.seekToNearestToken=function(a,c){if(a.row>c)return!1;this.$row=a.row;var b=this.$tokens[this.$row]||[];for(this.$offset=0;this.$offset<b.length;this.$offset++)if(b[this.$offset].column>=a.column)return!0;return a.row<c?this.moveToNextToken(c):!1};this.bwdToNearestToken=function(a){this.$row=a.row;this.$offset=
a.column;for(var c=this.$tokens[this.$row]||[];0<=this.$offset;this.$offset--){var b=c[this.$offset];if("undefined"!==typeof b&&b.column<=a.column)return!0}return this.moveToPreviousToken()};this.bwdToMatchingToken=function(){var c=this.currentValue();if(!a(e,c))return!1;for(var i=b[c],f=0;this.moveToPreviousToken();){var g=this.currentValue();if(g===i){if(0===f)return!0;f--}else g===c&&f++}return!1};this.fwdToMatchingToken=function(){var c=this.currentValue();if(!a(i,c))return!1;for(var e=b[c],f=
0;this.moveToNextToken();){var g=this.currentValue();if(g===e){if(0===f)return!0;f--}else g===c&&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,c=0;this.moveToPreviousToken();){var b=this.currentValue();if("("===b){if(0===c){a=!0;break}c--}else")"===b&&c++}return a};this.findToken=function(a,c){do{var b=
this.currentToken();if(b&&a(b))return b}while(this.moveToNextToken(c));return null};this.findTokenBwd=function(a,c){do{var b=this.currentToken();if(b&&a(b))return b}while(this.moveToPreviousToken(c));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 c=0;c<arguments.length;c++){var b=arguments[c];if(a===b||-1!==a.indexOf(b+".")||-1!==a.indexOf("."+b))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,c){var b=a.row,d=a.column,e=this.$tokens[b];null==e&&this.$codeModel&&this.$codeModel.$tokenizeUpToRow&&(this.$codeModel.$tokenizeUpToRow.call(this.$codeModel,b),e=this.$tokens[b]);if(e&&0<e.length&&e[0].column<=d){for(var i=0;i<e.length&&!(e[i].column>=d);i++);this.$row=b;this.$offset=i===e.length?i-1:c&&e[i].column===d?i:i-1;return!0}d=this.cloneCursor();d.$row=b;d.$offset=0;return d.moveToPreviousToken()?
(this.$row=d.$row,this.$offset=d.$offset,!0):!1};this.findOpeningBracket=function(a,b){c(a)||(a=[a]);var d=this.cloneCursor();do if(!d.bwdToMatchingToken()){var e=d.currentValue();if(b&&"{"===e)break;for(var i=0;i<a.length;i++)if(e===a[i])return this.$row=d.$row,this.$offset=d.$offset,!0}while(d.moveToPreviousToken());return!1};this.findOpeningBracketCountCommas=function(a,b){c(a)||(a=[a]);var d=this.cloneCursor(),e=0;do if(!d.bwdToMatchingToken()){var i=d.currentValue();","===i&&(e+=1);if(b&&"{"===
i)break;for(var f=0;f<a.length;f++)if(i===a[f])return this.$row=d.$row,this.$offset=d.$offset,e}while(d.moveToPreviousToken());return-1}}).call(f.prototype);var h=function(c,a,b,i){this.$tokens=c;this.$row=a||0;this.$offset=b||0;this.$codeModel=i};j.mixin(h.prototype,f.prototype);(function(){this.cloneCursor=function(){return new h(this.$tokens,this.$row,this.$offset,this.$codeModel)};var c=k.contains;this.bwdOverConstNoexceptDecltype=function(){var a=this.cloneCursor();if("{"!==a.currentValue()||
!a.moveToPreviousToken())return!1;var c=a.cloneCursor();")"===c.currentValue()&&c.bwdToMatchingToken()&&c.moveToPreviousToken()&&"decltype"===c.currentValue()&&c.moveToPreviousToken()&&(a.$row=c.$row,a.$offset=c.$offset);c=a.cloneCursor();")"===c.currentValue()&&c.bwdToMatchingToken()&&c.moveToPreviousToken()&&"noexcept"===c.currentValue()&&(a.$row=c.$row,a.$offset=c.$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,c=this.cloneCursor();c.moveToPreviousToken();)if("<"===c.currentValue()){if(0===a)return this.$row=c.$row,this.$offset=c.$offset,!0;a--}else">"===c.currentValue()&&a++;return!1};this.bwdOverClassySpecifiers=function(){var a=this.currentValue();(":"===a||","===a||"{"===a)&&this.moveToPreviousToken();do{this.bwdToMatchingArrow()&&this.moveToPreviousToken();
var a=this.currentType(),c=this.currentValue();if(!("keyword"===a||"::"===c||"identifier"===a||"constant"===a))break;if("class"===c||"struct"===c||"enum"===c||":"===c||","===c)return!0}while(this.moveToPreviousToken());return!1};this.bwdOverClassInheritance=function(){var c=this.cloneCursor();return a(c,this)};var a=function(c,b){c.bwdOverClassySpecifiers();var e=c.currentValue();if(","===e)return a(c,b);return":"===e?(b.$row=c.$row,b.$offset=c.$offset,!0):!1};this.bwdOverInitializationList=function(){return this.doBwdOverInitializationList(this.cloneCursor(),
this)};this.doBwdOverInitializationList=function(a,b){a.moveBackwardOverMatchingParens();if(!a.moveBackwardOverMatchingParens()&&!a.moveToPreviousToken())return!1;for(;"keyword"===a.currentType();)if(!a.moveToPreviousToken())return!1;if(a.moveToPreviousToken()){var e=a.currentValue();if(","===e)return this.doBwdOverInitializationList(a,b);if(":"===e&&(e=a.peekBwd().currentValue(),!c(["public","private","protected"],e)))return b.$row=a.$row,b.$offset=a.$offset,!0}return!1}}).call(h.prototype);var g=
function(c,a,b,f){this.$tokens=c;this.$row=a||0;this.$offset=b||0;this.$codeModel=f};j.mixin(g.prototype,f.prototype);(function(){function c(a){return 0===a.indexOf("'")?a.lastIndexOf("'")===a.length-1:0===a.indexOf('"')?a.lastIndexOf('"')===a.length-1:!1}function a(a){return"("===a||"["===a||"{"===a}function b(a){return")"===a||"]"===a||"}"===a}this.cloneCursor=function(){return new g(this.$tokens,this.$row,this.$offset,this.$codeModel)};var f=k.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 c(this.currentValue())};this.isLeftBracket=function(){return a(this.currentValue())};this.isRightBracket=function(){return b(this.currentValue())};this.isValidForEndOfStatement=function(){if("paren.keyword.operator"===this.currentType())return b(this.currentValue());var a=this.currentValue();return c(a)||this.hasType("identifier","constant","variable")};this.isValidForStartOfStatement=
function(){if("paren.keyword.operator"===this.currentType())return a(this.currentValue());var b=this.currentValue();return c(b)||this.hasType("identifier","constant","variable")};this.isConditionalControlFlowKeyword=function(){var a=this.currentValue();return f(["if","for","while","function"],a)};this.isControlFlowKeyword=function(){var a=this.currentValue();return f("if,for,while,else,function,repeat,break,next".split(","),a)};this.isAtStartOfNewExpression=function(a){var c=this.cloneCursor();return!c.moveToPreviousToken()?
a:this.isValidForStartOfStatement()&&c.isValidForEndOfStatement()&&this.$row>c.$row?c.isControlFlowKeyword()||")"===c.currentValue()&&c.bwdToMatchingToken()&&c.moveToPreviousToken()&&c.isConditionalControlFlowKeyword()?!1:!0:!1}}).call(g.prototype);l.TokenCursor=f;l.CppTokenCursor=h;l.RTokenCursor=g});define("mode/token_utils",["require","exports","module"],function(b,l){var j=function(b,f,h,g,c,a){this.$doc=b;this.$tokenizer=f;this.$tokens=h;this.$endStates=Array(b.getLength());this.$statePattern=g;this.$codeBeginPattern=c;this.$codeEndPattern=a};(function(){this.getTokenForPos=function(b,f,h){this.$tokenizeUpToRow(b.row);if(this.$tokens.length<=b.row)return null;for(var g=this.$tokens[b.row],c=0;c<g.length;c++){var a=g[c];if(f&&b.column==a.column)return a;if(b.column<=a.column)break;if(h&&b.column==
a.column+a.value.length||b.column<a.column+a.value.length)return a}return null};this.$tokenizeUpToRow=function(b){for(var b=Math.min(b,this.$doc.getLength()-1),f=0,h=!0;f<=b;f++)if(!h||!this.$endStates[f]){var h=!1,g=0===f?"start":this.$endStates[f-1],c=this.$tokenizer.getLineTokens(this.$doc.getLine(f),g);this.$tokens[f]=!this.$statePattern||this.$statePattern.test(c.state)||this.$statePattern.test(g)?this.$filterWhitespaceAndComments(c.tokens):[];c.state===this.$endStates[f]?h=!0:this.$endStates[f]=
c.state}h||f<this.$tokens.length&&this.$invalidateRow(f);return!0};this.$filterWhitespaceAndComments=function(b){for(var b=b.filter(function(a){a=/\bcode(?:begin|end)\b/.test(a.type)||/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a}),f=b.length-1;0<=f;f--)if(1<b[f].value.length&&/\bparen\b/.test(b[f].type)){var h=b[f];b.splice(f,1);for(var g=h.value.length-1;0<=g;g--){var c={type:h.type,value:h.value.charAt(g),column:h.column+g};b.splice(f,
0,c)}}return b};this.$invalidateRow=function(b){this.$tokens[b]=null;this.$endStates[b]=null};this.$insertNewRows=function(b,f){for(var h=[b,0],g=0;g<f;g++)h.push(null);this.$tokens.splice.apply(this.$tokens,h);this.$endStates.splice.apply(this.$endStates,h)};this.$removeRows=function(b,f){this.$tokens.splice(b,f);this.$endStates.splice(b,f)};this.$walkParens=function(b,f,h){var g=/\bparen\b/;return b<f?function(){for(;b<=f;b++)for(var c=this.$tokens[b],a=0;a<c.length;a++)if(g.test(c[a].type)&&!h(c[a].value,
{row:b,column:c[a].column}))return!1;return!0}.call(this):function(){b=Math.max(0,b);for(f=Math.max(0,f);b>=f;b--)for(var c=this.$tokens[b],a=c.length-1;0<=a;a--)if(g.test(c[a].type)&&!h(c[a].value,{row:b,column:c[a].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(b,f,h,g,c){var a=[],d=null;this.$walkParens(b,f,function(b,e){if(h&&h(a,b,e))return d=e,!1;if(/[\[({]/.test(b))if(a[a.length-1]===c[b])a.pop();else return!0;else a.push(b);return g&&g(a,b,e)?(d=e,!1):!0});return d};
this.$findNextSignificantToken=function(b,f){if(0==this.$tokens.length)return null;for(var f=Math.min(f,this.$tokens.length-1),h=b.row,g=b.column;h<=f;h++){for(var c=this.$tokens[h],a=0;a<c.length;a++)if(c[a].column+c[a].value.length>g)return{token:c[a],row:h,column:Math.max(c[a].column,g),offset:a};g=0}return null};this.findNextSignificantToken=function(b){return this.$findNextSignificantToken(b,this.$tokens.length-1)};this.$findPreviousSignificantToken=function(b,f){if(0==this.$tokens.length)return null;
for(var f=Math.max(0,f),h=Math.min(b.row,this.$tokens.length-1);h>=f;h--){var g=this.$tokens[h];if(0!=g.length){if(h!=b.row)return{row:h,column:g[g.length-1].column,token:g[g.length-1],offset:g.length-1};for(var c=g.length-1;0<=c;c--)if(g[c].column<b.column)return{row:h,column:g[c].column,token:g[c],offset:c}}}return null}}).call(j.prototype);l.TokenUtils=j});define("mode/utils",["require","exports","module"],function(b,l){b("ace/range");var j=b("ace/token_iterator").TokenIterator,k=b("ace/unicode").packages;(function(){var b=this,h=RegExp("^["+k.L+k.Mn+k.Mc+k.Nd+k.Pc+"._]+","");this.construct=function(c,a){function b(){return c.apply(this,a)}b.prototype=c.prototype;return new b};this.contains=function(b,a){for(var d=0;d<b.length;d++)if(b[d]===a)return!0;return!1};this.isArray=function(b){return"[object Array]"===Object.prototype.toString.call(b)};this.asArray=
function(c){return b.isArray(c)?c:[c]};this.getPrimaryState=function(c,a){return b.primaryState(c.getState(a))};this.primaryState=function(c){return b.isArray(c)?c[0]:c};this.activeMode=function(c,a){var d=b.primaryState(c),i=d.lastIndexOf("-");return-1===i?a:d.substring(0,i).toLowerCase()};this.endsWith=function(b,a){return-1!==b.indexOf(a,b.length-a.length)};this.escapeRegExp=function(b){return b.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};this.embedRules=function(c,a,d,i,e,g){"undefined"===
typeof g&&(g=["start"]);for(var g=b.asArray(g),h=c.$rules,j=0;j<g.length;j++)h[g[j]].unshift({token:"support.function.codebegin",regex:i,next:d+"-start"});c.embedRules(a,d+"-",[{token:"support.function.codeend",regex:e,next:"start"}])};this.isSingleLineString=function(b){if(2>b.length)return!1;var a=b[0];return"'"!==a&&'"'!==a||b[b.length-1]!==a?!1:"\\"===b[b.length-2]&&"\\"!==b[b.length-3]?!1:!0};this.createTokenIterator=function(b){var a=b.getSelectionRange().start,b=b.getSession();return new j(b,
a.row,a.column)};this.isWordCharacter=function(b){return h.test(b)};var g={"'":"'",'"':'"',"`":"`","{":"}","(":")","[":"]","<":">","}":"{",")":"(","]":"[",">":"<"};this.isBracket=function(b,a){return a&&("<"===b||">"===b)?!0:"{"===b||"}"===b||"("===b||")"===b||"["===b||"]"===b};this.isOpeningBracket=function(b,a){return"{"===b||"("===b||"["===b||!!a&&"<"===b};this.isClosingBracket=function(b,a){return"}"===b||")"===b||"]"===b||!!a&&">"===b};this.getComplement=function(b,a){"undefined"===typeof a&&
(a=g);var d=a[b];return"undefined"===typeof d?b:d};this.stripEnclosingQuotes=function(b){var a=b.length;if(2>a)return b;var d=b[0];return!("'"===d||'"'===d||"`"===d)?b:b[a-1]!==d?b:b.substr(1,a-2)};this.startsWith=function(b,a){if("string"!==typeof b||"string"!==typeof a||b.length<a.length)return!1;for(var d=0;d<a.length;d++)if(b[d]!==a[d])return!1;return!0}}).call(l)});define("mode/xml",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/mode/text").Mode,f=b("ace/tokenizer").Tokenizer,h=b("mode/xml_highlight_rules").XmlHighlightRules,g=b("mode/xml_behavior").XmlBehaviour,c=b("mode/xml_fold_mode").FoldMode,a=function(){this.$tokenizer=new f((new h).getRules());this.$behaviour=new g;this.foldingRules=new c};j.inherits(a,k);(function(){this.getNextLineIndent=function(a,b){return this.$getIndent(b)}}).call(a.prototype);l.Mode=a});define("mode/xml_behavior",["require","exports","module"],function(b,l){function j(a,b){var c=!0,e=a.type.split(".");b.split(".").forEach(function(a){if(-1==e.indexOf(a))return c=!1});return c}var k=b("ace/lib/oop"),f=b("ace/mode/behaviour").Behaviour,h=b("ace/mode/behaviour/cstyle").CstyleBehaviour,g=b("ace/token_iterator").TokenIterator,c=function(){this.inherit(h,["string_dquotes"]);this.add("autoclosing","insertion",function(a,b,c,e,f){if(">"==f){a=c.getCursorPosition();c=new g(e,a.row,a.column);
e=c.getCurrentToken();b=!1;if(!e||!j(e,"meta.tag")&&(!j(e,"text")||!e.value.match("/"))){do e=c.stepBackward();while(e&&(j(e,"string")||j(e,"keyword.operator")||j(e,"entity.attribute-name")||j(e,"text")))}else b=!0;if(e&&j(e,"meta.tag-name")&&!c.stepBackward().value.match("/"))return c=e.value,b&&(c=c.substring(0,a.column-e.start)),{text:"></"+c+">",selection:[1,1]}}});this.add("autoindent","insertion",function(a,b,c,e,f){if("\n"==f&&(b=c.getCursorPosition(),"</"==e.doc.getLine(b.row).substring(b.column,
b.column+2)))return a=this.$getIndent(e.doc.getLine(b.row))+e.getTabString(),e=this.$getIndent(e.doc.getLine(b.row)),{text:"\n"+a+"\n"+e,selection:[1,a.length,1,a.length]}})};k.inherits(c,f);l.XmlBehaviour=c});define("mode/xml_fold_mode",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("ace/lib/lang"),f=b("ace/range").Range,h=b("ace/mode/folding/fold_mode").FoldMode,g=b("ace/token_iterator").TokenIterator,c=l.FoldMode=function(a){h.call(this);this.voidElements=a||{}};j.inherits(c,h);(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),e="",f=0;f<c.length;f++)var g=c[f],e=0===g.type.indexOf("meta.tag")?e+g.value:e+k.stringRepeat(" ",g.value.length);return this._parseTag(e)};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="",e;do if(0===b.type.indexOf("meta.tag")&&(e||(e={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()}),c+=b.value,-1!==c.indexOf(">")))return c=this._parseTag(c),c.start=e,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=
"",e;do if(0===b.type.indexOf("meta.tag")&&(e||(e={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()+b.value.length}),c=b.value+c,-1!==c.indexOf("<")))return b=this._parseTag(c),b.end=e,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)return a.pop();if(this.voidElements[b.tagName])break;else if(this.voidElements[c.tagName])a.pop();
else return null}};this.getFoldWidgetRange=function(a,b,c){var e=this._getFirstTagInLine(a,c);if(!e.match)return null;b=[];if(e.closing||e.selfClosing){a=new g(a,c,e.column+e.match.length);for(e={row:c,column:e.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,f.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,f.fromPoints(c.start,e)}}else{a=
new g(a,c,e.column);for(e={row:c,column:e.column+e.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,f.fromPoints(c.start,c.end);if(c.closing){if(this._pop(b,c),0==b.length)return f.fromPoints(e,c.start)}else b.push(c)}}}}).call(c.prototype)});define("mode/xml_highlight_rules",["require","exports","module"],function(b,l){var j=b("ace/lib/oop"),k=b("mode/xml_util"),f=b("ace/mode/text_highlight_rules").TextHighlightRules,h=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:".*?--\>",next:"start"},{token:"comment",merge:!0,regex:".+"}]};k.tag(this.$rules,"tag","start")};j.inherits(h,f);l.XmlHighlightRules=h});define("mode/xml_util",["require","exports","module"],function(b,l){function j(b,f){return[{token:"string",merge:!0,regex:".*?"+b,next:f},{token:"string",merge:!0,regex:".+"}]}l.tag=function(b,f,h,g){b[f]=[{token:"text",regex:"\\s+"},{token:function(b){return g&&g[b]?"meta.tag.tag-name."+g[b]:"meta.tag.tag-name"},merge:!0,regex:"[-_a-zA-Z0-9:]+",next:f+"_embed_attribute_list"},{token:"empty",regex:"",next:f+"_embed_attribute_list"}];b[f+"_qstring"]=j("'",f+"_embed_attribute_list");b[f+"_qqstring"]=
j('"',f+"_embed_attribute_list");b[f+"_embed_attribute_list"]=[{token:"meta.tag",merge:!0,regex:"/?>",next:h},{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:f+"_qqstring"},{token:"string",regex:"'.*?'"},{token:"string",merge:!0,regex:"['].*",next:f+"_qstring"}])}});define("theme/default",["require","exports","module"],function(b,l){b("ace/lib/dom");l.cssClass="ace-rs"});if(!String.prototype.trimRight){var trimEndRegexp=/\s\s*$/;String.prototype.trimRight=function(){return(""+this).replace(trimEndRegexp,"")}}
define("rstudio/loader",["require","exports","module"],function(b,l){var j=b("ace/lib/oop");b("ace/lib/event");b("ace/lib/event_emitter");var k=b("ace/editor").Editor,f=b("ace/edit_session").EditSession,h=b("ace/undomanager").UndoManager,g=b("ace/range").Range,c=b("mode/utils");b("util/expand_selection");b("mixins/token_iterator");var a=function(a,b){k.call(this,a,b);this.setBehavioursEnabled(!0)};j.inherits(a,k);(function(){this.insert=function(a,b){if(!this.session.selection.isEmpty()){var d=[];
"quotes"===this.$surroundSelection?d=["'",'"']:"quotes_and_brackets"===this.$surroundSelection&&(d=["'",'"',"(","{","["]);var f=this.session.$mode;if(/\/markdown$/.test(f.$id))d.push("*","_");else{var g=this.getCursorPosition();f.getLanguageMode&&"Markdown"===f.getLanguageMode(g)&&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 k.prototype.insert.call(this,a,b)};this.remove=function(a){return this.session.getMode().wrapRemove?
this.session.getMode().wrapRemove(this,k.prototype.remove,a):k.prototype.remove.call(this,a)};this.undo=function(){k.prototype.undo.call(this);this._dispatchEvent("undo")};this.redo=function(){k.prototype.redo.call(this);this._dispatchEvent("redo")};this.onPaste=function(a,b){k.prototype.onPaste.call(this,a.replace(/\r\n|\n\r|\r/g,"\n"),b)}}).call(a.prototype);var d=function(a,b){f.call(this,a,b)};j.inherits(d,f);(function(){this.insert=function(a,b){return this.getMode().wrapInsert?this.getMode().wrapInsert(this,
f.prototype.insert,a,b):f.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 f=d;f<=a;f++){var g=c.getPrimaryState(this,f-1);if(!c.endsWith(g,"qstring")){var h=b.getNextLineIndent(g,this.getLine(f-1),this.getTabString(),f-1,!0);this.applyIndent(f,h);b.autoOutdent(g,this,f)}}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 g(a,0,a,c),b)};this.setDisableOverwrite=function(a){a?(this.setOverwrite(!1),this.setOverwrite=function(){},this.getOverwrite=function(){return!1}):(this.setOverwrite=f.prototype.setOverwrite,this.getOverwrite=f.prototype.getOverwrite)}}).call(d.prototype);var i=function(){h.call(this)};j.inherits(i,h);(function(){this.peek=function(){return this.$undoStack.length?this.$undoStack[this.$undoStack.length-
1]:null}}).call(i.prototype);l.loadEditor=function(c){function f(a){g.editor.commands.removeCommand(a)}var g={};c.env=g;var h=b("ace/virtual_renderer").VirtualRenderer,j=b("ace/mode/text").Mode;g.editor=new a(new h(c,{}),new d(""));c=g.editor.getSession();c.setMode(new j);c.setUndoManager(new i);j=b("ace/config");j.set("workerPath","js/workers");j.setDefaultValue("session","useWorker",!1);f("findnext");f("findprevious");f("find");f("replace");f("togglecomment");f("gotoline");f("foldall");f("unfoldall");
f("touppercase");f("tolowercase");return g.editor}});define("rstudio/snippets",["require","exports","module"],function(b,l){l.toSnippetText=function(b){for(var k=b.length,f="",h=0;h<k;h++)var g=b[h],f=f+("snippet "+g.name+"\n\t"+g.content.replace(/\n/g,"\n\t")+"\n\n");return f};l.normalizeSnippets=function(b){for(var k=b.length,f=0;f<k;f++){var h=b[f];null==h.tabTrigger&&(h.tabTrigger=h.name);h.content=h.content.replace("\n    ","\n\t")}}});define("rstudio/snippets/c_cpp",["require","exports","module"],function(b,l){var j=b("rstudio/snippets"),k=b("ace/snippets").snippetManager,f=[{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"}];j.normalizeSnippets(f);l.snippetText=j.toSnippetText(f);k.register(f,"c_cpp")});define("rstudio/snippets/markdown",["require","exports","module"],function(b,l){var j=b("rstudio/snippets"),k=b("ace/snippets").snippetManager,f=[{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```"}];j.normalizeSnippets(f);l.snippetText=j.toSnippetText(f);k.register(f,"markdown")});define("rstudio/snippets/r",["require","exports","module"],function(b,l){var j=b("rstudio/snippets"),k=b("ace/snippets").snippetManager,f=[{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")`'}];j.normalizeSnippets(f);l.snippetText=j.toSnippetText(f);k.register(f,"r")});define("rstudio/snippets/stan",["require","exports","module"],function(b,l){var j=b("rstudio/snippets"),k=b("ace/snippets").snippetManager,f=[{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}"}];j.normalizeSnippets(f);l.snippetText=j.toSnippetText(f);k.register(f,"stan");k.files["mode/stan"]=!0});