ace.define("ace/mode/xquery",["require","exports","module","ace/worker/worker_client","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/xquery_highlight_rules","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){var r=e("../worker/worker_client").WorkerClient;var i=e("../lib/oop");var s=e("./text").Mode;var o=e("../tokenizer").Tokenizer;var u=e("./xquery_highlight_rules").XQueryHighlightRules;var a=e("../range").Range;var f=e("./behaviour/cstyle").CstyleBehaviour;
var l=e("./folding/cstyle").FoldMode;var c=function(e){this.$tokenizer=new o((new u).getRules()),this.$behaviour=new f(e),this.foldingRules=new l};i.inherits(c,s),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);var i=t.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);return i&&(r+=n),r},this.checkOutdent=function(e,t,n){return/^\s+$/.test(t)?/^\s*[\}\)]/.test(n):!1},this.autoOutdent=function(e,t,n){var r=t.getLine(n);var i=r.match(/^(\s*[\}\)])/);if(!i)return 0;var s=i[1].length;
var o=t.findMatchingBracket({row:n,column:s});if(!o||o.row==n)return 0;var u=this.$getIndent(t.getLine(o.row));t.replace(new a(n,0,n,s-1),u)},this.$getIndent=function(e){var t=e.match(/^(\s+)/);return t?t[1]:""},this.toggleCommentLines=function(e,t,n,r){var i;var s;var o=!0;var u=/^\s*\(:(.*):\)/;for(i=n;i<=r;i++)if(!u.test(t.getLine(i))){o=!1;break}var f=new a(0,0,0,0);for(i=n;i<=r;i++)s=t.getLine(i),f.start.row=i,f.end.row=i,f.end.column=s.length,t.replace(f,o?s.match(u)[1]:"(:"+s+":)")},this.createWorker=
function(e$$0){this.$deltas=[];var t$$0=new r(["ace"],"ace/mode/xquery_worker","XQueryWorker");var n=this;return e$$0.getDocument().on("change",function(e){n.$deltas.push(e.data)}),t$$0.attachToDocument(e$$0.getDocument()),t$$0.on("start",function(e){n.$deltas=[]}),t$$0.on("error",function(t){e$$0.setAnnotations([t.data])}),t$$0.on("ok",function(t){e$$0.clearAnnotations()}),t$$0.on("highlight",function(t){var r=0;var i=e$$0.getLength()-1;var s=t.data.lines;var o=t.data.states;for(var u=0;u<n.$deltas.length;u++){var a=
n.$deltas[u];if(a.action==="insertLines"){var f=a.lines.length;for(u=0;u<f;u++)s.splice(a.range.start.row+u,0,undefined),o.splice(a.range.start.row+u,0,undefined)}else if(a.action==="insertText")e$$0.getDocument().isNewLine(a.text)?(s.splice(a.range.end.row,0,undefined),o.splice(a.range.end.row,0,undefined)):(s[a.range.start.row]=undefined,o[a.range.start.row]=undefined);else if(a.action==="removeLines"){var l=a.lines.length;s.splice(a.range.start.row,l),o.splice(a.range.start.row,l)}else a.action===
"removeText"&&(e$$0.getDocument().isNewLine(a.text)?(s[a.range.start.row]=undefined,s.splice(a.range.end.row,1),o[a.range.start.row]=undefined,o.splice(a.range.end.row,1)):(s[a.range.start.row]=undefined,o[a.range.start.row]=undefined))}e$$0.bgTokenizer.lines=s,e$$0.bgTokenizer.states=o,e$$0.bgTokenizer.fireUpdateEvent(r,i)}),t$$0}}.call(c.prototype),t.Mode=c}),ace.define("ace/mode/xquery_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e$$0,t,
n){var r=e$$0("../lib/oop");var i=e$$0("./text_highlight_rules").TextHighlightRules;var s=function(){var e=this.createKeywordMapper({keyword:"after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning|append|json|position"},
"identifier");this.$rules={start:[{token:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml-pe",regex:"<\\?.*?\\?>"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"comment",regex:"\\(:",next:"comment"},{token:"text",regex:"<\\/?",next:"tag"},{token:"constant",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"variable",regex:"\\$[a-zA-Z_][a-zA-Z0-9_\\-:]*\\b"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"text",regex:"\\s+"},{token:"support.function",
regex:"\\w[\\w+_\\-:]+(?=\\()"},{token:e,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\*|=|<|>|\\-|\\+"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"}],tag:[{token:"text",regex:">",next:"start"},{token:"meta.tag",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"comment",regex:"\\]\\]>",next:"start"},{token:"comment",regex:"\\s+"},{token:"comment",regex:"(?:[^\\]]|\\](?!\\]>))+"}],
comment:[{token:"comment",regex:".*?--\>",next:"start"},{token:"comment",regex:".*:\\)",next:"start"},{token:"comment",regex:".+"}]}};r.inherits(s,i),t.XQueryHighlightRules=s}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e$$0,t$$0,n$$0){var r$$0=e$$0("../../lib/oop");var i$$0=e$$0("../behaviour").Behaviour;var s$$0=e$$0("../../token_iterator").TokenIterator;var o$$0=e$$0("../../lib/lang");var u$$0=
["text","paren.rparen","punctuation.operator"];var a$$0=["text","paren.rparen","punctuation.operator","comment"];var f$$0=0;var l$$0=-1;var c$$0="";var h=0;var p=-1;var d="";var v="";var m=function(){m.isSaneInsertion=function(e,t){var n=e.getCursorPosition();var r=new s$$0(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u$$0)){var i=new s$$0(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u$$0))return!1}return r.stepForward(),r.getCurrentTokenRow()!==
n.row||this.$matchTokenType(r.getCurrentToken()||"text",a$$0)},m.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},m.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition();var i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,c$$0[0])||(f$$0=0),l$$0=r.row,c$$0=n+i.substr(r.column),f$$0++},m.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition();var i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(h=0),p=r.row,d=i.substr(0,r.column)+n,v=i.substr(r.column),h++},
m.isAutoInsertedClosing=function(e,t,n){return f$$0>0&&e.row===l$$0&&n===c$$0[0]&&t.substr(e.column)===c$$0},m.isMaybeInsertedClosing=function(e,t){return h>0&&e.row===p&&t.substr(e.column)===v&&t.substr(0,e.column)==d},m.popAutoInsertedClosing=function(){c$$0=c$$0.substr(1),f$$0--},m.clearMaybeInsertedClosing=function(){h=0,p=-1},this.add("braces","insertion",function(e,t,n,r,i){var s=n.getCursorPosition();var u=r.doc.getLine(s.row);if(i=="{"){var a=n.getSelectionRange();var f=r.doc.getTextRange(a);
if(f!==""&&f!=="{"&&n.getWrapBehavioursEnabled())return{text:"{"+f+"}",selection:!1};if(m.isSaneInsertion(n,r))return/[\]\}\)]/.test(u[s.column])?(m.recordAutoInsert(n,r,"}"),{text:"{}",selection:[1,1]}):(m.recordMaybeInsert(n,r,"{"),{text:"{",selection:[1,1]})}else if(i=="}"){var l=u.substring(s.column,s.column+1);if(l=="}"){var c=r.$findOpeningBracket("}",{column:s.column+1,row:s.row});if(c!==null&&m.isAutoInsertedClosing(s,u,i))return m.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(i==
"\n"||i=="\r\n"){var p="";m.isMaybeInsertedClosing(s,u)&&(p=o$$0.stringRepeat("}",h),m.clearMaybeInsertedClosing());l=u.substring(s.column,s.column+1);if(l=="}"||p!==""){var d=r.findMatchingBracket({row:s.row,column:s.column},"}");if(!d)return null;var v=this.getNextLineIndent(e,u.substring(0,s.column),r.getTabString());var g=this.$getIndent(u);return{text:"\n"+v+"\n"+g+p,selection:[1,v.length,1,v.length]}}}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&
s=="{"){var o=r.doc.getLine(i.start.row);var u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;h--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){var s=n.getSelectionRange();var o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return{text:"("+o+")",selection:!1};if(m.isSaneInsertion(n,r))return m.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){var u=n.getCursorPosition();var a=r.doc.getLine(u.row);var f=a.substring(u.column,
u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&m.isAutoInsertedClosing(u,a,i))return m.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){var o=r.doc.getLine(i.start.row);var u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){var s=n.getSelectionRange();
var o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return{text:"["+o+"]",selection:!1};if(m.isSaneInsertion(n,r))return m.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){var u=n.getCursorPosition();var a=r.doc.getLine(u.row);var f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&m.isAutoInsertedClosing(u,a,i))return m.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets",
"deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){var o=r.doc.getLine(i.start.row);var u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){if(i=='"'||i=="'"){var s=i;var o=n.getSelectionRange();var u=r.doc.getTextRange(o);if(u!==""&&u!=="'"&&u!='"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition();var f=r.doc.getLine(a.row);var l=
f.substring(a.column-1,a.column);if(l=="\\")return null;var c=r.getTokens(o.start.row);var h=0;var p;var d=-1;for(var v=0;v<c.length;v++){p=c[v],p.type=="string"?d=-1:d<0&&(d=p.value.indexOf(s));if(p.value.length+h>o.start.column)break;h+=c[v].value.length}if(!p||d<0&&p.type!=="comment"&&(p.type!=="string"||o.start.column!==p.value.length+h-1&&p.value.lastIndexOf(s)===p.value.length-1)){if(!m.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(p&&p.type==="string"){var g=f.substring(a.column,
a.column+1);if(g==s)return{text:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){var o=r.doc.getLine(i.start.row);var u=o.substring(i.start.column+1,i.start.column+2);if(u=='"')return i.end.column++,i}})};r$$0.inherits(m,i$$0),t$$0.CstyleBehaviour=m}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e$$0,t$$0,n$$0){var r$$0=
e$$0("../../lib/oop");var i$$0=e$$0("../../range").Range;var s$$0=e$$0("./fold_mode").FoldMode;var o=t$$0.FoldMode=function(){};r$$0.inherits(o,s$$0),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n);var i=r.match(this.foldingStartMarker);if(i){var s=i.index;return i[1]?this.openingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s+i[0].length,1)}if(t!=="markbeginend")return;
i=r.match(this.foldingStopMarker);if(i){s=i.index+i[0].length;return i[1]?this.closingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s,-1)}}}.call(o.prototype)});