diff --git a/Makefile.dryice.js b/Makefile.dryice.js index cae1112d..fecda96f 100644 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -86,13 +86,6 @@ copy({ dest: buildStep }); -// The startup file -copy({ - source: { base: aceHome + '/demo/', path: 'demo_startup.js' }, - filter: [ copy.filter.moduleDefines ], - dest: buildStep -}); - // The CSS files copy({ source: [ diff --git a/build/ace-uncompressed.js b/build/ace-uncompressed.js index 5305db61..5283a236 100644 --- a/build/ace-uncompressed.js +++ b/build/ace-uncompressed.js @@ -11833,227 +11833,6 @@ var TextHighlightRules = function() { }).call(TextHighlightRules.prototype); exports.TextHighlightRules = TextHighlightRules; -}); -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Skywriter. - * - * The Initial Developer of the Original Code is - * Mozilla. - * Portions created by the Initial Developer are Copyright (C) 2009 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Fabian Jakobs - * Kevin Dangoor (kdangoor@mozilla.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -define('demo_startup', function(require, exports, module) { - -exports.launch = function(env) { - - var event = require("pilot/event"); - var Editor = require("ace/editor").Editor; - var Renderer = require("ace/virtual_renderer").VirtualRenderer; - var theme = require("ace/theme/textmate"); - var Document = require("ace/document").Document; - var JavaScriptMode = require("ace/mode/javascript").Mode; - var CssMode = require("ace/mode/css").Mode; - var HtmlMode = require("ace/mode/html").Mode; - var XmlMode = require("ace/mode/xml").Mode; - var PythonMode = require("ace/mode/python").Mode; - var PhpMode = require("ace/mode/php").Mode; - var TextMode = require("ace/mode/text").Mode; - var UndoManager = require("ace/undomanager").UndoManager; - - var docs = {}; - - docs.js = new Document(document.getElementById("jstext").innerHTML); - docs.js.setMode(new JavaScriptMode()); - docs.js.setUndoManager(new UndoManager()); - - docs.css = new Document(document.getElementById("csstext").innerHTML); - docs.css.setMode(new CssMode()); - docs.css.setUndoManager(new UndoManager()); - - docs.html = new Document(document.getElementById("htmltext").innerHTML); - docs.html.setMode(new HtmlMode()); - docs.html.setUndoManager(new UndoManager()); - - docs.python = new Document(document.getElementById("pythontext").innerHTML); - docs.python.setMode(new PythonMode()); - docs.python.setUndoManager(new UndoManager()); - - docs.php = new Document(document.getElementById("phptext").innerHTML); - docs.php.setMode(new PhpMode()); - docs.php.setUndoManager(new UndoManager()); - - var docEl = document.getElementById("doc"); - - var container = document.getElementById("editor"); - env.editor = new Editor(new Renderer(container, theme)); - - function onDocChange() { - var doc = getDoc(); - env.editor.setDocument(doc); - - var mode = doc.getMode(); - if (mode instanceof JavaScriptMode) { - modeEl.value = "javascript"; - } - else if (mode instanceof CssMode) { - modeEl.value = "css"; - } - else if (mode instanceof HtmlMode) { - modeEl.value = "html"; - } - else if (mode instanceof XmlMode) { - modeEl.value = "xml"; - } - else if (mode instanceof PythonMode) { - modeEl.value = "python"; - } - else if (mode instanceof PhpMode) { - modeEl.value = "php"; - } - else { - modeEl.value = "text"; - } - - env.editor.focus(); - } - docEl.onchange = onDocChange; - - function getDoc() { - return docs[docEl.value]; - } - - var modeEl = document.getElementById("mode"); - modeEl.onchange = function() { - env.editor.getDocument().setMode(modes[modeEl.value] || modes.text); - }; - - var modes = { - text: new TextMode(), - xml: new XmlMode(), - html: new HtmlMode(), - css: new CssMode(), - javascript: new JavaScriptMode(), - python: new PythonMode(), - php: new PhpMode() - }; - - function getMode() { - return modes[modeEl.value]; - } - - var themeEl = document.getElementById("theme"); - themeEl.onchange = function() { - env.editor.setTheme(themeEl.value); - }; - - var selectEl = document.getElementById("select_style"); - selectEl.onchange = function() { - if (selectEl.checked) { - env.editor.setSelectionStyle("line"); - } else { - env.editor.setSelectionStyle("text"); - } - }; - - var activeEl = document.getElementById("highlight_active"); - activeEl.onchange = function() { - env.editor.setHighlightActiveLine(!!activeEl.checked); - }; - - onDocChange(); - - window.jump = function() { - var jump = document.getElementById("jump"); - var cursor = env.editor.getCursorPosition(); - var pos = env.editor.renderer.textToScreenCoordinates(cursor.row, cursor.column); - jump.style.left = pos.pageX + "px"; - jump.style.top = pos.pageY + "px"; - jump.style.display = "block"; - }; - - function onResize() { - container.style.width = (document.documentElement.clientWidth - 4) + "px"; - container.style.height = (document.documentElement.clientHeight - 55 - 4 - 23) + "px"; - env.editor.resize(); - }; - - window.onresize = onResize; - onResize(); - - event.addListener(container, "dragover", function(e) { - return event.preventDefault(e); - }); - - event.addListener(container, "drop", function(e) { - try { - var file = e.dataTransfer.files[0]; - } catch(e) { - return event.stopEvent(); - } - - if (window.FileReader) { - var reader = new FileReader(); - reader.onload = function(e) { - env.editor.getSelection().selectAll(); - - var mode = "text"; - if (/^.*\.js$/i.test(file.name)) { - mode = "javascript"; - } else if (/^.*\.xml$/i.test(file.name)) { - mode = "xml"; - } else if (/^.*\.html$/i.test(file.name)) { - mode = "html"; - } else if (/^.*\.css$/i.test(file.name)) { - mode = "css"; - } else if (/^.*\.py$/i.test(file.name)) { - mode = "python"; - } else if (/^.*\.php$/i.test(file.name)) { - mode = "php"; - } - - env.editor.onTextInput(reader.result); - - modeEl.value = mode; - env.editor.getDocument().setMode(modes[mode]); - }; - reader.readAsText(file); - } - - return event.preventDefault(e); - }); -}; - }); define("text!ace/css/editor.css", ".ace_editor {" + " position: absolute;" + diff --git a/build/ace.js b/build/ace.js index eca68eb5..0ace9164 100644 --- a/build/ace.js +++ b/build/ace.js @@ -1 +1 @@ -function define(a,b){typeof a!=="string"?(console.error("dropping module because define wasn't munged."),console.trace()):(console.log("defining module: "+a+" as a "+typeof b),require.modules[a]=b)}function require(a,b){if(Array.isArray(a)){var c=[];a.forEach(function(a){c.push(require.modules[a])},this),b&&b.apply(null,c)}if(typeof a==="string"){var d=require.modules[a],e=a;d==null&&console.error("Missing module: "+a);if(typeof d==="function"){var f={},a={id:"",uri:""};d(require,f,a),d=f,require.modules[e]=d}b&&b();return d}}require.modules={},define("pilot/canon",function(a,b,c){function x(a){a=a||{},this.command=a.command,this.args=a.args,this.typed=a.typed,this._begunOutput=!1,this.start=new Date,this.end=null,this.completed=!1,this.error=!1}function u(a,b,c,d){typeof a==="string"&&(a=n[a]);if(!a)return!1;var e=new x({command:a,args:c,typed:d});a.exec(b,c||{},e);return!0}function t(){return o}function s(a){return n[a]}function r(a){var b=typeof a==="string"?a:a.name;delete n[b],k.arrayRemove(o,b)}function q(a,b){var c=b.type;b.type=j.getType(c);if(b.type==null)throw new Error("In "+a+"/"+b.name+": can't find type for: "+JSON.stringify(c))}function p(a){if(!a.name)throw new Error("All registered commands must have a name");a.params==null&&(a.params=[]);if(!Array.isArray(a.params))throw new Error("command.params must be an array in "+a.name);a.params.forEach(function(b){if(!b.name)throw new Error("In "+a.name+": all params must have a name");q(a.name,b)},this),n[a.name]=a,o.push(a.name),o.sort()}var d=a("pilot/console"),e=a("pilot/stacktrace").Trace,f=a("pilot/oop"),g=a("pilot/event_emitter").EventEmitter,h=a("pilot/catalog"),i=a("pilot/types").Status,j=a("pilot/types"),k=a("pilot/lang"),l={name:"command",description:"A command is a bit of functionality with optional typed arguments which can do something small like moving the cursor around the screen, or large like cloning a project from VCS.",indexOn:"name"};b.startup=function(a,b){h.addExtensionSpec(l)},b.shutdown=function(a,b){h.removeExtensionSpec(l)};var m={name:"thing",description:"thing is an example command",params:[{name:"param1",description:"an example parameter",type:"text",defaultValue:null}],exec:function(a,b,c){thing()}},n={},o=[];b.removeCommand=r,b.addCommand=p,b.getCommand=s,b.getCommandNames=t,b.exec=u,b.upgradeType=q,f.implement(b,g);var v=[],w=100;f.implement(x.prototype,g),x.prototype._beginOutput=function(){this._begunOutput=!0,this.outputs=[],v.push(this);while(v.length>w)v.shiftObject();b._dispatchEvent("output",{requests:v,request:this})},x.prototype.doneWithError=function(a){this.error=!0,this.done(a)},x.prototype.async=function(){this._begunOutput||this._beginOutput()},x.prototype.output=function(a){this._begunOutput||this._beginOutput(),typeof a!=="string"&&!(a instanceof Node)&&(a=a.toString()),this.outputs.push(a),this._dispatchEvent("output",{});return this},x.prototype.done=function(a){this.completed=!0,this.end=new Date,this.duration=this.end.getTime()-this.start.getTime(),a&&this.output(a),this._dispatchEvent("output",{})},b.Request=x}),define("pilot/catalog",function(a,b,c){var d={};b.addExtensionSpec=function(a){d[a.name]=a},b.removeExtensionSpec=function(a){typeof a==="string"?delete d[a]:delete d[a.name]},b.getExtensionSpec=function(a){return d[a]},b.getExtensionSpecs=function(){return Object.keys(d)}}),define("pilot/commands/basic",function(require,exports,module){var checks=require("pilot/typecheck"),canon=require("pilot/canon"),helpMessages={plainPrefix:'

Welcome to Skywriter - Code in the Cloud

',plainSuffix:'For more information, see the Skywriter Wiki.'},helpCommandSpec={name:"help",params:[{name:"search",type:"text",description:"Search string to narrow the output.",defaultValue:null}],description:"Get help on the available commands.",exec:function(a,b,c){var d=[],e=canon.getCommand(b.search);if(e&&e.exec)d.push(e.description?e.description:"No description for "+b.search);else{var f=!1;!b.search&&helpMessages.plainPrefix&&d.push(helpMessages.plainPrefix),e?(d.push("

Sub-Commands of "+e.name+"

"),d.push("

"+e.description+"

")):b.search?(b.search=="hidden"&&(b.search="",f=!0),d.push("

Commands starting with '"+b.search+"':

")):d.push("

Available Commands:

");var g=canon.getCommandNames();g.sort(),d.push("");for(var h=0;h"),d.push('"),d.push(""),d.push("")}d.push("
'+e.name+""+e.description+"
"),!b.search&&helpMessages.plainSuffix&&d.push(helpMessages.plainSuffix)}c.done(d.join(""))}},evalCommandSpec={name:"eval",params:[{name:"javascript",type:"text",description:"The JavaScript to evaluate"}],description:"evals given js code and show the result",hidden:!0,exec:function(env,args,request){var result,javascript=args.javascript;try{result=eval(javascript)}catch(e){result="Error: "+e.message+""}var msg="",type="",x;if(checks.isFunction(result))msg=(result+"").replace(/\n/g,"
").replace(/ /g," "),type="function";else if(checks.isObject(result)){Array.isArray(result)?type="array":type="object";var items=[],value;for(x in result)result.hasOwnProperty(x)&&(checks.isFunction(result[x])?value="[function]":checks.isObject(result[x])?value="[object]":value=result[x],items.push({name:x,value:value}));items.sort(function(a,b){return a.name.toLowerCase()"+items[x].name+": "+items[x].value+"
"}else msg=result,type=typeof result;request.done("Result for eval '"+javascript+"' (type: "+type+"):

"+msg)}},versionCommandSpec={name:"version",description:"show the Skywriter version",hidden:!0,exec:function(a,b,c){var d="Skywriter "+skywriter.versionNumber+" ("+skywriter.versionCodename+")";c.done(d)}},skywriterCommandSpec={name:"skywriter",hidden:!0,exec:function(a,b,c){var d=Math.floor(Math.random()*messages.length);c.done("Skywriter "+messages[d])}},messages=["really wants you to trick it out in some way.","is your Web editor.","would love to be like Emacs on the Web.","is written on the Web platform, so you can tweak it."],canon=require("pilot/canon");exports.startup=function(a,b){canon.addCommand(helpCommandSpec),canon.addCommand(evalCommandSpec),canon.addCommand(skywriterCommandSpec)},exports.shutdown=function(a,b){canon.removeCommand(helpCommandSpec),canon.removeCommand(evalCommandSpec),canon.removeCommand(skywriterCommandSpec)}}),define("pilot/commands/history",function(a,b,c){var d={name:"historyPrevious",predicates:{isCommandLine:!0,isKeyUp:!0},key:"up",exec:function(a,b){g>0&&g--;var c=history.requests[g].typed;env.commandLine.setInput(c)}},e={name:"historyNext",predicates:{isCommandLine:!0,isKeyUp:!0},key:"down",exec:function(a,b){g");var d=1;history.requests.forEach(function(a){c.push(""),c.push(""+d+""),c.push(""+a.typed+""),c.push(""),d++}),c.push(""),b.done(c.join(""))}},g=0;b.addedRequestOutput=function(){g=history.requests.length}}),define("pilot/commands/settings",function(a,b,c){var d={name:"set",params:[{name:"setting",type:"setting",description:"The name of the setting to display or alter",defaultValue:null},{name:"value",type:"settingValue",description:"The new value for the chosen setting",defaultValue:null}],description:"define and show settings",exec:function(a,b,c){var d;if(b.setting)b.value===undefined?d=""+setting.name+" = "+setting.get():(b.setting.set(b.value),d="Setting: "+b.setting.name+" = "+b.setting.get());else{var e=a.settings.getSettingNames();d="",e.sort(function(a,b){return a.localeCompare(b)}),e.forEach(function(b){var c=a.settings.getSetting(b),e="https://wiki.mozilla.org/Labs/Skywriter/Settings#"+c.name;d+=''+c.name+" = "+c.value+"
"})}c.done(d)}},e={name:"unset",params:[{name:"setting",type:"setting",description:"The name of the setting to return to defaults"}],description:"unset a setting entirely",exec:function(a,b,c){var d=a.settings.get(b.setting);d?(d.reset(),c.done("Reset "+d.name+" to default: "+a.settings.get(b.setting))):c.doneWithError("No setting with the name "+b.setting+".")}},f=a("pilot/canon");b.startup=function(a,b){f.addCommand(d),f.addCommand(e)},b.shutdown=function(a,b){f.removeCommand(d),f.removeCommand(e)}}),define("pilot/console",function(a,b,c){var d=function(){},e=["assert","count","debug","dir","dirxml","error","group","groupEnd","info","log","profile","profileEnd","time","timeEnd","trace","warn"];typeof window==="undefined"?e.forEach(function(a){b[a]=function(){var b=Array.prototype.slice.call(arguments),c={op:"log",method:a,args:b};postMessage(JSON.stringify(c))}}):e.forEach(function(a){window.console&&window.console[a]?b[a]=Function.prototype.bind.call(window.console[a],window.console):b[a]=d})}),define("pilot/dom",function(a,b,c){b.setText=function(a,b){a.innerText!==undefined&&(a.innerText=b),a.textContent!==undefined&&(a.textContent=b)},b.hasCssClass=function(a,b){var c=a.className.split(/\s+/g);return c.indexOf(b)!==-1},b.addCssClass=function(a,c){b.hasCssClass(a,c)||(a.className+=" "+c)},b.setCssClass=function(a,c,d){d?b.addCssClass(a,c):b.removeCssClass(a,c)},b.removeCssClass=function(a,b){var c=a.className.split(/\s+/g);while(!0){var d=c.indexOf(b);if(d==-1)break;c.splice(d,1)}a.className=c.join(" ")},b.importCssString=function(a,b){b=b||document;if(b.createStyleSheet){var c=b.createStyleSheet();c.cssText=a}else{var d=b.createElement("style");d.appendChild(b.createTextNode(a)),b.getElementsByTagName("head")[0].appendChild(d)}},b.getInnerWidth=function(a){return parseInt(b.computedStyle(a,"paddingLeft"))+parseInt(b.computedStyle(a,"paddingRight"))+a.clientWidth},b.getInnerHeight=function(a){return parseInt(b.computedStyle(a,"paddingTop"))+parseInt(b.computedStyle(a,"paddingBottom"))+a.clientHeight},b.computedStyle=function(a,b){return window.getComputedStyle?(window.getComputedStyle(a,"")||{})[b]||"":a.currentStyle[b]},b.scrollbarWidth=function(){var a=document.createElement("p");a.style.width="100%",a.style.height="200px";var b=document.createElement("div"),c=b.style;c.position="absolute",c.left="-10000px",c.overflow="hidden",c.width="200px",c.height="150px",b.appendChild(a),document.body.appendChild(b);var d=a.offsetWidth;c.overflow="scroll";var e=a.offsetWidth;d==e&&(e=b.clientWidth),document.body.removeChild(b);return d-e}}),define("pilot/domtemplate",function(require,exports,module){function Templater(){this.scope=[]}Templater.prototype.processNode=function(a,b){typeof a==="string"&&(a=document.getElementById(a));if(b===null||b===undefined)b={};this.scope.push(a.nodeName+(a.id?"#"+a.id:""));try{if(a.attributes&&a.attributes.length){if(a.hasAttribute("foreach")){this.processForEach(a,b);return}if(a.hasAttribute("if"))if(!this.processIf(a,b))return;b.__element=a;var c=Array.prototype.slice.call(a.attributes);for(var d=0;d1&&(d.forEach(function(c){c!==null&&c!==undefined&&c!==""&&(c.charAt(0)==="$"&&(c=this.envEval(c.slice(1),b,a.data)),c===null&&(c="null"),c===undefined&&(c="undefined"),typeof c.cloneNode!=="function"&&(c=a.ownerDocument.createTextNode(c.toString())),a.parentNode.insertBefore(c,a))},this),a.parentNode.removeChild(a))},Templater.prototype.stripBraces=function(a){if(!a.match(/\$\{.*\}/g)){this.handleError("Expected "+a+" to match ${...}");return a}return a.slice(2,-1)},Templater.prototype.property=function(a,b,c){this.scope.push(a);try{typeof a==="string"&&(a=a.split("."));var d=b[a[0]];if(a.length===1){c!==undefined&&(b[a[0]]=c);if(typeof d==="function")return function(){return d.apply(b,arguments)};return d}if(!d){this.handleError("Can't find path="+a);return null}return this.property(a.slice(1),d,c)}finally{this.scope.pop()}},Templater.prototype.envEval=function(script,env,context){with(env)try{this.scope.push(context);return eval(script)}catch(ex){this.handleError("Template error evaluating '"+script+"'",ex);return script}finally{this.scope.pop()}},Templater.prototype.handleError=function(a,b){this.logError(a),this.logError("In: "+this.scope.join(" > ")),b&&this.logError(b)},Templater.prototype.logError=function(a){console.log(a)},exports.Templater=Templater}),define("pilot/environment",function(a,b,c){function e(){return{settings:d}}var d=a("pilot/settings").settings;b.create=e}),define("pilot/event",function(a,b,c){var d=a("pilot/useragent");b.addListener=function(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1);if(a.attachEvent){var d=function(){c(window.event)};c._wrapper=d,a.attachEvent("on"+b,d)}},b.removeListener=function(a,b,c){if(a.removeEventListener)return a.removeEventListener(b,c,!1);a.detachEvent&&a.detachEvent("on"+b,c._wrapper||c)},b.stopEvent=function(a){b.stopPropagation(a),b.preventDefault(a);return!1},b.stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},b.preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},b.getDocumentX=function(a){if(a.clientX){var b=document.documentElement.scrollLeft||document.body.scrollLeft;return a.clientX+b}return a.pageX},b.getDocumentY=function(a){if(a.clientY){var b=document.documentElement.scrollTop||document.body.scrollTop;return a.clientY+b}return a.pageX},b.getButton=function(a){return a.preventDefault?a.button:Math.max(a.button-1,2)},document.documentElement.setCapture?b.capture=function(a,c,d){function f(e){c&&c(e),d&&d(),b.removeListener(a,"mousemove",c),b.removeListener(a,"mouseup",f),b.removeListener(a,"losecapture",f),a.releaseCapture()}function e(a){c(a);return b.stopPropagation(a)}b.addListener(a,"mousemove",c),b.addListener(a,"mouseup",f),b.addListener(a,"losecapture",f),a.setCapture()}:b.capture=function(a,b,c){function e(a){b&&b(a),c&&c(),document.removeEventListener("mousemove",d,!0),document.removeEventListener("mouseup",e,!0),a.stopPropagation()}function d(a){b(a),a.stopPropagation()}document.addEventListener("mousemove",d,!0),document.addEventListener("mouseup",e,!0)},b.addMouseWheelListener=function(a,c){var d=function(a){a.wheelDelta!==undefined?a.wheelDeltaX!==undefined?(a.wheelX=-a.wheelDeltaX/8,a.wheelY=-a.wheelDeltaY/8):(a.wheelX=0,a.wheelY=-a.wheelDelta/8):a.axis&&a.axis==a.HORIZONTAL_AXIS?(a.wheelX=(a.detail||0)*5,a.wheelY=0):(a.wheelX=0,a.wheelY=(a.detail||0)*5),c(a)};b.addListener(a,"DOMMouseScroll",d),b.addListener(a,"mousewheel",d)},b.addMultiMouseDownListener=function(a,c,e,f,g){var h=0,i,j,k=function(a){h+=1,h==1&&(i=a.clientX,j=a.clientY,setTimeout(function(){h=0},f||600));if(b.getButton(a)!=c||Math.abs(a.clientX-i)>5||Math.abs(a.clientY-j)>5)h=0;h==e&&(h=0,g(a));return b.preventDefault(a)};b.addListener(a,"mousedown",k),d.isIE&&b.addListener(a,"dblclick",k)},b.addKeyListener=function(a,c){var e=null;b.addListener(a,"keydown",function(a){e=a.keyIdentifier||a.keyCode;return c(a)}),d.isMac&&(d.isGecko||d.isOpera)&&b.addListener(a,"keypress",function(a){var b=a.keyIdentifier||a.keyCode;if(e!==b)return c(a);e=null})}}),define("pilot/event_emitter",function(a,b,c){var d={};d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(c&&c.length){var b=b||{};b.type=a;for(var d=0;d>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e>>0;if(typeof a!=="function")throw new TypeError;var d=arguments[1];for(var e=0;e47&&d<58&&(j=a.altKey));if(f)a.altKey&&(h+="alt_"),a.ctrlKey&&(h+="ctrl_"),a.metaKey&&(h+="meta_");else if(a.ctrlKey||a.metaKey)return!1}f||(d=a.which,g=f=String.fromCharCode(d),i=f.toLowerCase(),a.metaKey?(h="meta_",f=i):f=null),a.shiftKey&&f&&j&&(h+="shift_"),f&&(f=h+f),!c&&f&&(f=f.replace(/ctrl_meta|meta/,"ctrl"));return[f,g]},b.addKeyDownListener=function(a,c){var g=function(a){var b=c(a);b&&d.stopEvent(a);return b};a.addEventListener("keydown",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return!0;if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS[a.keyCode])return!0}if(f(a))return g(a);return!0},!1),a.addEventListener("keypress",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return g(a);if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode]){a._keyCode=b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode],a._charCode=0;return g(a)}}if(a.charCode!==undefined&&a.charCode===0)return!0;return g(a)},!1)}}),define("pilot/lang",function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return Array(b+1).join(a)},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.arrayToMap=function(a){var b={};for(var c=0;cthis.NEW){e.resolve(this);return e}a([this.name],function(a){a.install&&a.install(b,c),this.status=this.INSTALLED,e.resolve(this)}.bind(this));return e},register:function(b,c){var e=new d;if(this.status!=this.INSTALLED){e.resolve(this);return e}a([this.name],function(a){a.register&&a.register(b,c),this.status=this.REGISTERED,e.resolve(this)}.bind(this));return e},startup:function(c,e){e=e||b.REASONS.APP_STARTUP;var f=new d;if(this.status!=this.REGISTERED){f.resolve(this);return f}a([this.name],function(a){a.startup&&a.startup(c,e),this.status=this.STARTED,f.resolve(this)}.bind(this));return f},shutdown:function(b,c){this.status==this.STARTED&&(pluginModule=a(this.name),pluginModule.shutdown&&pluginModule.shutdown(b,c))}},b.PluginCatalog=function(){this.plugins={}},b.PluginCatalog.prototype={registerPlugins:function(a,c,e){var f=[];a.forEach(function(a){var d=this.plugins[a];d===undefined&&(d=new b.Plugin(a),this.plugins[a]=d,f.push(d.register(c,e)))}.bind(this));return d.group(f)},startupPlugins:function(a,b){var c=[];for(var e in this.plugins){var f=this.plugins[e];c.push(f.startup(a,b))}return d.group(c)}},b.catalog=new b.PluginCatalog}),define("pilot/promise",function(a,b,c){var d=a("pilot/console"),e=a("pilot/stacktrace").Trace,f=-1,g=0,h=1,i=0,j=!1,k=[],l=[];Promise=function(){this._status=g,this._value=undefined,this._onSuccessHandlers=[],this._onErrorHandlers=[],this._id=i++,k[this._id]=this},Promise.prototype.isPromise=!0,Promise.prototype.isComplete=function(){return this._status!=g},Promise.prototype.isResolved=function(){return this._status==h},Promise.prototype.isRejected=function(){return this._status==f},Promise.prototype.then=function(a,b){typeof a==="function"&&(this._status===h?a.call(null,this._value):this._status===g&&this._onSuccessHandlers.push(a)),typeof b==="function"&&(this._status===f?b.call(null,this._value):this._status===g&&this._onErrorHandlers.push(b));return this},Promise.prototype.chainPromise=function(a){var b=new Promise;b._chainedFrom=this,this.then(function(c){try{b.resolve(a(c))}catch(d){b.reject(d)}},function(a){b.reject(a)});return b},Promise.prototype.resolve=function(a){return this._complete(this._onSuccessHandlers,h,a,"resolve")},Promise.prototype.reject=function(a){return this._complete(this._onErrorHandlers,f,a,"reject")},Promise.prototype._complete=function(a,b,c,f){if(this._status!=g){d.group("Promise already closed"),d.error("Attempted "+f+"() with ",c),d.error("Previous status = ",this._status,", previous value = ",this._value),d.trace(),this._completeTrace&&(d.error("Trace of previous completion:"),this._completeTrace.log(5)),d.groupEnd();return this}j&&(this._completeTrace=new e(new Error)),this._status=b,this._value=c,a.forEach(function(a){a.call(null,this._value)},this),this._onSuccessHandlers.length=0,this._onErrorHandlers.length=0,delete k[this._id],l.push(this);while(l.length>20)l.shift();return this},Promise.group=function(a){a instanceof Array||(a=Array.prototype.slice.call(arguments));if(a.length===0)return(new Promise).resolve([]);var b=new Promise,c=[],d=0,e=function(e){return function(g){c[e]=g,d++,b._status!==f&&(d===a.length&&b.resolve(c))}};a.forEach(function(a,c){var d=e(c),f=b.reject.bind(b);a.then(d,f)});return b},b.Promise=Promise,b._outstanding=k,b._recent=l}),define("pilot/proxy",function(a,b,c){var d=a("pilot/promise").Promise;b.xhr=function(a,b,c,e){var f=new d;if(skywriter.proxy&&skywriter.proxy.xhr)skywriter.proxy.xhr.call(this,a,b,c,e,f);else{var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState===4){var a=g.status;if(a!==0&&a!==200){var b=new Error(g.responseText+" (Status "+g.status+")");b.xhr=g,f.reject(b);return}f.resolve(g.responseText)}}.bind(this),g.open("GET",b,c),e&&e(g),g.send()}return f},b.Worker=function(a){return skywriter.proxy&&skywriter.proxy.worker?new skywriter.proxy.worker(a):new Worker(a)}}),define("pilot/rangeutils",function(a,b,c){var d=a("util/util");b.addPositions=function(a,b){return{row:a.row+b.row,col:a.col+b.col}},b.cloneRange=function(a){var b=a.start,c=a.end,d={row:b.row,col:b.col},e={row:c.row,col:c.col};return{start:d,end:e}},b.comparePositions=function(a,b){var c=a.row-b.row;return c===0?a.col-b.col:c},b.equal=function(a,c){return b.comparePositions(a.start,c.start)===0&&b.comparePositions(a.end,c.end)===0},b.extendRange=function(a,b){var c=a.end;return{start:a.start,end:{row:c.row+b.row,col:c.col+b.col}}},b.intersectRangeSets=function(a,c){var e=d.clone(a),f=d.clone(c),g=[];while(e.length>0&&f.length>0){var h=e.shift(),i=f.shift(),j=b.comparePositions(h.start,i.start),k=b.comparePositions(h.end,i.end);b.comparePositions(h.end,i.start)<0?(g.push(h),f.unshift(i)):b.comparePositions(i.end,h.start)<0?(g.push(i),e.unshift(h)):j<0?(g.push({start:h.start,end:i.start}),e.unshift({start:i.start,end:h.end}),f.unshift(i)):j===0?k<0?f.unshift({start:h.end,end:i.end}):k>0&&e.unshift({start:i.end,end:h.end}):j>0&&(g.push({start:i.start,end:h.start}),e.unshift(h),f.unshift({start:h.start,end:i.end}))}return g.concat(e,f)},b.isZeroLength=function(a){return a.start.row===a.end.row&&a.start.col===a.end.col},b.maxPosition=function(a,c){return b.comparePositions(a,c)>0?a:c},b.normalizeRange=function(a){return this.comparePositions(a.start,a.end)<0?a:{start:a.end,end:a.start}},b.rangeSetBoundaries=function(a){return{start:a[0].start,end:a[a.length-1].end}},b.toString=function(a){var b=a.start,c=a.end;return"[ "+b.row+", "+b.col+" "+c.row+","+ +c.col+" ]"},b.unionRanges=function(a,b){return{start:a.start.rowb.end.row||a.end.row===b.end.row&&a.end.col>b.end.col?a.end:b.end}},b.isPosition=function(a){return!d.none(a)&&!d.none(a.row)&&!d.none(a.col)},b.isRange=function(a){return!d.none(a)&&b.isPosition(a.start)&&b.isPosition(a.end)}}),define("pilot/settings/canon",function(a,b,c){var d={name:"historyLength",description:"How many typed commands do we recall for reference?",type:"number",defaultValue:50};b.startup=function(a,b){a.env.settings.addSetting(d)},b.shutdown=function(a,b){a.env.settings.removeSetting(d)}}),define("pilot/settings",function(a,b,c){function l(){}function k(a){this._deactivated={},this._settings={},this._settingNames=[],a&&this.setPersister(a)}function j(a,b){this._settings=b,Object.keys(a).forEach(function(b){this[b]=a[b]},this),this.type=f.getType(this.type);if(this.type==null)throw new Error("In "+this.name+": can't find type for: "+JSON.stringify(a.type));if(!this.name)throw new Error("Setting.name == undefined. Ignoring.",this);if(!this.defaultValue===undefined)throw new Error("Setting.defaultValue == undefined",this);this.value=this.defaultValue}var d=a("pilot/console"),e=a("pilot/oop"),f=a("pilot/types"),g=a("pilot/event_emitter").EventEmitter,h=a("pilot/catalog"),i={name:"setting",description:"A setting is something that the application offers as a way to customize how it works",register:"env.settings.addSetting",indexOn:"name"};b.startup=function(a,b){h.addExtensionSpec(i)},b.shutdown=function(a,b){h.removeExtensionSpec(i)},j.prototype={get:function(){return this.value},set:function(a){this.value!==a&&(this.value=a,this._settings.persister&&this._settings.persister.persistValue(this._settings,this.name,a),this._dispatchEvent("change",{setting:this,value:a}))},resetValue:function(){this.set(this.defaultValue)}},e.implement(j.prototype,g),k.prototype={addSetting:function(a){var b=new j(a,this);this._settings[b.name]=b,this._settingNames.push(b.name),this._settingNames.sort()},removeSetting:function(a){var b=typeof a==="string"?a:a.name;delete this._settings[b],util.arrayRemove(this._settingNames,b)},getSettingNames:function(){return this._settingNames},getSetting:function(a){return this._settings[a]},setPersister:function(a){this._persister=a,a&&a.loadInitialValues(this)},resetAll:function(){this.getSettingNames().forEach(function(a){this.resetValue(a)},this)},_list:function(){var a=[];this.getSettingNames().forEach(function(b){a.push({key:b,value:this.getSetting(b).get()})},this);return a},_loadDefaultValues:function(){this._loadFromObject(this._getDefaultValues())},_loadFromObject:function(a){for(var b in a)if(a.hasOwnProperty(b)){var c=this._settings[b];if(c){var d=c.type.parse(a[b]);this.set(b,d)}else this.set(b,a[b])}},_saveToObject:function(){return this.getSettingNames().map(function(a){return this._settings[a].type.stringify(this.get(a))}.bind(this))},_getDefaultValues:function(){return this.getSettingNames().map(function(a){return this._settings[a].spec.defaultValue}.bind(this))}},b.settings=new k,l.prototype={loadInitialValues:function(a){a._loadDefaultValues();var b=cookie.get("settings");a._loadFromObject(JSON.parse(b))},persistValue:function(a,b,c){try{var e=JSON.stringify(a._saveToObject());cookie.set("settings",e)}catch(f){d.error("Unable to JSONify the settings! "+f);return}}},b.CookiePersister=l}),define("pilot/stacktrace",function(a,b,c){function i(){}function g(a){for(var b=0;b\s*\(/gm,"{anonymous}()@").split("\n")},firefox:function(a){var b=a.stack;if(!b){e.log(a);return[]}b=b.replace(/(?:\n@:0)?\s+$/m,""),b=b.replace(/^\(/gm,"{anonymous}(");return b.split("\n")},opera:function(a){var b=a.message.split("\n"),c="{anonymous}",d=/Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i,e,f,g;for(e=4,f=0,g=b.length;e0){var h="Possibilities"+(a.length===0?"":" for '"+a+"'");return new f(null,g.INCOMPLETE,h,e)}var h="Can't use '"+a+"'.";return new f(null,g.INVALID,h,e)},j.prototype.fromString=function(a){return a},j.prototype.decrement=function(a){var b=typeof this.data==="function"?this.data():this.data,c;if(a==null)c=b.length-1;else{var d=this.stringify(a),c=b.indexOf(d);c=c===0?b.length-1:c-1}return this.fromString(b[c])},j.prototype.increment=function(a){var b=typeof this.data==="function"?this.data():this.data,c;if(a==null)c=0;else{var d=this.stringify(a),c=b.indexOf(d);c=c===b.length-1?0:c+1}return this.fromString(b[c])},j.prototype.name="selection",b.SelectionType=j;var k=new j({name:"bool",data:["true","false"],stringify:function(a){return""+a},fromString:function(a){return a==="true"?!0:!1}});l.prototype=new e,l.prototype.stringify=function(a){return this.defer().stringify(a)},l.prototype.parse=function(a){return this.defer().parse(a)},l.prototype.decrement=function(a){var b=this.defer();return b.decrement?b.decrement(a):undefined},l.prototype.increment=function(a){var b=this.defer();return b.increment?b.increment(a):undefined},l.prototype.name="deferred",b.DeferredType=l,m.prototype=new e,m.prototype.stringify=function(a){return a.join(" ")},m.prototype.parse=function(a){return this.defer().parse(a)},m.prototype.name="array",b.startup=function(){d.registerType(h),d.registerType(i),d.registerType(k),d.registerType(j),d.registerType(l),d.registerType(m)},b.shutdown=function(){d.unregisterType(h),d.unregisterType(i),d.unregisterType(k),d.unregisterType(j),d.unregisterType(l),d.unregisterType(m)}}),define("pilot/types/command",function(a,b,c){var d=a("pilot/canon"),e=a("pilot/types/basic").SelectionType,f=a("pilot/types"),g=new e({name:"command",data:function(){return d.getCommandNames()},stringify:function(a){return a.name},fromString:function(a){return d.getCommand(a)}});b.startup=function(){f.registerType(g)},b.shutdown=function(){f.unregisterType(g)}}),define("pilot/types/settings",function(a,b,c){var d=a("pilot/types/basic").SelectionType,e=a("pilot/types/basic").DeferredType,f=a("pilot/types"),g=a("pilot/settings").settings,h,i=new d({name:"setting",data:function(){return k.settings.getSettingNames()},stringify:function(a){h=a;return a.name},fromString:function(a){h=g.getSetting(a);return h},noMatch:function(){h=null}}),j=new e({name:"settingValue",defer:function(){return h?h.type:f.getType("text")},getDefault:function(){var a=this.parse("");if(h){var b=h.get();if(a.predictions.length===0)a.predictions.push(b);else{var c=!1;while(!0){var d=a.predictions.indexOf(b);if(d===-1)break;a.predictions.splice(d,1),c=!0}c&&a.predictions.push(b)}}return a}}),k;b.startup=function(a,b){k=a.env,f.registerType(i),f.registerType(j)},b.shutdown=function(a,b){f.unregisterType(i),f.unregisterType(j)}}),define("pilot/types",function(a,b,c){function h(a,b){if(a.substr(-2)==="[]"){var c=a.slice(0,-2);return new g.array(c)}var d=g[a];typeof d==="function"&&(d=new d(b));return d}function f(){}function e(a,b,c,e){this.value=a,this.status=b||d.VALID,this.message=c,this.predictions=e||[]}var d={VALID:{toString:function(){return"VALID"},valueOf:function(){return 0}},INCOMPLETE:{toString:function(){return"INCOMPLETE"},valueOf:function(){return 1}},INVALID:{toString:function(){return"INVALID"},valueOf:function(){return 2}},combine:function(a){var b=d.VALID;for(var c=0;cb&&(b=arguments[c]);return b}};b.Status=d,b.Conversion=e,f.prototype={stringify:function(a){throw new Error("not implemented")},parse:function(a){throw new Error("not implemented")},name:undefined,increment:function(a){return undefined},decrement:function(a){return undefined},getDefault:function(){return this.parse("")}},b.Type=f;var g={};b.registerType=function(a){if(typeof a==="object"){if(!(a instanceof f))throw new Error("Can't registerType using: "+a);if(!a.name)throw new Error("All registered types must have a name");g[a.name]=a}else{if(typeof a!=="function")throw new Error("Unknown type: "+a);if(!a.prototype.name)throw new Error("All registered types must have a name");g[a.prototype.name]=a}},b.deregisterType=function(a){delete g[a.name]},b.getType=function(a){if(typeof a==="string")return h(a);if(typeof a==="object"){if(!a.name)throw new Error("Missing 'name' member to typeSpec");return h(a.name,a)}throw new Error("Can't extract type from "+a)}}),define("pilot/useragent",function(a,b,c){var d=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),e=navigator.userAgent,f=navigator.appVersion;b.isWin=d=="win",b.isMac=d=="mac",b.isLinux=d=="linux",b.isIE=!+" 1",b.isGecko=b.isMozilla=window.controllers&&window.navigator.product==="Gecko",b.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",b.isWebKit=parseFloat(e.split("WebKit/")[1])||undefined,b.isAIR=e.indexOf("AdobeAIR")>=0,b.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},b.getOS=function(){return b.isMac?b.OS.MAC:b.isLinux?b.OS.LINUX:b.OS.WINDOWS}}),define("ace/background_tokenizer",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(a,b){this.running=!1,this.textLines=[],this.lines=[],this.currentLine=0,this.tokenizer=a;var c=this;this.$worker=function(){if(c.running){var a=new Date,d=c.currentLine,e=c.textLines,f=0,g=b.getLastVisibleRow();while(c.currentLine20){c.fireUpdateEvent(d,c.currentLine-1);var h=c.currentLine0&&this.lines[a-1]&&(d=this.lines[a-1].state,e=!0);for(var f=a;f<=b;f++)if(this.lines[f]){var g=this.lines[f];d=g.state,c.push(g)}else{var g=this.tokenizer.getLineTokens(this.textLines[f]||"",d),d=g.state;c.push(g),e&&(this.lines[f]=g)}return c}}).call(f.prototype),b.BackgroundTokenizer=f}),define("ace/commands/default_commands",function(a,b,c){var d=a("pilot/canon");d.addCommand({name:"selectall",exec:function(a,b,c){a.editor.getSelection().selectAll()}}),d.addCommand({name:"removeline",exec:function(a,b,c){a.editor.removeLines()}}),d.addCommand({name:"gotoline",exec:function(a,b,c){var d=parseInt(prompt("Enter line number:"));isNaN(d)||a.editor.gotoLine(d)}}),d.addCommand({name:"togglecomment",exec:function(a,b,c){a.editor.toggleCommentLines()}}),d.addCommand({name:"findnext",exec:function(a,b,c){a.editor.findNext()}}),d.addCommand({name:"findprevious",exec:function(a,b,c){a.editor.findPrevious()}}),d.addCommand({name:"find",exec:function(a,b,c){var d=prompt("Find:");a.editor.find(d)}}),d.addCommand({name:"undo",exec:function(a,b,c){a.editor.undo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"overwrite",exec:function(a,b,c){a.editor.toggleOverwrite()}}),d.addCommand({name:"copylinesup",exec:function(a,b,c){a.editor.copyLinesUp()}}),d.addCommand({name:"movelinesup",exec:function(a,b,c){a.editor.moveLinesUp()}}),d.addCommand({name:"selecttostart",exec:function(a,b,c){a.editor.getSelection().selectFileStart()}}),d.addCommand({name:"gotostart",exec:function(a,b,c){a.editor.navigateFileStart()}}),d.addCommand({name:"selectup",exec:function(a,b,c){a.editor.getSelection().selectUp()}}),d.addCommand({name:"golineup",exec:function(a,b,c){a.editor.navigateUp()}}),d.addCommand({name:"copylinesdown",exec:function(a,b,c){a.editor.copyLinesDown()}}),d.addCommand({name:"movelinesdown",exec:function(a,b,c){a.editor.moveLinesDown()}}),d.addCommand({name:"selecttoend",exec:function(a,b,c){a.editor.getSelection().selectFileEnd()}}),d.addCommand({name:"gotoend",exec:function(a,b,c){a.editor.navigateFileEnd()}}),d.addCommand({name:"selectdown",exec:function(a,b,c){a.editor.getSelection().selectDown()}}),d.addCommand({name:"godown",exec:function(a,b,c){a.editor.navigateDown()}}),d.addCommand({name:"selectwordleft",exec:function(a,b,c){a.editor.getSelection().selectWordLeft()}}),d.addCommand({name:"gotowordleft",exec:function(a,b,c){a.editor.navigateWordLeft()}}),d.addCommand({name:"selecttolinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectleft",exec:function(a,b,c){a.editor.getSelection().selectLeft()}}),d.addCommand({name:"gotoleft",exec:function(a,b,c){a.editor.navigateLeft()}}),d.addCommand({name:"selectwordright",exec:function(a,b,c){a.editor.getSelection().selectWordRight()}}),d.addCommand({name:"gotowordright",exec:function(a,b,c){a.editor.navigateWordRight()}}),d.addCommand({name:"selecttolineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"selectright",exec:function(a,b,c){a.editor.getSelection().selectRight()}}),d.addCommand({name:"gotoright",exec:function(a,b,c){a.editor.navigateRight()}}),d.addCommand({name:"selectpagedown",exec:function(a,b,c){a.editor.selectPageDown()}}),d.addCommand({name:"pagedown",exec:function(a,b,c){a.editor.scrollPageDown()}}),d.addCommand({name:"gotopagedown",exec:function(a,b,c){a.editor.gotoPageDown()}}),d.addCommand({name:"selectpageup",exec:function(a,b,c){a.editor.selectPageUp()}}),d.addCommand({name:"pageup",exec:function(a,b,c){a.editor.scrollPageUp()}}),d.addCommand({name:"gotopageup",exec:function(a,b,c){a.editor.gotoPageUp()}}),d.addCommand({name:"selectlinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectlineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"del",exec:function(a,b,c){a.editor.removeRight()}}),d.addCommand({name:"backspace",exec:function(a,b,c){a.editor.removeLeft()}}),d.addCommand({name:"outdent",exec:function(a,b,c){a.editor.blockOutdent()}}),d.addCommand({name:"indent",exec:function(a,b,c){a.editor.indent()}})}),define("ace/conf/keybindings/default_mac",function(a,b,c){b.bindings={selectall:"Command-A",removeline:"Command-D",gotoline:"Command-L",togglecomment:"Command-7",findnext:"Command-K",findprevious:"Command-Shift-K",find:"Command-F",replace:"Command-R",undo:"Command-Z",redo:"Command-Shift-Z|Command-Y",overwrite:"Insert",copylinesup:"Command-Option-Up",movelinesup:"Option-Up",selecttostart:"Command-Shift-Up",gotostart:"Command-Home|Command-Up",selectup:"Shift-Up",golineup:"Up",copylinesdown:"Command-Option-Down",movelinesdown:"Option-Down",selecttoend:"Command-Shift-Down",gotoend:"Command-End|Command-Down",selectdown:"Shift-Down",godown:"Down",selectwordleft:"Option-Shift-Left",gotowordleft:"Option-Left",selecttolinestart:"Command-Shift-Left",gotolinestart:"Command-Left|Home",selectleft:"Shift-Left",gotoleft:"Left",selectwordright:"Option-Shift-Right",gotowordright:"Option-Right",selecttolineend:"Command-Shift-Right",gotolineend:"Command-Right|End",selectright:"Shift-Right",gotoright:"Right",selectpagedown:"Shift-PageDown",pagedown:"PageDown",selectpageup:"Shift-PageUp",pageup:"PageUp",selectlinestart:"Shift-Home",selectlineend:"Shift-End",del:"Delete",backspace:"Ctrl-Backspace|Command-Backspace|Option-Backspace|Backspace",outdent:"Shift-Tab",indent:"Tab"}}),define("ace/conf/keybindings/default_win",function(a,b,c){b.bindings={selectall:"Ctrl-A",removeline:"Ctrl-D",gotoline:"Ctrl-L",togglecomment:"Ctrl-7",findnext:"Ctrl-K",findprevious:"Ctrl-Shift-K",find:"Ctrl-F",replace:"Ctrl-R",undo:"Ctrl-Z",redo:"Ctrl-Shift-Z|Ctrl-Y",overwrite:"Insert",copylinesup:"Ctrl-Alt-Up",movelinesup:"Alt-Up",selecttostart:"Alt-Shift-Up",gotostart:"Ctrl-Home|Ctrl-Up",selectup:"Shift-Up",golineup:"Up",copylinesdown:"Ctrl-Alt-Down",movelinesdown:"Alt-Down",selecttoend:"Alt-Shift-Down",gotoend:"Ctrl-End|Ctrl-Down",selectdown:"Shift-Down",godown:"Down",selectwordleft:"Ctrl-Shift-Left",gotowordleft:"Ctrl-Left",selecttolinestart:"Alt-Shift-Left",gotolinestart:"Alt-Left|Home",selectleft:"Shift-Left",gotoleft:"Left",selectwordright:"Ctrl-Shift-Right",gotowordright:"Ctrl-Right",selecttolineend:"Alt-Shift-Right",gotolineend:"Alt-Right|End",selectright:"Shift-Right",gotoright:"Right",selectpagedown:"Shift-PageDown",pagedown:"PageDown",selectpageup:"Shift-PageUp",pageup:"PageUp",selectlinestart:"Shift-Home",selectlineend:"Shift-End",del:"Delete",backspace:"Backspace",outdent:"Shift-Tab",indent:"Tab"}}),define("ace/document",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("pilot/event_emitter").EventEmitter,g=a("ace/selection").Selection,h=a("ace/mode/text").Mode,i=a("ace/range").Range,j=function(a,b){this.modified=!0,this.lines=[],this.selection=new g(this),this.$breakpoints=[],this.listeners=[],b&&this.setMode(b),Array.isArray(a)?this.$insertLines(0,a):this.$insert({row:0,column:0},a)};(function(){d.implement(this,f),this.$undoManager=null,this.$split=function(a){return a.split(/\r\n|\r|\n/)},this.setValue=function(a){var b=[0,this.lines.length];b.push.apply(b,this.$split(a)),this.lines.splice.apply(this.lines,b),this.modified=!0,this.fireChangeEvent(0)},this.toString=function(){return this.lines.join(this.$getNewLineCharacter())},this.getSelection=function(){return this.selection},this.fireChangeEvent=function(a,b){var c={firstRow:a,lastRow:b};this._dispatchEvent("change",{data:c})},this.setUndoManager=function(a){this.$undoManager=a,this.$deltas=[],this.$informUndoManager&&this.$informUndoManager.cancel();if(a){var b=this;this.$informUndoManager=e.deferredCall(function(){b.$deltas.length>0&&a.execute({action:"aceupdate",args:[b.$deltas,b]}),b.$deltas=[]})}},this.$defaultUndoManager={undo:function(){},redo:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?e.stringRepeat(" ",this.getTabSize()):"\t"},this.$useSoftTabs=!0,this.setUseSoftTabs=function(a){this.$useSoftTabs!==a&&(this.$useSoftTabs=a)},this.getUseSoftTabs=function(){return this.$useSoftTabs},this.$tabSize=4,this.setTabSize=function(a){!isNaN(a)&&this.$tabSize!==a&&(this.modified=!0,this.$tabSize=a,this._dispatchEvent("changeTabSize"))},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(a){return this.$useSoftTabs&&a.column%this.$tabSize==0},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(a){this.$breakpoints=[];for(var b=0;b0&&(d=!!c.charAt(b-1).match(this.tokenRe)),d||(d=!!c.charAt(b).match(this.tokenRe));var e=d?this.tokenRe:this.nonTokenRe,f=b;if(f>0){do f--;while(f>=0&&c.charAt(f).match(e));f++}var g=b;while(g=0){var h=g.charAt(d);if(h==c){f-=1;if(f==0)return{row:e,column:d}}else h==a&&(f+=1);d-=1}e-=1;if(e<0)break;var g=this.getLine(e),d=g.length-1}return null},this.$findClosingBracket=function(a,b){var c=this.$brackets[a],d=b.column,e=b.row,f=1,g=this.getLine(e),h=this.getLength();while(!0){while(d=h)break;var g=this.getLine(e),d=0}return null},this.insert=function(a,b,c){var d=this.$insert(a,b,c);this.fireChangeEvent(a.row,a.row==d.row?a.row:undefined);return d},this.$insertLines=function(a,b,c){if(b.length!=0){var d=[a,0];d.push.apply(d,b),this.lines.splice.apply(this.lines,d);if(!c&&this.$undoManager){var e=this.$getNewLineCharacter();this.$deltas.push({action:"insertText",range:new i(a,0,a+b.length,0),text:b.join(e)+e}),this.$informUndoManager.schedule()}}},this.$insert=function(a,b,c){if(b.length==0)return a;this.modified=!0,this.lines.length<=1&&this.$detectNewLine(b);var d=this.$split(b);if(this.$isNewLine(b)){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column),this.lines.splice(a.row+1,0,e.substring(a.column));var f={row:a.row+1,column:0}}else if(d.length==1){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column)+b+e.substring(a.column);var f={row:a.row,column:a.column+b.length}}else{var e=this.lines[a.row]||"",g=e.substring(0,a.column)+d[0],h=d[d.length-1]+e.substring(a.column);this.lines[a.row]=g,this.$insertLines(a.row+1,[h],!0),d.length>2&&this.$insertLines(a.row+1,d.slice(1,-1),!0);var f={row:a.row+d.length-1,column:d[d.length-1].length}}!c&&this.$undoManager&&(this.$deltas.push({action:"insertText",range:i.fromPoints(a,f),text:b}),this.$informUndoManager.schedule());return f},this.$isNewLine=function(a){return a=="\r\n"||a=="\r"||a=="\n"},this.remove=function(a,b){if(a.isEmpty())return a.start;this.$remove(a,b),this.fireChangeEvent(a.start.row,a.isMultiLine()?undefined:a.start.row);return a.start},this.$remove=function(a,b){if(!a.isEmpty()){if(!b&&this.$undoManager){var c=this.$getNewLineCharacter();this.$deltas.push({action:"removeText",range:a.clone(),text:this.getTextRange(a)}),this.$informUndoManager.schedule()}this.modified=!0;var d=a.start.row,e=a.end.row,f=this.getLine(d).substring(0,a.start.column)+this.getLine(e).substring(a.end.column);f!=""?this.lines.splice(d,e-d+1,f):this.lines.splice(d,e-d+1,"");return a.start}},this.undoChanges=function(a){this.selection.clearSelection();for(var b=a.length-1;b>=0;b--){var c=a[b];c.action=="insertText"?(this.remove(c.range,!0),this.selection.moveCursorToPosition(c.range.start)):(this.insert(c.range.start,c.text,!0),this.selection.clearSelection())}},this.redoChanges=function(a){this.selection.clearSelection();for(var b=0;b=this.lines.length-1)return 0;var c=this.lines.slice(a,b+1);this.$remove(new i(a,0,b+1,0)),this.$insertLines(a+1,c),this.fireChangeEvent(a,b+1);return 1},this.duplicateLines=function(a,b){var a=this.$clipRowToDocument(a),b=this.$clipRowToDocument(b),c=this.getLines(a,b);this.$insertLines(a,c);var d=b-a+1;this.fireChangeEvent(a);return d},this.$clipRowToDocument=function(a){return Math.max(0,Math.min(a,this.lines.length-1))},this.documentToScreenColumn=function(a,b){var c=this.getTabSize(),d=0,e=b,f=this.getLine(a).split("\t");for(var g=0;gh)e-=h+1,d+=h+c;else{d+=e;break}}return d},this.screenToDocumentColumn=function(a,b){var c=this.getTabSize(),d=0,e=b,f=this.getLine(a).split("\t");for(var g=0;gh){d+=h;break}d+=e;break}e-=h+c,d+=h+1}return d}}).call(j.prototype),b.Document=j}),define("ace/editor",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event"),f=a("pilot/lang"),g=a("ace/textinput").TextInput,h=a("ace/keybinding").KeyBinding,i=a("ace/document").Document,j=a("ace/search").Search,k=a("ace/background_tokenizer").BackgroundTokenizer,l=a("ace/range").Range,m=a("pilot/event_emitter").EventEmitter,n=function(a,b){var c=a.getContainerElement();this.container=c,this.renderer=a,this.textInput=new g(c,this),this.keyBinding=new h(c,this);var d=this;e.addListener(c,"mousedown",function(a){setTimeout(function(){d.focus()});return e.preventDefault(a)}),e.addListener(c,"selectstart",function(a){return e.preventDefault(a)});var f=a.getMouseEventTarget();e.addListener(f,"mousedown",this.onMouseDown.bind(this)),e.addMultiMouseDownListener(f,0,2,500,this.onMouseDoubleClick.bind(this)),e.addMultiMouseDownListener(f,0,3,600,this.onMouseTripleClick.bind(this)),e.addMouseWheelListener(f,this.onMouseWheel.bind(this)),this.$selectionMarker=null,this.$highlightLineMarker=null,this.$blockScrolling=!1,this.$search=(new j).set({wrap:!0}),this.setDocument(b||new i("")),this.focus()};(function(){d.implement(this,m),this.$forwardEvents={gutterclick:1,gutterdblclick:1},this.$originalAddEventListener=this.addEventListener,this.$originalRemoveEventListener=this.removeEventListener,this.addEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.addEventListener(a,b):this.$originalAddEventListener(a,b)},this.removeEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.removeEventListener(a,b):this.$originalRemoveEventListener(a,b)},this.setDocument=function(a){if(this.doc!=a){if(this.doc){this.doc.removeEventListener("change",this.$onDocumentChange),this.doc.removeEventListener("changeMode",this.$onDocumentModeChange),this.doc.removeEventListener("changeTabSize",this.$onDocumentChangeTabSize),this.doc.removeEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint);var b=this.doc.getSelection();b.removeEventListener("changeCursor",this.$onCursorChange),b.removeEventListener("changeSelection",this.$onSelectionChange),this.doc.setScrollTopRow(this.renderer.getScrollTopRow())}this.doc=a,this.$onDocumentChange=this.onDocumentChange.bind(this),a.addEventListener("change",this.$onDocumentChange),this.renderer.setDocument(a),this.$onDocumentModeChange=this.onDocumentModeChange.bind(this),a.addEventListener("changeMode",this.$onDocumentModeChange),this.$onDocumentChangeTabSize=this.renderer.updateText.bind(this.renderer),a.addEventListener("changeTabSize",this.$onDocumentChangeTabSize),this.$onDocumentChangeBreakpoint=this.onDocumentChangeBreakpoint.bind(this),this.doc.addEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint),this.selection=a.getSelection(),this.$desiredColumn=0,this.$onCursorChange=this.onCursorChange.bind(this),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onDocumentModeChange(),this.bgTokenizer.setLines(this.doc.lines),this.bgTokenizer.start(0),this.onCursorChange(),this.onSelectionChange(),this.onDocumentChangeBreakpoint(),this.renderer.scrollToRow(a.getScrollTopRow()),this.renderer.updateFull()}},this.getDocument=function(){return this.doc},this.getSelection=function(){return this.selection},this.resize=function(){this.renderer.onResize()},this.setTheme=function(a){this.renderer.setTheme(a)},this.$highlightBrackets=function(){this.$bracketHighlight&&(this.renderer.removeMarker(this.$bracketHighlight),this.$bracketHighlight=null);if(!this.$highlightPending){var a=this;this.$highlightPending=!0,setTimeout(function(){a.$highlightPending=!1;var b=a.doc.findMatchingBracket(a.getCursorPosition());if(b){var c=new l(b.row,b.column,b.row,b.column+1);a.$bracketHighlight=a.renderer.addMarker(c,"ace_bracket")}},10)}},this.focus=function(){this.textInput.focus()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){this.renderer.showCursor(),this.renderer.visualizeFocus()},this.onBlur=function(){this.renderer.hideCursor(),this.renderer.visualizeBlur()},this.onDocumentChange=function(a){var b=a.data;this.bgTokenizer.start(b.firstRow),this.renderer.updateLines(b.firstRow,b.lastRow),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite)},this.onTokenizerUpdate=function(a){var b=a.data;this.renderer.updateLines(b.first,b.last)},this.onCursorChange=function(){this.$highlightBrackets(),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$updateHighlightActiveLine()},this.$updateHighlightActiveLine=function(){this.$highlightLineMarker&&this.renderer.removeMarker(this.$highlightLineMarker),this.$highlightLineMarker=null;if(this.getHighlightActiveLine()&&(this.getSelectionStyle()!="line"||!this.selection.isMultiLine())){var a=this.getCursorPosition(),b=new l(a.row,0,a.row+1,0);this.$highlightLineMarker=this.renderer.addMarker(b,"ace_active_line","line")}},this.onSelectionChange=function(){this.$selectionMarker&&this.renderer.removeMarker(this.$selectionMarker),this.$selectionMarker=null;if(!this.selection.isEmpty()){var a=this.selection.getRange(),b=this.getSelectionStyle();this.$selectionMarker=this.renderer.addMarker(a,"ace_selection",b)}this.onCursorChange()},this.onDocumentChangeBreakpoint=function(){this.renderer.setBreakpoints(this.doc.getBreakpoints())},this.onDocumentModeChange=function(){var a=this.doc.getMode();if(this.mode!=a){this.mode=a;var b=a.getTokenizer();if(this.bgTokenizer)this.bgTokenizer.setTokenizer(b);else{var c=this.onTokenizerUpdate.bind(this);this.bgTokenizer=new k(b,this),this.bgTokenizer.addEventListener("update",c)}this.renderer.setTokenizer(this.bgTokenizer)}},this.onMouseDown=function(a){var b=e.getDocumentX(a),c=e.getDocumentY(a),d=this.renderer.screenToTextCoordinates(b,c);d.row=Math.max(0,Math.min(d.row,this.doc.getLength()-1));if(e.getButton(a)!=0)this.selection.isEmpty()&&this.moveCursorToPosition(d);else{a.shiftKey?this.selection.selectToPosition(d):(this.moveCursorToPosition(d),this.$clickSelection||this.selection.clearSelection(d.row,d.column)),this.renderer.scrollCursorIntoView();var f=this,g,h,i=function(a){g=e.getDocumentX(a),h=e.getDocumentY(a)},j=function(){clearInterval(l),f.$clickSelection=null},k=function(){if(g!==undefined&&h!==undefined){var a=f.renderer.screenToTextCoordinates(g,h);a.row=Math.max(0,Math.min(a.row,f.doc.getLength()-1));if(f.$clickSelection)if(f.$clickSelection.contains(a.row,a.column))f.selection.setSelectionRange(f.$clickSelection);else{if(f.$clickSelection.compare(a.row,a.column)==-1)var b=f.$clickSelection.end;else var b=f.$clickSelection.start;f.selection.setSelectionAnchor(b.row,b.column),f.selection.selectToPosition(a)}else f.selection.selectToPosition(a);f.renderer.scrollCursorIntoView()}};e.capture(this.container,i,j);var l=setInterval(k,20);return e.preventDefault(a)}},this.onMouseDoubleClick=function(a){this.selection.selectWord(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},this.onMouseTripleClick=function(a){this.selection.selectLine(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},this.onMouseWheel=function(a){var b=this.$scrollSpeed*2;this.renderer.scrollBy(a.wheelX*b,a.wheelY*b);return e.preventDefault(a)},this.getCopyText=function(){return this.selection.isEmpty()?"":this.doc.getTextRange(this.getSelectionRange())},this.onCut=function(){this.$readOnly||(this.selection.isEmpty()||(this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection()))},this.onTextInput=function(a){if(!this.$readOnly){var b=this.getCursorPosition();a=a.replace("\t",this.doc.getTabString());if(this.selection.isEmpty()){if(this.$overwrite){var c=new l.fromPoints(b,b);c.end.column+=a.length,this.doc.remove(c)}}else{var b=this.doc.remove(this.getSelectionRange());this.clearSelection()}this.clearSelection();var d=this;this.bgTokenizer.getState(b.row,function(c){var e=d.mode.checkOutdent(c,d.doc.getLine(b.row),a),f=d.doc.getLine(b.row),g=d.mode.getNextLineIndent(c,f.slice(0,b.column),d.doc.getTabString()),h=d.doc.insert(b,a);d.bgTokenizer.getState(b.row,function(a){if(b.row!==h.row){var c=d.doc.getTabSize(),i=Number.MAX_VALUE;for(var j=b.row+1;j<=h.row;++j){var k=0;f=d.doc.getLine(j);for(var m=0;m0;++m)f.charAt(m)=="\t"?n-=c:f.charAt(m)==" "&&(n-=1);d.doc.replace(new l(j,0,j,f.length),f.substr(m))}h.column+=d.doc.indentRows(b.row+1,h.row,g)}else e&&(h.column+=d.mode.autoOutdent(a,d.doc,b.row));d.moveCursorToPosition(h),d.renderer.scrollCursorIntoView()})})}},this.$overwrite=!1,this.setOverwrite=function(a){this.$overwrite!=a&&(this.$overwrite=a,this.$blockScrolling=!0,this.onCursorChange(),this.$blockScrolling=!1,this._dispatchEvent("changeOverwrite",{data:a}))},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.$scrollSpeed=1,this.setScrollSpeed=function(a){this.$scrollSpeed=a},this.getScrollSpeed=function(){return this.$scrollSpeed},this.$selectionStyle="line",this.setSelectionStyle=function(a){this.$selectionStyle!=a&&(this.$selectionStyle=a,this.onSelectionChange(),this._dispatchEvent("changeSelectionStyle",{data:a}))},this.getSelectionStyle=function(){return this.$selectionStyle},this.$highlightActiveLine=!0,this.setHighlightActiveLine=function(a){this.$highlightActiveLine!=a&&(this.$highlightActiveLine=a,this.$updateHighlightActiveLine())},this.getHighlightActiveLine=function(){return this.$highlightActiveLine},this.setShowInvisibles=function(a){this.getShowInvisibles()!=a&&this.renderer.setShowInvisibles(a)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setShowPrintMargin=function(a){this.renderer.setShowPrintMargin(a)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(a){this.renderer.setPrintMarginColumn(a)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.$readOnly=!1,this.setReadOnly=function(a){this.$readOnly=a},this.getReadOnly=function(){return this.$readOnly},this.removeRight=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectRight(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.removeLeft=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectLeft(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.indent=function(){if(!this.$readOnly){var a=this.doc,b=this.getSelectionRange();if(b.start.row>=b.end.row&&b.start.column>=b.end.column){var e;if(this.doc.getUseSoftTabs()){var g=a.getTabSize(),h=this.getCursorPosition(),i=a.documentToScreenColumn(h.row,h.column),d=g-i%g;e=f.stringRepeat(" ",d)}else e="\t";return this.onTextInput(e)}var c=this.$getSelectedRows(),d=a.indentRows(c.first,c.last,"\t");this.selection.shiftSelection(d)}},this.blockOutdent=function(){if(!this.$readOnly){var a=this.doc.getSelection(),b=this.doc.outdentRows(a.getRange());a.setSelectionRange(b,a.isBackwards()),this.$updateDesiredColumn()}},this.toggleCommentLines=function(){if(!this.$readOnly){var a=this;this.bgTokenizer.getState(this.getCursorPosition().row,function(b){var c=a.$getSelectedRows(),d=a.mode.toggleCommentLines(b,a.doc,c.first,c.last);a.selection.shiftSelection(d)})}},this.removeLines=function(){if(!this.$readOnly){var a=this.$getSelectedRows();this.selection.setSelectionAnchor(a.last+1,0),this.selection.selectTo(a.first,0),this.doc.remove(this.getSelectionRange()),this.clearSelection()}},this.moveLinesDown=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.moveLinesDown(a,b)})},this.moveLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.moveLinesUp(a,b)})},this.copyLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){this.doc.duplicateLines(a,b);return 0})},this.copyLinesDown=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.duplicateLines(a,b)})},this.$moveLines=function(a){var b=this.$getSelectedRows(),c=a.call(this,b.first,b.last),d=this.selection;d.setSelectionAnchor(b.last+c+1,0),d.$moveSelection(function(){d.moveCursorTo(b.first+c,0)})},this.$getSelectedRows=function(){var a=this.getSelectionRange().collapseRows();return{first:a.start.row,last:a.end.row}},this.onCompositionStart=function(a){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(a){this.renderer.setCompositionText(a)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(a){return a>=this.getFirstVisibleRow()&&a<=this.getLastVisibleRow()},this.getVisibleRowCount=function(){return this.getLastVisibleRow()-this.getFirstVisibleRow()+1},this.getPageDownRow=function(){return this.renderer.getLastVisibleRow()-1},this.getPageUpRow=function(){var a=this.renderer.getFirstVisibleRow(),b=this.renderer.getLastVisibleRow();return a-(b-a)+1},this.selectPageDown=function(){var a=this.getPageDownRow()+Math.floor(this.getVisibleRowCount()/2);this.scrollPageDown();var b=this.getSelection();b.$moveSelection(function(){b.moveCursorTo(a,b.getSelectionLead().column)})},this.selectPageUp=function(){var a=this.getLastVisibleRow()-this.getFirstVisibleRow(),b=this.getPageUpRow()+Math.round(a/2);this.scrollPageUp();var c=this.getSelection();c.$moveSelection(function(){c.moveCursorTo(b,c.getSelectionLead().column)})},this.gotoPageDown=function(){var a=this.getPageDownRow(),b=Math.min(this.getCursorPosition().column,this.doc.getLine(a).length);this.scrollToRow(a),this.getSelection().moveCursorTo(a,b)},this.gotoPageUp=function(){var a=this.getPageUpRow(),b=Math.min(this.getCursorPosition().column,this.doc.getLine(a).length);this.scrollToRow(a),this.getSelection().moveCursorTo(a,b)},this.scrollPageDown=function(){this.scrollToRow(this.getPageDownRow())},this.scrollPageUp=function(){this.renderer.scrollToRow(this.getPageUpRow())},this.scrollToRow=function(a){this.renderer.scrollToRow(a)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getSelectionRange=function(){return this.selection.getRange()},this.clearSelection=function(){this.selection.clearSelection(),this.$updateDesiredColumn()},this.moveCursorTo=function(a,b){this.selection.moveCursorTo(a,b),this.$updateDesiredColumn()},this.moveCursorToPosition=function(a){this.selection.moveCursorToPosition(a),this.$updateDesiredColumn()},this.gotoLine=function(a,b){this.selection.clearSelection(),this.$blockScrolling=!0,this.moveCursorTo(a-1,b||0),this.$blockScrolling=!1,this.isRowVisible(this.getCursorPosition().row)||this.scrollToRow(a-1-Math.floor(this.getVisibleRowCount()/2))},this.navigateTo=function(a,b){this.clearSelection(),this.moveCursorTo(a,b),this.$updateDesiredColumn(b)},this.navigateUp=function(){this.selection.clearSelection(),this.selection.moveCursorBy(-1,0);if(this.$desiredColumn){var a=this.getCursorPosition(),b=this.doc.screenToDocumentColumn(a.row,this.$desiredColumn);this.selection.moveCursorTo(a.row,b)}},this.navigateDown=function(){this.selection.clearSelection(),this.selection.moveCursorBy(1,0);if(this.$desiredColumn){var a=this.getCursorPosition(),b=this.doc.screenToDocumentColumn(a.row,this.$desiredColumn);this.selection.moveCursorTo(a.row,b)}},this.$updateDesiredColumn=function(){var a=this.getCursorPosition();this.$desiredColumn=this.doc.documentToScreenColumn(a.row,a.column)},this.navigateLeft=function(){if(this.selection.isEmpty())this.selection.moveCursorLeft();else{var a=this.getSelectionRange().start;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateRight=function(){if(this.selection.isEmpty())this.selection.moveCursorRight();else{var a=this.getSelectionRange().end;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(a,b){b&&this.$search.set(b);var c=this.$search.find(this.doc);this.$tryReplace(c,a),c!==null&&this.selection.setSelectionRange(c),this.$updateDesiredColumn()},this.replaceAll=function(a,b){b&&this.$search.set(b);var c=this.$search.findAll(this.doc);if(c.length){this.clearSelection(),this.selection.moveCursorTo(0,0);for(var d=c.length-1;d>=0;--d)this.$tryReplace(c[d],a);c[0]!==null&&this.selection.setSelectionRange(c[0]),this.$updateDesiredColumn()}},this.$tryReplace=function(a,b){var c=this.doc.getTextRange(a),b=this.$search.replace(c,b);if(b!==null){a.end=this.doc.replace(a,b);return a}return null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(a,b){this.clearSelection(),b=b||{},b.needle=a,this.$search.set(b),this.$find()},this.findNext=function(a){a=a||{},typeof a.backwards=="undefined"&&(a.backwards=!1),this.$search.set(a),this.$find()},this.findPrevious=function(a){a=a||{},typeof a.backwards=="undefined"&&(a.backwards=!0),this.$search.set(a),this.$find()},this.$find=function(a){this.selection.isEmpty()||this.$search.set({needle:this.doc.getTextRange(this.getSelectionRange())}),typeof a!="undefined"&&this.$search.set({backwards:a});var b=this.$search.find(this.doc);b&&(this.gotoLine(b.end.row+1,b.end.column),this.$updateDesiredColumn(),this.selection.setSelectionRange(b))},this.undo=function(){this.doc.getUndoManager().undo()},this.redo=function(){this.doc.getUndoManager().redo()}}).call(n.prototype),b.Editor=n}),define("ace/keybinding",function(a,b,c){var d=a("pilot/useragent"),e=a("pilot/event"),f=a("ace/conf/keybindings/default_mac").bindings,g=a("ace/conf/keybindings/default_win").bindings,h=a("pilot/canon");a("ace/commands/default_commands");var i=function(a,b,c){this.setConfig(c);var f=this;e.addKeyListener(a,function(a){if(d.isOpera&&d.isMac)var c=0|(a.metaKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.ctrlKey?8:0);else var c=0|(a.ctrlKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.metaKey?8:0);var g=f.keyNames[a.keyCode],i=(f.config.reverse[c]||{})[(g||String.fromCharCode(a.keyCode)).toLowerCase()],j=h.exec(i,{editor:b});if(j)return e.stopEvent(a)})};(function(){function c(a,c){var d,e,f,g,h={};for(d in a){g=a[d];if(c&&typeof g=="string"){g=g.split(c);for(e=0,f=g.length;e",c+1,""),b.push("");this.element.innerHTML=b.join(""),this.element.style.height=a.minHeight+"px"}}).call(d.prototype),b.Gutter=d}),define("ace/layer/marker",function(a,b,c){var d=a("ace/range").Range,e=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_marker-layer",a.appendChild(this.element),this.markers={},this.$markerId=1};(function(){this.setDocument=function(a){this.doc=a},this.addMarker=function(a,b,c){var d=this.$markerId++;this.markers[d]={range:a,type:c||"line",clazz:b};return d},this.removeMarker=function(a){var b=this.markers[a];b&&delete this.markers[a]},this.update=function(a){var a=a||this.config;if(a){this.config=a;var b=[];for(var c in this.markers){var d=this.markers[c],e=d.range.clipRows(a.firstRow,a.lastRow);if(e.isEmpty())continue;e.isMultiLine()?d.type=="text"?this.drawTextMarker(b,e,d.clazz,a):this.drawMultiLineMarker(b,e,d.clazz,a):this.drawSingleLineMarker(b,e,d.clazz,a)}this.element.innerHTML=b.join("")}},this.drawTextMarker=function(a,b,c,e){var f=b.start.row,g=new d(f,b.start.column,f,this.doc.getLine(f).length);this.drawSingleLineMarker(a,g,c,e);var f=b.end.row,g=new d(f,0,f,b.end.column);this.drawSingleLineMarker(a,g,c,e);for(var f=b.start.row+1;f");var g=(b.end.row-d.firstRow)*d.lineHeight,f=Math.round(b.end.column*d.characterWidth);a.push("
");var e=(b.end.row-b.start.row-1)*d.lineHeight;if(e>=0){var g=(b.start.row+1-d.firstRow)*d.lineHeight;a.push("
")}},this.drawSingleLineMarker=function(a,b,c,d){var b=b.toScreenRange(this.doc),e=d.lineHeight,f=Math.round((b.end.column-b.start.column)*d.characterWidth),g=(b.start.row-d.firstRow)*d.lineHeight,h=Math.round(b.start.column*d.characterWidth);a.push("
")}}).call(e.prototype),b.Marker=e}),define("ace/layer/text",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/dom"),f=a("pilot/lang"),g=a("pilot/event_emitter").EventEmitter,h=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_text-layer",a.appendChild(this.element),this.$characterSize=this.$measureSizes(),this.$pollSizeChanges()};(function(){d.implement(this,g),this.EOF_CHAR="¶",this.EOL_CHAR="¬",this.TAB_CHAR="→",this.SPACE_CHAR="·",this.setTokenizer=function(a){this.tokenizer=a},this.getLineHeight=function(){return this.$characterSize.height||1},this.getCharacterWidth=function(){return this.$characterSize.width||1},this.$pollSizeChanges=function(){var a=this;setInterval(function(){var b=a.$measureSizes();if(a.$characterSize.width!==b.width||a.$characterSize.height!==b.height)a.$characterSize=b,a._dispatchEvent("changeCharaterSize",{data:b})},500)},this.$fontStyles={fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},this.$measureSizes=function(){var a=1e3;if(!this.$measureNode){var b=this.$measureNode=document.createElement("div"),c=b.style;c.width=c.height="auto",c.left=c.top="-1000px",c.visibility="hidden",c.position="absolute",c.overflow="visible",c.whiteSpace="nowrap",b.innerHTML=f.stringRepeat("Xy",a),document.body.insertBefore(b,document.body.firstChild)}var c=this.$measureNode.style;for(var d in this.$fontStyles){var g=e.computedStyle(this.element,d);c[d]=g}var h={height:this.$measureNode.offsetHeight,width:this.$measureNode.offsetWidth/(a*2)};return h},this.setDocument=function(a){this.doc=a},this.$showInvisibles=!1,this.setShowInvisibles=function(a){this.$showInvisibles=a},this.$computeTabString=function(){var a=this.doc.getTabSize();if(this.$showInvisibles){var b=a/2;this.$tabString=""+Array(Math.floor(b)).join(" ")+this.TAB_CHAR+Array(Math.ceil(b)+1).join(" ")+""}else this.$tabString=Array(a+1).join(" ")},this.updateLines=function(a,b,c){this.$computeTabString(),this.config=a;var d=Math.max(b,a.firstRow),e=Math.min(c,a.lastRow),f=this.element.childNodes,g=this;this.tokenizer.getTokens(d,e,function(b){for(var c=d;c<=e;c++){var h=f[c-a.firstRow];if(!h)continue;var i=[];g.$renderLine(i,c,b[c-d].tokens),h.innerHTML=i.join("")}})},this.scrollLines=function(a){function g(){a.lastRow>c.lastRow&&b.$renderLinesFragment(a,c.lastRow+1,a.lastRow,function(a){d.appendChild(a)})}function f(e){a.firstRowa.lastRow)for(var e=a.lastRow+1;e<=c.lastRow;e++)d.removeChild(d.lastChild);f(g)},this.$renderLinesFragment=function(a,b,c,d){var e=document.createDocumentFragment(),f=this;this.tokenizer.getTokens(b,c,function(g){for(var h=b;h<=c;h++){var i=document.createElement("div");i.className="ace_line";var j=i.style;j.height=f.$characterSize.height+"px",j.width=a.width+"px";var k=[];f.$renderLine(k,h,g[h-b].tokens),i.innerHTML=k.join(""),e.appendChild(i)}d(e)})},this.update=function(a){this.$computeTabString(),this.config=a;var b=[],c=this;this.tokenizer.getTokens(a.firstRow,a.lastRow,function(d){for(var e=a.firstRow;e<=a.lastRow;e++)b.push("
"),c.$renderLine(b,e,d[e-a.firstRow].tokens),b.push("
");c.element.innerHTML=b.join("")})},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderLine=function(a,b,c){var d=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g,e=" ";for(var f=0;f",h,"")}}this.$showInvisibles&&(b!==this.doc.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+""))}}).call(h.prototype),b.Text=h}),define("ace/range",function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compare=function(a,b){if(!this.isMultiLine())if(a===this.start.row)return bthis.end.column?1:0;if(athis.end.row)return 1;if(this.start.row===a)return b>=this.start.column?0:-1;if(this.end.row===a)return b<=this.end.column?0:1;return 0},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.row=0;h--){var i=g[h],j=c.$rangeFromMatch(f,i.offset,i.str.length);if(d(j))return!0}})}}},this.$rangeFromMatch=function(a,b,c){return new f(a,b,a,b+c)},this.$assembleRegExp=function(){if(this.$options.regExp)var a=this.$options.needle;else a=d.escapeRegExp(this.$options.needle);this.$options.wholeWord&&(a="\\b"+a+"\\b");var b="g";this.$options.caseSensitive||(b+="i");var c=new RegExp(a,b);return c},this.$forwardLineIterator=function(a){function j(d){var e=a.getLine(d);b&&d==c.end.row&&(e=e.substring(0,c.end.column));return e}var b=this.$options.scope==g.SELECTION,c=a.getSelection().getRange(),d=a.getSelection().getCursor(),e=b?c.start.row:0,f=b?c.start.column:0,h=b?c.end.row:a.getLength()-1,i=this.$options.wrap;return{forEach:function(a){var b=d.row,c=j(b),g=d.column,k=!1;while(!a(c,g,b)){if(k)return;b++,g=0;if(b>h)if(i)b=e,g=f;else return;b==d.row&&(k=!0),c=j(b)}}}},this.$backwardLineIterator=function(a){var b=this.$options.scope==g.SELECTION,c=a.getSelection().getRange(),d=b?c.end:c.start,e=b?c.start.row:0,f=b?c.start.column:0,h=b?c.end.row:a.getLength()-1,i=this.$options.wrap;return{forEach:function(g){var j=d.row,k=a.getLine(j).substring(0,d.column),l=0,m=!1;while(!g(k,l,j)){if(m)return;j--,l=0;if(jb.row||a.row==b.row&&a.column>b.column},this.getRange=function(){var a=this.selectionAnchor||this.selectionLead,b=this.selectionLead;return this.isBackwards()?g.fromPoints(b,a):g.fromPoints(a,b)},this.clearSelection=function(){this.selectionAnchor&&(this.selectionAnchor=null,this._dispatchEvent("changeSelection",{}))},this.selectAll=function(){var a=this.doc.getLength()-1;this.setSelectionAnchor(a,this.doc.getLine(a).length),this.$moveSelection(function(){this.moveCursorTo(0,0)})},this.setSelectionRange=function(a,b){b?(this.setSelectionAnchor(a.end.row,a.end.column),this.selectTo(a.start.row,a.start.column)):(this.setSelectionAnchor(a.start.row,a.start.column),this.selectTo(a.end.row,a.end.column))},this.$moveSelection=function(a){var b=!1;this.selectionAnchor||(b=!0,this.selectionAnchor=this.$clone(this.selectionLead));var c=this.$clone(this.selectionLead);a.call(this);if(c.row!==this.selectionLead.row||c.column!==this.selectionLead.column)b=!0;b&&this._dispatchEvent("changeSelection",{})},this.selectTo=function(a,b){this.$moveSelection(function(){this.moveCursorTo(a,b)})},this.selectToPosition=function(a){this.$moveSelection(function(){this.moveCursorToPosition(a)})},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.selectWord=function(){var a=this.selectionLead,b=a.column,c=this.doc.getWordRange(a.row,b);this.setSelectionRange(c)},this.selectLine=function(){this.setSelectionAnchor(this.selectionLead.row,0),this.$moveSelection(function(){this.moveCursorTo(this.selectionLead.row+1,0)})},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.moveCursorLeft=function(){if(this.selectionLead.column==0)this.selectionLead.row>0&&this.moveCursorTo(this.selectionLead.row-1,this.doc.getLine(this.selectionLead.row-1).length);else{var a=this.doc,b=a.getTabSize(),c=this.selectionLead;a.isTabStop(c)&&a.getLine(c.row).slice(c.column-b,c.column).split(" ").length-1==b?this.moveCursorBy(0,-b):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){if(this.selectionLead.column==this.doc.getLine(this.selectionLead.row).length)this.selectionLead.rowa&&(this.$changedLines.firstRow=a),this.$changedLines.lastRowc&&this.scrollToY(c),this.getScrollTop()+this.$size.scrollerHeightb&&this.scrollToX(b),this.scroller.scrollLeft+this.$size.scrollerWidth"+Array(Math.floor(b)).join(" ")+this.TAB_CHAR+Array(Math.ceil(b)+1).join(" ")+""}else this.$tabString=Array(a+1).join(" ")},this.updateLines=function(a,b,c){this.$computeTabString(),this.config=a;var d=Math.max(b,a.firstRow),e=Math.min(c,a.lastRow),f=this.element.childNodes,g=this;this.tokenizer.getTokens(d,e,function(b){for(var c=d;c<=e;c++){var h=f[c-a.firstRow];if(!h)continue;var i=[];g.$renderLine(i,c,b[c-d].tokens),h.innerHTML=i.join("")}})},this.scrollLines=function(a){function g(){a.lastRow>c.lastRow&&b.$renderLinesFragment(a,c.lastRow+1,a.lastRow,function(a){d.appendChild(a)})}function f(e){a.firstRowa.lastRow)for(var e=a.lastRow+1;e<=c.lastRow;e++)d.removeChild(d.lastChild);f(g)},this.$renderLinesFragment=function(a,b,c,d){var e=document.createDocumentFragment(),f=this;this.tokenizer.getTokens(b,c,function(g){for(var h=b;h<=c;h++){var i=document.createElement("div");i.className="ace_line";var j=i.style;j.height=f.$characterSize.height+"px",j.width=a.width+"px";var k=[];f.$renderLine(k,h,g[h-b].tokens),i.innerHTML=k.join(""),e.appendChild(i)}d(e)})},this.update=function(a){this.$computeTabString(),this.config=a;var b=[],c=this;this.tokenizer.getTokens(a.firstRow,a.lastRow,function(d){for(var e=a.firstRow;e<=a.lastRow;e++)b.push("
"),c.$renderLine(b,e,d[e-a.firstRow].tokens),b.push("
");c.element.innerHTML=b.join("")})},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderLine=function(a,b,c){var d=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g,e=" ";for(var f=0;f",h,"")}}this.$showInvisibles&&(b!==this.doc.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+""))}}).call(h.prototype),b.Text=h}),define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/mode/javascript",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h).replace(g,"$1");j.start.row=h,j.end.row=h,j.end.column=k.length+2,b.replace(j,k)}return-2}return b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/javascript_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules;JavaScriptHighlightRules=function(){var a=new f,b=e.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")),c=e.arrayToMap("null|Infinity|NaN|undefined".split("|")),d=e.arrayToMap("class|enum|extends|super|const|export|import|implements|let|private|public|yield|interface|package|protected|static".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(a){return a=="this"?"variable.language":b[a]?"keyword":c[a]?"constant.language":d[a]?"invalid.illegal":a=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"},d.inherits(JavaScriptHighlightRules,g),b.JavaScriptHighlightRules=JavaScriptHighlightRules}),define("ace/mode/matching_brace_outdent",function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){if(!/^\s+$/.test(a))return!1;return/^\s*\}/.test(b)},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h);return h.length-(f-1)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/mode/text",function(a,b,c){var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$tokenizer=new d((new e).getRules())};(function(){this.getTokenizer=function(){return this.$tokenizer},this.toggleCommentLines=function(a,b,c,d){return 0},this.getNextLineIndent=function(a,b,c){return""},this.checkOutdent=function(a,b,c){return!1},this.autoOutdent=function(a,b,c){},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(f.prototype),b.Mode=f}),define("ace/mode/text_highlight_rules",function(a,b,c){var d=function(){this.$rules={start:[{token:"text",regex:".+"}]}};(function(){this.addRules=function(a,b){for(var c in a){var d=a[c];for(var e=0;ew)v.shiftObject();b._dispatchEvent("output",{requests:v,request:this})},x.prototype.doneWithError=function(a){this.error=!0,this.done(a)},x.prototype.async=function(){this._begunOutput||this._beginOutput()},x.prototype.output=function(a){this._begunOutput||this._beginOutput(),typeof a!=="string"&&!(a instanceof Node)&&(a=a.toString()),this.outputs.push(a),this._dispatchEvent("output",{});return this},x.prototype.done=function(a){this.completed=!0,this.end=new Date,this.duration=this.end.getTime()-this.start.getTime(),a&&this.output(a),this._dispatchEvent("output",{})},b.Request=x}),define("pilot/catalog",function(a,b,c){var d={};b.addExtensionSpec=function(a){d[a.name]=a},b.removeExtensionSpec=function(a){typeof a==="string"?delete d[a]:delete d[a.name]},b.getExtensionSpec=function(a){return d[a]},b.getExtensionSpecs=function(){return Object.keys(d)}}),define("pilot/commands/basic",function(require,exports,module){var checks=require("pilot/typecheck"),canon=require("pilot/canon"),helpMessages={plainPrefix:'

Welcome to Skywriter - Code in the Cloud

',plainSuffix:'For more information, see the Skywriter Wiki.'},helpCommandSpec={name:"help",params:[{name:"search",type:"text",description:"Search string to narrow the output.",defaultValue:null}],description:"Get help on the available commands.",exec:function(a,b,c){var d=[],e=canon.getCommand(b.search);if(e&&e.exec)d.push(e.description?e.description:"No description for "+b.search);else{var f=!1;!b.search&&helpMessages.plainPrefix&&d.push(helpMessages.plainPrefix),e?(d.push("

Sub-Commands of "+e.name+"

"),d.push("

"+e.description+"

")):b.search?(b.search=="hidden"&&(b.search="",f=!0),d.push("

Commands starting with '"+b.search+"':

")):d.push("

Available Commands:

");var g=canon.getCommandNames();g.sort(),d.push("");for(var h=0;h"),d.push('"),d.push(""),d.push("")}d.push("
'+e.name+""+e.description+"
"),!b.search&&helpMessages.plainSuffix&&d.push(helpMessages.plainSuffix)}c.done(d.join(""))}},evalCommandSpec={name:"eval",params:[{name:"javascript",type:"text",description:"The JavaScript to evaluate"}],description:"evals given js code and show the result",hidden:!0,exec:function(env,args,request){var result,javascript=args.javascript;try{result=eval(javascript)}catch(e){result="Error: "+e.message+""}var msg="",type="",x;if(checks.isFunction(result))msg=(result+"").replace(/\n/g,"
").replace(/ /g," "),type="function";else if(checks.isObject(result)){Array.isArray(result)?type="array":type="object";var items=[],value;for(x in result)result.hasOwnProperty(x)&&(checks.isFunction(result[x])?value="[function]":checks.isObject(result[x])?value="[object]":value=result[x],items.push({name:x,value:value}));items.sort(function(a,b){return a.name.toLowerCase()"+items[x].name+": "+items[x].value+"
"}else msg=result,type=typeof result;request.done("Result for eval '"+javascript+"' (type: "+type+"):

"+msg)}},versionCommandSpec={name:"version",description:"show the Skywriter version",hidden:!0,exec:function(a,b,c){var d="Skywriter "+skywriter.versionNumber+" ("+skywriter.versionCodename+")";c.done(d)}},skywriterCommandSpec={name:"skywriter",hidden:!0,exec:function(a,b,c){var d=Math.floor(Math.random()*messages.length);c.done("Skywriter "+messages[d])}},messages=["really wants you to trick it out in some way.","is your Web editor.","would love to be like Emacs on the Web.","is written on the Web platform, so you can tweak it."],canon=require("pilot/canon");exports.startup=function(a,b){canon.addCommand(helpCommandSpec),canon.addCommand(evalCommandSpec),canon.addCommand(skywriterCommandSpec)},exports.shutdown=function(a,b){canon.removeCommand(helpCommandSpec),canon.removeCommand(evalCommandSpec),canon.removeCommand(skywriterCommandSpec)}}),define("pilot/commands/history",function(a,b,c){var d={name:"historyPrevious",predicates:{isCommandLine:!0,isKeyUp:!0},key:"up",exec:function(a,b){g>0&&g--;var c=history.requests[g].typed;env.commandLine.setInput(c)}},e={name:"historyNext",predicates:{isCommandLine:!0,isKeyUp:!0},key:"down",exec:function(a,b){g");var d=1;history.requests.forEach(function(a){c.push(""),c.push(""+d+""),c.push(""+a.typed+""),c.push(""),d++}),c.push(""),b.done(c.join(""))}},g=0;b.addedRequestOutput=function(){g=history.requests.length}}),define("pilot/commands/settings",function(a,b,c){var d={name:"set",params:[{name:"setting",type:"setting",description:"The name of the setting to display or alter",defaultValue:null},{name:"value",type:"settingValue",description:"The new value for the chosen setting",defaultValue:null}],description:"define and show settings",exec:function(a,b,c){var d;if(b.setting)b.value===undefined?d=""+setting.name+" = "+setting.get():(b.setting.set(b.value),d="Setting: "+b.setting.name+" = "+b.setting.get());else{var e=a.settings.getSettingNames();d="",e.sort(function(a,b){return a.localeCompare(b)}),e.forEach(function(b){var c=a.settings.getSetting(b),e="https://wiki.mozilla.org/Labs/Skywriter/Settings#"+c.name;d+=''+c.name+" = "+c.value+"
"})}c.done(d)}},e={name:"unset",params:[{name:"setting",type:"setting",description:"The name of the setting to return to defaults"}],description:"unset a setting entirely",exec:function(a,b,c){var d=a.settings.get(b.setting);d?(d.reset(),c.done("Reset "+d.name+" to default: "+a.settings.get(b.setting))):c.doneWithError("No setting with the name "+b.setting+".")}},f=a("pilot/canon");b.startup=function(a,b){f.addCommand(d),f.addCommand(e)},b.shutdown=function(a,b){f.removeCommand(d),f.removeCommand(e)}}),define("pilot/console",function(a,b,c){var d=function(){},e=["assert","count","debug","dir","dirxml","error","group","groupEnd","info","log","profile","profileEnd","time","timeEnd","trace","warn"];typeof window==="undefined"?e.forEach(function(a){b[a]=function(){var b=Array.prototype.slice.call(arguments),c={op:"log",method:a,args:b};postMessage(JSON.stringify(c))}}):e.forEach(function(a){window.console&&window.console[a]?b[a]=Function.prototype.bind.call(window.console[a],window.console):b[a]=d})}),define("pilot/dom",function(a,b,c){b.setText=function(a,b){a.innerText!==undefined&&(a.innerText=b),a.textContent!==undefined&&(a.textContent=b)},b.hasCssClass=function(a,b){var c=a.className.split(/\s+/g);return c.indexOf(b)!==-1},b.addCssClass=function(a,c){b.hasCssClass(a,c)||(a.className+=" "+c)},b.setCssClass=function(a,c,d){d?b.addCssClass(a,c):b.removeCssClass(a,c)},b.removeCssClass=function(a,b){var c=a.className.split(/\s+/g);while(!0){var d=c.indexOf(b);if(d==-1)break;c.splice(d,1)}a.className=c.join(" ")},b.importCssString=function(a,b){b=b||document;if(b.createStyleSheet){var c=b.createStyleSheet();c.cssText=a}else{var d=b.createElement("style");d.appendChild(b.createTextNode(a)),b.getElementsByTagName("head")[0].appendChild(d)}},b.getInnerWidth=function(a){return parseInt(b.computedStyle(a,"paddingLeft"))+parseInt(b.computedStyle(a,"paddingRight"))+a.clientWidth},b.getInnerHeight=function(a){return parseInt(b.computedStyle(a,"paddingTop"))+parseInt(b.computedStyle(a,"paddingBottom"))+a.clientHeight},b.computedStyle=function(a,b){return window.getComputedStyle?(window.getComputedStyle(a,"")||{})[b]||"":a.currentStyle[b]},b.scrollbarWidth=function(){var a=document.createElement("p");a.style.width="100%",a.style.height="200px";var b=document.createElement("div"),c=b.style;c.position="absolute",c.left="-10000px",c.overflow="hidden",c.width="200px",c.height="150px",b.appendChild(a),document.body.appendChild(b);var d=a.offsetWidth;c.overflow="scroll";var e=a.offsetWidth;d==e&&(e=b.clientWidth),document.body.removeChild(b);return d-e}}),define("pilot/domtemplate",function(require,exports,module){function Templater(){this.scope=[]}Templater.prototype.processNode=function(a,b){typeof a==="string"&&(a=document.getElementById(a));if(b===null||b===undefined)b={};this.scope.push(a.nodeName+(a.id?"#"+a.id:""));try{if(a.attributes&&a.attributes.length){if(a.hasAttribute("foreach")){this.processForEach(a,b);return}if(a.hasAttribute("if"))if(!this.processIf(a,b))return;b.__element=a;var c=Array.prototype.slice.call(a.attributes);for(var d=0;d1&&(d.forEach(function(c){c!==null&&c!==undefined&&c!==""&&(c.charAt(0)==="$"&&(c=this.envEval(c.slice(1),b,a.data)),c===null&&(c="null"),c===undefined&&(c="undefined"),typeof c.cloneNode!=="function"&&(c=a.ownerDocument.createTextNode(c.toString())),a.parentNode.insertBefore(c,a))},this),a.parentNode.removeChild(a))},Templater.prototype.stripBraces=function(a){if(!a.match(/\$\{.*\}/g)){this.handleError("Expected "+a+" to match ${...}");return a}return a.slice(2,-1)},Templater.prototype.property=function(a,b,c){this.scope.push(a);try{typeof a==="string"&&(a=a.split("."));var d=b[a[0]];if(a.length===1){c!==undefined&&(b[a[0]]=c);if(typeof d==="function")return function(){return d.apply(b,arguments)};return d}if(!d){this.handleError("Can't find path="+a);return null}return this.property(a.slice(1),d,c)}finally{this.scope.pop()}},Templater.prototype.envEval=function(script,env,context){with(env)try{this.scope.push(context);return eval(script)}catch(ex){this.handleError("Template error evaluating '"+script+"'",ex);return script}finally{this.scope.pop()}},Templater.prototype.handleError=function(a,b){this.logError(a),this.logError("In: "+this.scope.join(" > ")),b&&this.logError(b)},Templater.prototype.logError=function(a){console.log(a)},exports.Templater=Templater}),define("pilot/environment",function(a,b,c){function e(){return{settings:d}}var d=a("pilot/settings").settings;b.create=e}),define("pilot/event",function(a,b,c){var d=a("pilot/useragent");b.addListener=function(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1);if(a.attachEvent){var d=function(){c(window.event)};c._wrapper=d,a.attachEvent("on"+b,d)}},b.removeListener=function(a,b,c){if(a.removeEventListener)return a.removeEventListener(b,c,!1);a.detachEvent&&a.detachEvent("on"+b,c._wrapper||c)},b.stopEvent=function(a){b.stopPropagation(a),b.preventDefault(a);return!1},b.stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},b.preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},b.getDocumentX=function(a){if(a.clientX){var b=document.documentElement.scrollLeft||document.body.scrollLeft;return a.clientX+b}return a.pageX},b.getDocumentY=function(a){if(a.clientY){var b=document.documentElement.scrollTop||document.body.scrollTop;return a.clientY+b}return a.pageX},b.getButton=function(a){return a.preventDefault?a.button:Math.max(a.button-1,2)},document.documentElement.setCapture?b.capture=function(a,c,d){function f(e){c&&c(e),d&&d(),b.removeListener(a,"mousemove",c),b.removeListener(a,"mouseup",f),b.removeListener(a,"losecapture",f),a.releaseCapture()}function e(a){c(a);return b.stopPropagation(a)}b.addListener(a,"mousemove",c),b.addListener(a,"mouseup",f),b.addListener(a,"losecapture",f),a.setCapture()}:b.capture=function(a,b,c){function e(a){b&&b(a),c&&c(),document.removeEventListener("mousemove",d,!0),document.removeEventListener("mouseup",e,!0),a.stopPropagation()}function d(a){b(a),a.stopPropagation()}document.addEventListener("mousemove",d,!0),document.addEventListener("mouseup",e,!0)},b.addMouseWheelListener=function(a,c){var d=function(a){a.wheelDelta!==undefined?a.wheelDeltaX!==undefined?(a.wheelX=-a.wheelDeltaX/8,a.wheelY=-a.wheelDeltaY/8):(a.wheelX=0,a.wheelY=-a.wheelDelta/8):a.axis&&a.axis==a.HORIZONTAL_AXIS?(a.wheelX=(a.detail||0)*5,a.wheelY=0):(a.wheelX=0,a.wheelY=(a.detail||0)*5),c(a)};b.addListener(a,"DOMMouseScroll",d),b.addListener(a,"mousewheel",d)},b.addMultiMouseDownListener=function(a,c,e,f,g){var h=0,i,j,k=function(a){h+=1,h==1&&(i=a.clientX,j=a.clientY,setTimeout(function(){h=0},f||600));if(b.getButton(a)!=c||Math.abs(a.clientX-i)>5||Math.abs(a.clientY-j)>5)h=0;h==e&&(h=0,g(a));return b.preventDefault(a)};b.addListener(a,"mousedown",k),d.isIE&&b.addListener(a,"dblclick",k)},b.addKeyListener=function(a,c){var e=null;b.addListener(a,"keydown",function(a){e=a.keyIdentifier||a.keyCode;return c(a)}),d.isMac&&(d.isGecko||d.isOpera)&&b.addListener(a,"keypress",function(a){var b=a.keyIdentifier||a.keyCode;if(e!==b)return c(a);e=null})}}),define("pilot/event_emitter",function(a,b,c){var d={};d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(c&&c.length){var b=b||{};b.type=a;for(var d=0;d>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e>>0;if(typeof a!=="function")throw new TypeError;var d=arguments[1];for(var e=0;e47&&d<58&&(j=a.altKey));if(f)a.altKey&&(h+="alt_"),a.ctrlKey&&(h+="ctrl_"),a.metaKey&&(h+="meta_");else if(a.ctrlKey||a.metaKey)return!1}f||(d=a.which,g=f=String.fromCharCode(d),i=f.toLowerCase(),a.metaKey?(h="meta_",f=i):f=null),a.shiftKey&&f&&j&&(h+="shift_"),f&&(f=h+f),!c&&f&&(f=f.replace(/ctrl_meta|meta/,"ctrl"));return[f,g]},b.addKeyDownListener=function(a,c){var g=function(a){var b=c(a);b&&d.stopEvent(a);return b};a.addEventListener("keydown",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return!0;if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS[a.keyCode])return!0}if(f(a))return g(a);return!0},!1),a.addEventListener("keypress",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return g(a);if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode]){a._keyCode=b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode],a._charCode=0;return g(a)}}if(a.charCode!==undefined&&a.charCode===0)return!0;return g(a)},!1)}}),define("pilot/lang",function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return Array(b+1).join(a)},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.arrayToMap=function(a){var b={};for(var c=0;cthis.NEW){e.resolve(this);return e}a([this.name],function(a){a.install&&a.install(b,c),this.status=this.INSTALLED,e.resolve(this)}.bind(this));return e},register:function(b,c){var e=new d;if(this.status!=this.INSTALLED){e.resolve(this);return e}a([this.name],function(a){a.register&&a.register(b,c),this.status=this.REGISTERED,e.resolve(this)}.bind(this));return e},startup:function(c,e){e=e||b.REASONS.APP_STARTUP;var f=new d;if(this.status!=this.REGISTERED){f.resolve(this);return f}a([this.name],function(a){a.startup&&a.startup(c,e),this.status=this.STARTED,f.resolve(this)}.bind(this));return f},shutdown:function(b,c){this.status==this.STARTED&&(pluginModule=a(this.name),pluginModule.shutdown&&pluginModule.shutdown(b,c))}},b.PluginCatalog=function(){this.plugins={}},b.PluginCatalog.prototype={registerPlugins:function(a,c,e){var f=[];a.forEach(function(a){var d=this.plugins[a];d===undefined&&(d=new b.Plugin(a),this.plugins[a]=d,f.push(d.register(c,e)))}.bind(this));return d.group(f)},startupPlugins:function(a,b){var c=[];for(var e in this.plugins){var f=this.plugins[e];c.push(f.startup(a,b))}return d.group(c)}},b.catalog=new b.PluginCatalog}),define("pilot/promise",function(a,b,c){var d=a("pilot/console"),e=a("pilot/stacktrace").Trace,f=-1,g=0,h=1,i=0,j=!1,k=[],l=[];Promise=function(){this._status=g,this._value=undefined,this._onSuccessHandlers=[],this._onErrorHandlers=[],this._id=i++,k[this._id]=this},Promise.prototype.isPromise=!0,Promise.prototype.isComplete=function(){return this._status!=g},Promise.prototype.isResolved=function(){return this._status==h},Promise.prototype.isRejected=function(){return this._status==f},Promise.prototype.then=function(a,b){typeof a==="function"&&(this._status===h?a.call(null,this._value):this._status===g&&this._onSuccessHandlers.push(a)),typeof b==="function"&&(this._status===f?b.call(null,this._value):this._status===g&&this._onErrorHandlers.push(b));return this},Promise.prototype.chainPromise=function(a){var b=new Promise;b._chainedFrom=this,this.then(function(c){try{b.resolve(a(c))}catch(d){b.reject(d)}},function(a){b.reject(a)});return b},Promise.prototype.resolve=function(a){return this._complete(this._onSuccessHandlers,h,a,"resolve")},Promise.prototype.reject=function(a){return this._complete(this._onErrorHandlers,f,a,"reject")},Promise.prototype._complete=function(a,b,c,f){if(this._status!=g){d.group("Promise already closed"),d.error("Attempted "+f+"() with ",c),d.error("Previous status = ",this._status,", previous value = ",this._value),d.trace(),this._completeTrace&&(d.error("Trace of previous completion:"),this._completeTrace.log(5)),d.groupEnd();return this}j&&(this._completeTrace=new e(new Error)),this._status=b,this._value=c,a.forEach(function(a){a.call(null,this._value)},this),this._onSuccessHandlers.length=0,this._onErrorHandlers.length=0,delete k[this._id],l.push(this);while(l.length>20)l.shift();return this},Promise.group=function(a){a instanceof Array||(a=Array.prototype.slice.call(arguments));if(a.length===0)return(new Promise).resolve([]);var b=new Promise,c=[],d=0,e=function(e){return function(g){c[e]=g,d++,b._status!==f&&(d===a.length&&b.resolve(c))}};a.forEach(function(a,c){var d=e(c),f=b.reject.bind(b);a.then(d,f)});return b},b.Promise=Promise,b._outstanding=k,b._recent=l}),define("pilot/proxy",function(a,b,c){var d=a("pilot/promise").Promise;b.xhr=function(a,b,c,e){var f=new d;if(skywriter.proxy&&skywriter.proxy.xhr)skywriter.proxy.xhr.call(this,a,b,c,e,f);else{var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState===4){var a=g.status;if(a!==0&&a!==200){var b=new Error(g.responseText+" (Status "+g.status+")");b.xhr=g,f.reject(b);return}f.resolve(g.responseText)}}.bind(this),g.open("GET",b,c),e&&e(g),g.send()}return f},b.Worker=function(a){return skywriter.proxy&&skywriter.proxy.worker?new skywriter.proxy.worker(a):new Worker(a)}}),define("pilot/rangeutils",function(a,b,c){var d=a("util/util");b.addPositions=function(a,b){return{row:a.row+b.row,col:a.col+b.col}},b.cloneRange=function(a){var b=a.start,c=a.end,d={row:b.row,col:b.col},e={row:c.row,col:c.col};return{start:d,end:e}},b.comparePositions=function(a,b){var c=a.row-b.row;return c===0?a.col-b.col:c},b.equal=function(a,c){return b.comparePositions(a.start,c.start)===0&&b.comparePositions(a.end,c.end)===0},b.extendRange=function(a,b){var c=a.end;return{start:a.start,end:{row:c.row+b.row,col:c.col+b.col}}},b.intersectRangeSets=function(a,c){var e=d.clone(a),f=d.clone(c),g=[];while(e.length>0&&f.length>0){var h=e.shift(),i=f.shift(),j=b.comparePositions(h.start,i.start),k=b.comparePositions(h.end,i.end);b.comparePositions(h.end,i.start)<0?(g.push(h),f.unshift(i)):b.comparePositions(i.end,h.start)<0?(g.push(i),e.unshift(h)):j<0?(g.push({start:h.start,end:i.start}),e.unshift({start:i.start,end:h.end}),f.unshift(i)):j===0?k<0?f.unshift({start:h.end,end:i.end}):k>0&&e.unshift({start:i.end,end:h.end}):j>0&&(g.push({start:i.start,end:h.start}),e.unshift(h),f.unshift({start:h.start,end:i.end}))}return g.concat(e,f)},b.isZeroLength=function(a){return a.start.row===a.end.row&&a.start.col===a.end.col},b.maxPosition=function(a,c){return b.comparePositions(a,c)>0?a:c},b.normalizeRange=function(a){return this.comparePositions(a.start,a.end)<0?a:{start:a.end,end:a.start}},b.rangeSetBoundaries=function(a){return{start:a[0].start,end:a[a.length-1].end}},b.toString=function(a){var b=a.start,c=a.end;return"[ "+b.row+", "+b.col+" "+c.row+","+ +c.col+" ]"},b.unionRanges=function(a,b){return{start:a.start.rowb.end.row||a.end.row===b.end.row&&a.end.col>b.end.col?a.end:b.end}},b.isPosition=function(a){return!d.none(a)&&!d.none(a.row)&&!d.none(a.col)},b.isRange=function(a){return!d.none(a)&&b.isPosition(a.start)&&b.isPosition(a.end)}}),define("pilot/settings/canon",function(a,b,c){var d={name:"historyLength",description:"How many typed commands do we recall for reference?",type:"number",defaultValue:50};b.startup=function(a,b){a.env.settings.addSetting(d)},b.shutdown=function(a,b){a.env.settings.removeSetting(d)}}),define("pilot/settings",function(a,b,c){function l(){}function k(a){this._deactivated={},this._settings={},this._settingNames=[],a&&this.setPersister(a)}function j(a,b){this._settings=b,Object.keys(a).forEach(function(b){this[b]=a[b]},this),this.type=f.getType(this.type);if(this.type==null)throw new Error("In "+this.name+": can't find type for: "+JSON.stringify(a.type));if(!this.name)throw new Error("Setting.name == undefined. Ignoring.",this);if(!this.defaultValue===undefined)throw new Error("Setting.defaultValue == undefined",this);this.value=this.defaultValue}var d=a("pilot/console"),e=a("pilot/oop"),f=a("pilot/types"),g=a("pilot/event_emitter").EventEmitter,h=a("pilot/catalog"),i={name:"setting",description:"A setting is something that the application offers as a way to customize how it works",register:"env.settings.addSetting",indexOn:"name"};b.startup=function(a,b){h.addExtensionSpec(i)},b.shutdown=function(a,b){h.removeExtensionSpec(i)},j.prototype={get:function(){return this.value},set:function(a){this.value!==a&&(this.value=a,this._settings.persister&&this._settings.persister.persistValue(this._settings,this.name,a),this._dispatchEvent("change",{setting:this,value:a}))},resetValue:function(){this.set(this.defaultValue)}},e.implement(j.prototype,g),k.prototype={addSetting:function(a){var b=new j(a,this);this._settings[b.name]=b,this._settingNames.push(b.name),this._settingNames.sort()},removeSetting:function(a){var b=typeof a==="string"?a:a.name;delete this._settings[b],util.arrayRemove(this._settingNames,b)},getSettingNames:function(){return this._settingNames},getSetting:function(a){return this._settings[a]},setPersister:function(a){this._persister=a,a&&a.loadInitialValues(this)},resetAll:function(){this.getSettingNames().forEach(function(a){this.resetValue(a)},this)},_list:function(){var a=[];this.getSettingNames().forEach(function(b){a.push({key:b,value:this.getSetting(b).get()})},this);return a},_loadDefaultValues:function(){this._loadFromObject(this._getDefaultValues())},_loadFromObject:function(a){for(var b in a)if(a.hasOwnProperty(b)){var c=this._settings[b];if(c){var d=c.type.parse(a[b]);this.set(b,d)}else this.set(b,a[b])}},_saveToObject:function(){return this.getSettingNames().map(function(a){return this._settings[a].type.stringify(this.get(a))}.bind(this))},_getDefaultValues:function(){return this.getSettingNames().map(function(a){return this._settings[a].spec.defaultValue}.bind(this))}},b.settings=new k,l.prototype={loadInitialValues:function(a){a._loadDefaultValues();var b=cookie.get("settings");a._loadFromObject(JSON.parse(b))},persistValue:function(a,b,c){try{var e=JSON.stringify(a._saveToObject());cookie.set("settings",e)}catch(f){d.error("Unable to JSONify the settings! "+f);return}}},b.CookiePersister=l}),define("pilot/stacktrace",function(a,b,c){function i(){}function g(a){for(var b=0;b\s*\(/gm,"{anonymous}()@").split("\n")},firefox:function(a){var b=a.stack;if(!b){e.log(a);return[]}b=b.replace(/(?:\n@:0)?\s+$/m,""),b=b.replace(/^\(/gm,"{anonymous}(");return b.split("\n")},opera:function(a){var b=a.message.split("\n"),c="{anonymous}",d=/Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i,e,f,g;for(e=4,f=0,g=b.length;e0){var h="Possibilities"+(a.length===0?"":" for '"+a+"'");return new f(null,g.INCOMPLETE,h,e)}var h="Can't use '"+a+"'.";return new f(null,g.INVALID,h,e)},j.prototype.fromString=function(a){return a},j.prototype.decrement=function(a){var b=typeof this.data==="function"?this.data():this.data,c;if(a==null)c=b.length-1;else{var d=this.stringify(a),c=b.indexOf(d);c=c===0?b.length-1:c-1}return this.fromString(b[c])},j.prototype.increment=function(a){var b=typeof this.data==="function"?this.data():this.data,c;if(a==null)c=0;else{var d=this.stringify(a),c=b.indexOf(d);c=c===b.length-1?0:c+1}return this.fromString(b[c])},j.prototype.name="selection",b.SelectionType=j;var k=new j({name:"bool",data:["true","false"],stringify:function(a){return""+a},fromString:function(a){return a==="true"?!0:!1}});l.prototype=new e,l.prototype.stringify=function(a){return this.defer().stringify(a)},l.prototype.parse=function(a){return this.defer().parse(a)},l.prototype.decrement=function(a){var b=this.defer();return b.decrement?b.decrement(a):undefined},l.prototype.increment=function(a){var b=this.defer();return b.increment?b.increment(a):undefined},l.prototype.name="deferred",b.DeferredType=l,m.prototype=new e,m.prototype.stringify=function(a){return a.join(" ")},m.prototype.parse=function(a){return this.defer().parse(a)},m.prototype.name="array",b.startup=function(){d.registerType(h),d.registerType(i),d.registerType(k),d.registerType(j),d.registerType(l),d.registerType(m)},b.shutdown=function(){d.unregisterType(h),d.unregisterType(i),d.unregisterType(k),d.unregisterType(j),d.unregisterType(l),d.unregisterType(m)}}),define("pilot/types/command",function(a,b,c){var d=a("pilot/canon"),e=a("pilot/types/basic").SelectionType,f=a("pilot/types"),g=new e({name:"command",data:function(){return d.getCommandNames()},stringify:function(a){return a.name},fromString:function(a){return d.getCommand(a)}});b.startup=function(){f.registerType(g)},b.shutdown=function(){f.unregisterType(g)}}),define("pilot/types/settings",function(a,b,c){var d=a("pilot/types/basic").SelectionType,e=a("pilot/types/basic").DeferredType,f=a("pilot/types"),g=a("pilot/settings").settings,h,i=new d({name:"setting",data:function(){return k.settings.getSettingNames()},stringify:function(a){h=a;return a.name},fromString:function(a){h=g.getSetting(a);return h},noMatch:function(){h=null}}),j=new e({name:"settingValue",defer:function(){return h?h.type:f.getType("text")},getDefault:function(){var a=this.parse("");if(h){var b=h.get();if(a.predictions.length===0)a.predictions.push(b);else{var c=!1;while(!0){var d=a.predictions.indexOf(b);if(d===-1)break;a.predictions.splice(d,1),c=!0}c&&a.predictions.push(b)}}return a}}),k;b.startup=function(a,b){k=a.env,f.registerType(i),f.registerType(j)},b.shutdown=function(a,b){f.unregisterType(i),f.unregisterType(j)}}),define("pilot/types",function(a,b,c){function h(a,b){if(a.substr(-2)==="[]"){var c=a.slice(0,-2);return new g.array(c)}var d=g[a];typeof d==="function"&&(d=new d(b));return d}function f(){}function e(a,b,c,e){this.value=a,this.status=b||d.VALID,this.message=c,this.predictions=e||[]}var d={VALID:{toString:function(){return"VALID"},valueOf:function(){return 0}},INCOMPLETE:{toString:function(){return"INCOMPLETE"},valueOf:function(){return 1}},INVALID:{toString:function(){return"INVALID"},valueOf:function(){return 2}},combine:function(a){var b=d.VALID;for(var c=0;cb&&(b=arguments[c]);return b}};b.Status=d,b.Conversion=e,f.prototype={stringify:function(a){throw new Error("not implemented")},parse:function(a){throw new Error("not implemented")},name:undefined,increment:function(a){return undefined},decrement:function(a){return undefined},getDefault:function(){return this.parse("")}},b.Type=f;var g={};b.registerType=function(a){if(typeof a==="object"){if(!(a instanceof f))throw new Error("Can't registerType using: "+a);if(!a.name)throw new Error("All registered types must have a name");g[a.name]=a}else{if(typeof a!=="function")throw new Error("Unknown type: "+a);if(!a.prototype.name)throw new Error("All registered types must have a name");g[a.prototype.name]=a}},b.deregisterType=function(a){delete g[a.name]},b.getType=function(a){if(typeof a==="string")return h(a);if(typeof a==="object"){if(!a.name)throw new Error("Missing 'name' member to typeSpec");return h(a.name,a)}throw new Error("Can't extract type from "+a)}}),define("pilot/useragent",function(a,b,c){var d=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),e=navigator.userAgent,f=navigator.appVersion;b.isWin=d=="win",b.isMac=d=="mac",b.isLinux=d=="linux",b.isIE=!+" 1",b.isGecko=b.isMozilla=window.controllers&&window.navigator.product==="Gecko",b.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",b.isWebKit=parseFloat(e.split("WebKit/")[1])||undefined,b.isAIR=e.indexOf("AdobeAIR")>=0,b.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},b.getOS=function(){return b.isMac?b.OS.MAC:b.isLinux?b.OS.LINUX:b.OS.WINDOWS}}),define("ace/background_tokenizer",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(a,b){this.running=!1,this.textLines=[],this.lines=[],this.currentLine=0,this.tokenizer=a;var c=this;this.$worker=function(){if(c.running){var a=new Date,d=c.currentLine,e=c.textLines,f=0,g=b.getLastVisibleRow();while(c.currentLine20){c.fireUpdateEvent(d,c.currentLine-1);var h=c.currentLine0&&this.lines[a-1]&&(d=this.lines[a-1].state,e=!0);for(var f=a;f<=b;f++)if(this.lines[f]){var g=this.lines[f];d=g.state,c.push(g)}else{var g=this.tokenizer.getLineTokens(this.textLines[f]||"",d),d=g.state;c.push(g),e&&(this.lines[f]=g)}return c}}).call(f.prototype),b.BackgroundTokenizer=f}),define("ace/commands/default_commands",function(a,b,c){var d=a("pilot/canon");d.addCommand({name:"selectall",exec:function(a,b,c){a.editor.getSelection().selectAll()}}),d.addCommand({name:"removeline",exec:function(a,b,c){a.editor.removeLines()}}),d.addCommand({name:"gotoline",exec:function(a,b,c){var d=parseInt(prompt("Enter line number:"));isNaN(d)||a.editor.gotoLine(d)}}),d.addCommand({name:"togglecomment",exec:function(a,b,c){a.editor.toggleCommentLines()}}),d.addCommand({name:"findnext",exec:function(a,b,c){a.editor.findNext()}}),d.addCommand({name:"findprevious",exec:function(a,b,c){a.editor.findPrevious()}}),d.addCommand({name:"find",exec:function(a,b,c){var d=prompt("Find:");a.editor.find(d)}}),d.addCommand({name:"undo",exec:function(a,b,c){a.editor.undo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"overwrite",exec:function(a,b,c){a.editor.toggleOverwrite()}}),d.addCommand({name:"copylinesup",exec:function(a,b,c){a.editor.copyLinesUp()}}),d.addCommand({name:"movelinesup",exec:function(a,b,c){a.editor.moveLinesUp()}}),d.addCommand({name:"selecttostart",exec:function(a,b,c){a.editor.getSelection().selectFileStart()}}),d.addCommand({name:"gotostart",exec:function(a,b,c){a.editor.navigateFileStart()}}),d.addCommand({name:"selectup",exec:function(a,b,c){a.editor.getSelection().selectUp()}}),d.addCommand({name:"golineup",exec:function(a,b,c){a.editor.navigateUp()}}),d.addCommand({name:"copylinesdown",exec:function(a,b,c){a.editor.copyLinesDown()}}),d.addCommand({name:"movelinesdown",exec:function(a,b,c){a.editor.moveLinesDown()}}),d.addCommand({name:"selecttoend",exec:function(a,b,c){a.editor.getSelection().selectFileEnd()}}),d.addCommand({name:"gotoend",exec:function(a,b,c){a.editor.navigateFileEnd()}}),d.addCommand({name:"selectdown",exec:function(a,b,c){a.editor.getSelection().selectDown()}}),d.addCommand({name:"godown",exec:function(a,b,c){a.editor.navigateDown()}}),d.addCommand({name:"selectwordleft",exec:function(a,b,c){a.editor.getSelection().selectWordLeft()}}),d.addCommand({name:"gotowordleft",exec:function(a,b,c){a.editor.navigateWordLeft()}}),d.addCommand({name:"selecttolinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectleft",exec:function(a,b,c){a.editor.getSelection().selectLeft()}}),d.addCommand({name:"gotoleft",exec:function(a,b,c){a.editor.navigateLeft()}}),d.addCommand({name:"selectwordright",exec:function(a,b,c){a.editor.getSelection().selectWordRight()}}),d.addCommand({name:"gotowordright",exec:function(a,b,c){a.editor.navigateWordRight()}}),d.addCommand({name:"selecttolineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"selectright",exec:function(a,b,c){a.editor.getSelection().selectRight()}}),d.addCommand({name:"gotoright",exec:function(a,b,c){a.editor.navigateRight()}}),d.addCommand({name:"selectpagedown",exec:function(a,b,c){a.editor.selectPageDown()}}),d.addCommand({name:"pagedown",exec:function(a,b,c){a.editor.scrollPageDown()}}),d.addCommand({name:"gotopagedown",exec:function(a,b,c){a.editor.gotoPageDown()}}),d.addCommand({name:"selectpageup",exec:function(a,b,c){a.editor.selectPageUp()}}),d.addCommand({name:"pageup",exec:function(a,b,c){a.editor.scrollPageUp()}}),d.addCommand({name:"gotopageup",exec:function(a,b,c){a.editor.gotoPageUp()}}),d.addCommand({name:"selectlinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectlineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"del",exec:function(a,b,c){a.editor.removeRight()}}),d.addCommand({name:"backspace",exec:function(a,b,c){a.editor.removeLeft()}}),d.addCommand({name:"outdent",exec:function(a,b,c){a.editor.blockOutdent()}}),d.addCommand({name:"indent",exec:function(a,b,c){a.editor.indent()}})}),define("ace/conf/keybindings/default_mac",function(a,b,c){b.bindings={selectall:"Command-A",removeline:"Command-D",gotoline:"Command-L",togglecomment:"Command-7",findnext:"Command-K",findprevious:"Command-Shift-K",find:"Command-F",replace:"Command-R",undo:"Command-Z",redo:"Command-Shift-Z|Command-Y",overwrite:"Insert",copylinesup:"Command-Option-Up",movelinesup:"Option-Up",selecttostart:"Command-Shift-Up",gotostart:"Command-Home|Command-Up",selectup:"Shift-Up",golineup:"Up",copylinesdown:"Command-Option-Down",movelinesdown:"Option-Down",selecttoend:"Command-Shift-Down",gotoend:"Command-End|Command-Down",selectdown:"Shift-Down",godown:"Down",selectwordleft:"Option-Shift-Left",gotowordleft:"Option-Left",selecttolinestart:"Command-Shift-Left",gotolinestart:"Command-Left|Home",selectleft:"Shift-Left",gotoleft:"Left",selectwordright:"Option-Shift-Right",gotowordright:"Option-Right",selecttolineend:"Command-Shift-Right",gotolineend:"Command-Right|End",selectright:"Shift-Right",gotoright:"Right",selectpagedown:"Shift-PageDown",pagedown:"PageDown",selectpageup:"Shift-PageUp",pageup:"PageUp",selectlinestart:"Shift-Home",selectlineend:"Shift-End",del:"Delete",backspace:"Ctrl-Backspace|Command-Backspace|Option-Backspace|Backspace",outdent:"Shift-Tab",indent:"Tab"}}),define("ace/conf/keybindings/default_win",function(a,b,c){b.bindings={selectall:"Ctrl-A",removeline:"Ctrl-D",gotoline:"Ctrl-L",togglecomment:"Ctrl-7",findnext:"Ctrl-K",findprevious:"Ctrl-Shift-K",find:"Ctrl-F",replace:"Ctrl-R",undo:"Ctrl-Z",redo:"Ctrl-Shift-Z|Ctrl-Y",overwrite:"Insert",copylinesup:"Ctrl-Alt-Up",movelinesup:"Alt-Up",selecttostart:"Alt-Shift-Up",gotostart:"Ctrl-Home|Ctrl-Up",selectup:"Shift-Up",golineup:"Up",copylinesdown:"Ctrl-Alt-Down",movelinesdown:"Alt-Down",selecttoend:"Alt-Shift-Down",gotoend:"Ctrl-End|Ctrl-Down",selectdown:"Shift-Down",godown:"Down",selectwordleft:"Ctrl-Shift-Left",gotowordleft:"Ctrl-Left",selecttolinestart:"Alt-Shift-Left",gotolinestart:"Alt-Left|Home",selectleft:"Shift-Left",gotoleft:"Left",selectwordright:"Ctrl-Shift-Right",gotowordright:"Ctrl-Right",selecttolineend:"Alt-Shift-Right",gotolineend:"Alt-Right|End",selectright:"Shift-Right",gotoright:"Right",selectpagedown:"Shift-PageDown",pagedown:"PageDown",selectpageup:"Shift-PageUp",pageup:"PageUp",selectlinestart:"Shift-Home",selectlineend:"Shift-End",del:"Delete",backspace:"Backspace",outdent:"Shift-Tab",indent:"Tab"}}),define("ace/document",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("pilot/event_emitter").EventEmitter,g=a("ace/selection").Selection,h=a("ace/mode/text").Mode,i=a("ace/range").Range,j=function(a,b){this.modified=!0,this.lines=[],this.selection=new g(this),this.$breakpoints=[],this.listeners=[],b&&this.setMode(b),Array.isArray(a)?this.$insertLines(0,a):this.$insert({row:0,column:0},a)};(function(){d.implement(this,f),this.$undoManager=null,this.$split=function(a){return a.split(/\r\n|\r|\n/)},this.setValue=function(a){var b=[0,this.lines.length];b.push.apply(b,this.$split(a)),this.lines.splice.apply(this.lines,b),this.modified=!0,this.fireChangeEvent(0)},this.toString=function(){return this.lines.join(this.$getNewLineCharacter())},this.getSelection=function(){return this.selection},this.fireChangeEvent=function(a,b){var c={firstRow:a,lastRow:b};this._dispatchEvent("change",{data:c})},this.setUndoManager=function(a){this.$undoManager=a,this.$deltas=[],this.$informUndoManager&&this.$informUndoManager.cancel();if(a){var b=this;this.$informUndoManager=e.deferredCall(function(){b.$deltas.length>0&&a.execute({action:"aceupdate",args:[b.$deltas,b]}),b.$deltas=[]})}},this.$defaultUndoManager={undo:function(){},redo:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?e.stringRepeat(" ",this.getTabSize()):"\t"},this.$useSoftTabs=!0,this.setUseSoftTabs=function(a){this.$useSoftTabs!==a&&(this.$useSoftTabs=a)},this.getUseSoftTabs=function(){return this.$useSoftTabs},this.$tabSize=4,this.setTabSize=function(a){!isNaN(a)&&this.$tabSize!==a&&(this.modified=!0,this.$tabSize=a,this._dispatchEvent("changeTabSize"))},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(a){return this.$useSoftTabs&&a.column%this.$tabSize==0},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(a){this.$breakpoints=[];for(var b=0;b0&&(d=!!c.charAt(b-1).match(this.tokenRe)),d||(d=!!c.charAt(b).match(this.tokenRe));var e=d?this.tokenRe:this.nonTokenRe,f=b;if(f>0){do f--;while(f>=0&&c.charAt(f).match(e));f++}var g=b;while(g=0){var h=g.charAt(d);if(h==c){f-=1;if(f==0)return{row:e,column:d}}else h==a&&(f+=1);d-=1}e-=1;if(e<0)break;var g=this.getLine(e),d=g.length-1}return null},this.$findClosingBracket=function(a,b){var c=this.$brackets[a],d=b.column,e=b.row,f=1,g=this.getLine(e),h=this.getLength();while(!0){while(d=h)break;var g=this.getLine(e),d=0}return null},this.insert=function(a,b,c){var d=this.$insert(a,b,c);this.fireChangeEvent(a.row,a.row==d.row?a.row:undefined);return d},this.$insertLines=function(a,b,c){if(b.length!=0){var d=[a,0];d.push.apply(d,b),this.lines.splice.apply(this.lines,d);if(!c&&this.$undoManager){var e=this.$getNewLineCharacter();this.$deltas.push({action:"insertText",range:new i(a,0,a+b.length,0),text:b.join(e)+e}),this.$informUndoManager.schedule()}}},this.$insert=function(a,b,c){if(b.length==0)return a;this.modified=!0,this.lines.length<=1&&this.$detectNewLine(b);var d=this.$split(b);if(this.$isNewLine(b)){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column),this.lines.splice(a.row+1,0,e.substring(a.column));var f={row:a.row+1,column:0}}else if(d.length==1){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column)+b+e.substring(a.column);var f={row:a.row,column:a.column+b.length}}else{var e=this.lines[a.row]||"",g=e.substring(0,a.column)+d[0],h=d[d.length-1]+e.substring(a.column);this.lines[a.row]=g,this.$insertLines(a.row+1,[h],!0),d.length>2&&this.$insertLines(a.row+1,d.slice(1,-1),!0);var f={row:a.row+d.length-1,column:d[d.length-1].length}}!c&&this.$undoManager&&(this.$deltas.push({action:"insertText",range:i.fromPoints(a,f),text:b}),this.$informUndoManager.schedule());return f},this.$isNewLine=function(a){return a=="\r\n"||a=="\r"||a=="\n"},this.remove=function(a,b){if(a.isEmpty())return a.start;this.$remove(a,b),this.fireChangeEvent(a.start.row,a.isMultiLine()?undefined:a.start.row);return a.start},this.$remove=function(a,b){if(!a.isEmpty()){if(!b&&this.$undoManager){var c=this.$getNewLineCharacter();this.$deltas.push({action:"removeText",range:a.clone(),text:this.getTextRange(a)}),this.$informUndoManager.schedule()}this.modified=!0;var d=a.start.row,e=a.end.row,f=this.getLine(d).substring(0,a.start.column)+this.getLine(e).substring(a.end.column);f!=""?this.lines.splice(d,e-d+1,f):this.lines.splice(d,e-d+1,"");return a.start}},this.undoChanges=function(a){this.selection.clearSelection();for(var b=a.length-1;b>=0;b--){var c=a[b];c.action=="insertText"?(this.remove(c.range,!0),this.selection.moveCursorToPosition(c.range.start)):(this.insert(c.range.start,c.text,!0),this.selection.clearSelection())}},this.redoChanges=function(a){this.selection.clearSelection();for(var b=0;b=this.lines.length-1)return 0;var c=this.lines.slice(a,b+1);this.$remove(new i(a,0,b+1,0)),this.$insertLines(a+1,c),this.fireChangeEvent(a,b+1);return 1},this.duplicateLines=function(a,b){var a=this.$clipRowToDocument(a),b=this.$clipRowToDocument(b),c=this.getLines(a,b);this.$insertLines(a,c);var d=b-a+1;this.fireChangeEvent(a);return d},this.$clipRowToDocument=function(a){return Math.max(0,Math.min(a,this.lines.length-1))},this.documentToScreenColumn=function(a,b){var c=this.getTabSize(),d=0,e=b,f=this.getLine(a).split("\t");for(var g=0;gh)e-=h+1,d+=h+c;else{d+=e;break}}return d},this.screenToDocumentColumn=function(a,b){var c=this.getTabSize(),d=0,e=b,f=this.getLine(a).split("\t");for(var g=0;gh){d+=h;break}d+=e;break}e-=h+c,d+=h+1}return d}}).call(j.prototype),b.Document=j}),define("ace/editor",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event"),f=a("pilot/lang"),g=a("ace/textinput").TextInput,h=a("ace/keybinding").KeyBinding,i=a("ace/document").Document,j=a("ace/search").Search,k=a("ace/background_tokenizer").BackgroundTokenizer,l=a("ace/range").Range,m=a("pilot/event_emitter").EventEmitter,n=function(a,b){var c=a.getContainerElement();this.container=c,this.renderer=a,this.textInput=new g(c,this),this.keyBinding=new h(c,this);var d=this;e.addListener(c,"mousedown",function(a){setTimeout(function(){d.focus()});return e.preventDefault(a)}),e.addListener(c,"selectstart",function(a){return e.preventDefault(a)});var f=a.getMouseEventTarget();e.addListener(f,"mousedown",this.onMouseDown.bind(this)),e.addMultiMouseDownListener(f,0,2,500,this.onMouseDoubleClick.bind(this)),e.addMultiMouseDownListener(f,0,3,600,this.onMouseTripleClick.bind(this)),e.addMouseWheelListener(f,this.onMouseWheel.bind(this)),this.$selectionMarker=null,this.$highlightLineMarker=null,this.$blockScrolling=!1,this.$search=(new j).set({wrap:!0}),this.setDocument(b||new i("")),this.focus()};(function(){d.implement(this,m),this.$forwardEvents={gutterclick:1,gutterdblclick:1},this.$originalAddEventListener=this.addEventListener,this.$originalRemoveEventListener=this.removeEventListener,this.addEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.addEventListener(a,b):this.$originalAddEventListener(a,b)},this.removeEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.removeEventListener(a,b):this.$originalRemoveEventListener(a,b)},this.setDocument=function(a){if(this.doc!=a){if(this.doc){this.doc.removeEventListener("change",this.$onDocumentChange),this.doc.removeEventListener("changeMode",this.$onDocumentModeChange),this.doc.removeEventListener("changeTabSize",this.$onDocumentChangeTabSize),this.doc.removeEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint);var b=this.doc.getSelection();b.removeEventListener("changeCursor",this.$onCursorChange),b.removeEventListener("changeSelection",this.$onSelectionChange),this.doc.setScrollTopRow(this.renderer.getScrollTopRow())}this.doc=a,this.$onDocumentChange=this.onDocumentChange.bind(this),a.addEventListener("change",this.$onDocumentChange),this.renderer.setDocument(a),this.$onDocumentModeChange=this.onDocumentModeChange.bind(this),a.addEventListener("changeMode",this.$onDocumentModeChange),this.$onDocumentChangeTabSize=this.renderer.updateText.bind(this.renderer),a.addEventListener("changeTabSize",this.$onDocumentChangeTabSize),this.$onDocumentChangeBreakpoint=this.onDocumentChangeBreakpoint.bind(this),this.doc.addEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint),this.selection=a.getSelection(),this.$desiredColumn=0,this.$onCursorChange=this.onCursorChange.bind(this),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onDocumentModeChange(),this.bgTokenizer.setLines(this.doc.lines),this.bgTokenizer.start(0),this.onCursorChange(),this.onSelectionChange(),this.onDocumentChangeBreakpoint(),this.renderer.scrollToRow(a.getScrollTopRow()),this.renderer.updateFull()}},this.getDocument=function(){return this.doc},this.getSelection=function(){return this.selection},this.resize=function(){this.renderer.onResize()},this.setTheme=function(a){this.renderer.setTheme(a)},this.$highlightBrackets=function(){this.$bracketHighlight&&(this.renderer.removeMarker(this.$bracketHighlight),this.$bracketHighlight=null);if(!this.$highlightPending){var a=this;this.$highlightPending=!0,setTimeout(function(){a.$highlightPending=!1;var b=a.doc.findMatchingBracket(a.getCursorPosition());if(b){var c=new l(b.row,b.column,b.row,b.column+1);a.$bracketHighlight=a.renderer.addMarker(c,"ace_bracket")}},10)}},this.focus=function(){this.textInput.focus()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){this.renderer.showCursor(),this.renderer.visualizeFocus()},this.onBlur=function(){this.renderer.hideCursor(),this.renderer.visualizeBlur()},this.onDocumentChange=function(a){var b=a.data;this.bgTokenizer.start(b.firstRow),this.renderer.updateLines(b.firstRow,b.lastRow),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite)},this.onTokenizerUpdate=function(a){var b=a.data;this.renderer.updateLines(b.first,b.last)},this.onCursorChange=function(){this.$highlightBrackets(),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$updateHighlightActiveLine()},this.$updateHighlightActiveLine=function(){this.$highlightLineMarker&&this.renderer.removeMarker(this.$highlightLineMarker),this.$highlightLineMarker=null;if(this.getHighlightActiveLine()&&(this.getSelectionStyle()!="line"||!this.selection.isMultiLine())){var a=this.getCursorPosition(),b=new l(a.row,0,a.row+1,0);this.$highlightLineMarker=this.renderer.addMarker(b,"ace_active_line","line")}},this.onSelectionChange=function(){this.$selectionMarker&&this.renderer.removeMarker(this.$selectionMarker),this.$selectionMarker=null;if(!this.selection.isEmpty()){var a=this.selection.getRange(),b=this.getSelectionStyle();this.$selectionMarker=this.renderer.addMarker(a,"ace_selection",b)}this.onCursorChange()},this.onDocumentChangeBreakpoint=function(){this.renderer.setBreakpoints(this.doc.getBreakpoints())},this.onDocumentModeChange=function(){var a=this.doc.getMode();if(this.mode!=a){this.mode=a;var b=a.getTokenizer();if(this.bgTokenizer)this.bgTokenizer.setTokenizer(b);else{var c=this.onTokenizerUpdate.bind(this);this.bgTokenizer=new k(b,this),this.bgTokenizer.addEventListener("update",c)}this.renderer.setTokenizer(this.bgTokenizer)}},this.onMouseDown=function(a){var b=e.getDocumentX(a),c=e.getDocumentY(a),d=this.renderer.screenToTextCoordinates(b,c);d.row=Math.max(0,Math.min(d.row,this.doc.getLength()-1));if(e.getButton(a)!=0)this.selection.isEmpty()&&this.moveCursorToPosition(d);else{a.shiftKey?this.selection.selectToPosition(d):(this.moveCursorToPosition(d),this.$clickSelection||this.selection.clearSelection(d.row,d.column)),this.renderer.scrollCursorIntoView();var f=this,g,h,i=function(a){g=e.getDocumentX(a),h=e.getDocumentY(a)},j=function(){clearInterval(l),f.$clickSelection=null},k=function(){if(g!==undefined&&h!==undefined){var a=f.renderer.screenToTextCoordinates(g,h);a.row=Math.max(0,Math.min(a.row,f.doc.getLength()-1));if(f.$clickSelection)if(f.$clickSelection.contains(a.row,a.column))f.selection.setSelectionRange(f.$clickSelection);else{if(f.$clickSelection.compare(a.row,a.column)==-1)var b=f.$clickSelection.end;else var b=f.$clickSelection.start;f.selection.setSelectionAnchor(b.row,b.column),f.selection.selectToPosition(a)}else f.selection.selectToPosition(a);f.renderer.scrollCursorIntoView()}};e.capture(this.container,i,j);var l=setInterval(k,20);return e.preventDefault(a)}},this.onMouseDoubleClick=function(a){this.selection.selectWord(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},this.onMouseTripleClick=function(a){this.selection.selectLine(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},this.onMouseWheel=function(a){var b=this.$scrollSpeed*2;this.renderer.scrollBy(a.wheelX*b,a.wheelY*b);return e.preventDefault(a)},this.getCopyText=function(){return this.selection.isEmpty()?"":this.doc.getTextRange(this.getSelectionRange())},this.onCut=function(){this.$readOnly||(this.selection.isEmpty()||(this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection()))},this.onTextInput=function(a){if(!this.$readOnly){var b=this.getCursorPosition();a=a.replace("\t",this.doc.getTabString());if(this.selection.isEmpty()){if(this.$overwrite){var c=new l.fromPoints(b,b);c.end.column+=a.length,this.doc.remove(c)}}else{var b=this.doc.remove(this.getSelectionRange());this.clearSelection()}this.clearSelection();var d=this;this.bgTokenizer.getState(b.row,function(c){var e=d.mode.checkOutdent(c,d.doc.getLine(b.row),a),f=d.doc.getLine(b.row),g=d.mode.getNextLineIndent(c,f.slice(0,b.column),d.doc.getTabString()),h=d.doc.insert(b,a);d.bgTokenizer.getState(b.row,function(a){if(b.row!==h.row){var c=d.doc.getTabSize(),i=Number.MAX_VALUE;for(var j=b.row+1;j<=h.row;++j){var k=0;f=d.doc.getLine(j);for(var m=0;m0;++m)f.charAt(m)=="\t"?n-=c:f.charAt(m)==" "&&(n-=1);d.doc.replace(new l(j,0,j,f.length),f.substr(m))}h.column+=d.doc.indentRows(b.row+1,h.row,g)}else e&&(h.column+=d.mode.autoOutdent(a,d.doc,b.row));d.moveCursorToPosition(h),d.renderer.scrollCursorIntoView()})})}},this.$overwrite=!1,this.setOverwrite=function(a){this.$overwrite!=a&&(this.$overwrite=a,this.$blockScrolling=!0,this.onCursorChange(),this.$blockScrolling=!1,this._dispatchEvent("changeOverwrite",{data:a}))},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.$scrollSpeed=1,this.setScrollSpeed=function(a){this.$scrollSpeed=a},this.getScrollSpeed=function(){return this.$scrollSpeed},this.$selectionStyle="line",this.setSelectionStyle=function(a){this.$selectionStyle!=a&&(this.$selectionStyle=a,this.onSelectionChange(),this._dispatchEvent("changeSelectionStyle",{data:a}))},this.getSelectionStyle=function(){return this.$selectionStyle},this.$highlightActiveLine=!0,this.setHighlightActiveLine=function(a){this.$highlightActiveLine!=a&&(this.$highlightActiveLine=a,this.$updateHighlightActiveLine())},this.getHighlightActiveLine=function(){return this.$highlightActiveLine},this.setShowInvisibles=function(a){this.getShowInvisibles()!=a&&this.renderer.setShowInvisibles(a)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setShowPrintMargin=function(a){this.renderer.setShowPrintMargin(a)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(a){this.renderer.setPrintMarginColumn(a)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.$readOnly=!1,this.setReadOnly=function(a){this.$readOnly=a},this.getReadOnly=function(){return this.$readOnly},this.removeRight=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectRight(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.removeLeft=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectLeft(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.indent=function(){if(!this.$readOnly){var a=this.doc,b=this.getSelectionRange();if(b.start.row>=b.end.row&&b.start.column>=b.end.column){var e;if(this.doc.getUseSoftTabs()){var g=a.getTabSize(),h=this.getCursorPosition(),i=a.documentToScreenColumn(h.row,h.column),d=g-i%g;e=f.stringRepeat(" ",d)}else e="\t";return this.onTextInput(e)}var c=this.$getSelectedRows(),d=a.indentRows(c.first,c.last,"\t");this.selection.shiftSelection(d)}},this.blockOutdent=function(){if(!this.$readOnly){var a=this.doc.getSelection(),b=this.doc.outdentRows(a.getRange());a.setSelectionRange(b,a.isBackwards()),this.$updateDesiredColumn()}},this.toggleCommentLines=function(){if(!this.$readOnly){var a=this;this.bgTokenizer.getState(this.getCursorPosition().row,function(b){var c=a.$getSelectedRows(),d=a.mode.toggleCommentLines(b,a.doc,c.first,c.last);a.selection.shiftSelection(d)})}},this.removeLines=function(){if(!this.$readOnly){var a=this.$getSelectedRows();this.selection.setSelectionAnchor(a.last+1,0),this.selection.selectTo(a.first,0),this.doc.remove(this.getSelectionRange()),this.clearSelection()}},this.moveLinesDown=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.moveLinesDown(a,b)})},this.moveLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.moveLinesUp(a,b)})},this.copyLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){this.doc.duplicateLines(a,b);return 0})},this.copyLinesDown=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.duplicateLines(a,b)})},this.$moveLines=function(a){var b=this.$getSelectedRows(),c=a.call(this,b.first,b.last),d=this.selection;d.setSelectionAnchor(b.last+c+1,0),d.$moveSelection(function(){d.moveCursorTo(b.first+c,0)})},this.$getSelectedRows=function(){var a=this.getSelectionRange().collapseRows();return{first:a.start.row,last:a.end.row}},this.onCompositionStart=function(a){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(a){this.renderer.setCompositionText(a)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(a){return a>=this.getFirstVisibleRow()&&a<=this.getLastVisibleRow()},this.getVisibleRowCount=function(){return this.getLastVisibleRow()-this.getFirstVisibleRow()+1},this.getPageDownRow=function(){return this.renderer.getLastVisibleRow()-1},this.getPageUpRow=function(){var a=this.renderer.getFirstVisibleRow(),b=this.renderer.getLastVisibleRow();return a-(b-a)+1},this.selectPageDown=function(){var a=this.getPageDownRow()+Math.floor(this.getVisibleRowCount()/2);this.scrollPageDown();var b=this.getSelection();b.$moveSelection(function(){b.moveCursorTo(a,b.getSelectionLead().column)})},this.selectPageUp=function(){var a=this.getLastVisibleRow()-this.getFirstVisibleRow(),b=this.getPageUpRow()+Math.round(a/2);this.scrollPageUp();var c=this.getSelection();c.$moveSelection(function(){c.moveCursorTo(b,c.getSelectionLead().column)})},this.gotoPageDown=function(){var a=this.getPageDownRow(),b=Math.min(this.getCursorPosition().column,this.doc.getLine(a).length);this.scrollToRow(a),this.getSelection().moveCursorTo(a,b)},this.gotoPageUp=function(){var a=this.getPageUpRow(),b=Math.min(this.getCursorPosition().column,this.doc.getLine(a).length);this.scrollToRow(a),this.getSelection().moveCursorTo(a,b)},this.scrollPageDown=function(){this.scrollToRow(this.getPageDownRow())},this.scrollPageUp=function(){this.renderer.scrollToRow(this.getPageUpRow())},this.scrollToRow=function(a){this.renderer.scrollToRow(a)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getSelectionRange=function(){return this.selection.getRange()},this.clearSelection=function(){this.selection.clearSelection(),this.$updateDesiredColumn()},this.moveCursorTo=function(a,b){this.selection.moveCursorTo(a,b),this.$updateDesiredColumn()},this.moveCursorToPosition=function(a){this.selection.moveCursorToPosition(a),this.$updateDesiredColumn()},this.gotoLine=function(a,b){this.selection.clearSelection(),this.$blockScrolling=!0,this.moveCursorTo(a-1,b||0),this.$blockScrolling=!1,this.isRowVisible(this.getCursorPosition().row)||this.scrollToRow(a-1-Math.floor(this.getVisibleRowCount()/2))},this.navigateTo=function(a,b){this.clearSelection(),this.moveCursorTo(a,b),this.$updateDesiredColumn(b)},this.navigateUp=function(){this.selection.clearSelection(),this.selection.moveCursorBy(-1,0);if(this.$desiredColumn){var a=this.getCursorPosition(),b=this.doc.screenToDocumentColumn(a.row,this.$desiredColumn);this.selection.moveCursorTo(a.row,b)}},this.navigateDown=function(){this.selection.clearSelection(),this.selection.moveCursorBy(1,0);if(this.$desiredColumn){var a=this.getCursorPosition(),b=this.doc.screenToDocumentColumn(a.row,this.$desiredColumn);this.selection.moveCursorTo(a.row,b)}},this.$updateDesiredColumn=function(){var a=this.getCursorPosition();this.$desiredColumn=this.doc.documentToScreenColumn(a.row,a.column)},this.navigateLeft=function(){if(this.selection.isEmpty())this.selection.moveCursorLeft();else{var a=this.getSelectionRange().start;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateRight=function(){if(this.selection.isEmpty())this.selection.moveCursorRight();else{var a=this.getSelectionRange().end;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(a,b){b&&this.$search.set(b);var c=this.$search.find(this.doc);this.$tryReplace(c,a),c!==null&&this.selection.setSelectionRange(c),this.$updateDesiredColumn()},this.replaceAll=function(a,b){b&&this.$search.set(b);var c=this.$search.findAll(this.doc);if(c.length){this.clearSelection(),this.selection.moveCursorTo(0,0);for(var d=c.length-1;d>=0;--d)this.$tryReplace(c[d],a);c[0]!==null&&this.selection.setSelectionRange(c[0]),this.$updateDesiredColumn()}},this.$tryReplace=function(a,b){var c=this.doc.getTextRange(a),b=this.$search.replace(c,b);if(b!==null){a.end=this.doc.replace(a,b);return a}return null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(a,b){this.clearSelection(),b=b||{},b.needle=a,this.$search.set(b),this.$find()},this.findNext=function(a){a=a||{},typeof a.backwards=="undefined"&&(a.backwards=!1),this.$search.set(a),this.$find()},this.findPrevious=function(a){a=a||{},typeof a.backwards=="undefined"&&(a.backwards=!0),this.$search.set(a),this.$find()},this.$find=function(a){this.selection.isEmpty()||this.$search.set({needle:this.doc.getTextRange(this.getSelectionRange())}),typeof a!="undefined"&&this.$search.set({backwards:a});var b=this.$search.find(this.doc);b&&(this.gotoLine(b.end.row+1,b.end.column),this.$updateDesiredColumn(),this.selection.setSelectionRange(b))},this.undo=function(){this.doc.getUndoManager().undo()},this.redo=function(){this.doc.getUndoManager().redo()}}).call(n.prototype),b.Editor=n}),define("ace/keybinding",function(a,b,c){var d=a("pilot/useragent"),e=a("pilot/event"),f=a("ace/conf/keybindings/default_mac").bindings,g=a("ace/conf/keybindings/default_win").bindings,h=a("pilot/canon");a("ace/commands/default_commands");var i=function(a,b,c){this.setConfig(c);var f=this;e.addKeyListener(a,function(a){if(d.isOpera&&d.isMac)var c=0|(a.metaKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.ctrlKey?8:0);else var c=0|(a.ctrlKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.metaKey?8:0);var g=f.keyNames[a.keyCode],i=(f.config.reverse[c]||{})[(g||String.fromCharCode(a.keyCode)).toLowerCase()],j=h.exec(i,{editor:b});if(j)return e.stopEvent(a)})};(function(){function c(a,c){var d,e,f,g,h={};for(d in a){g=a[d];if(c&&typeof g=="string"){g=g.split(c);for(e=0,f=g.length;e",c+1,""),b.push("");this.element.innerHTML=b.join(""),this.element.style.height=a.minHeight+"px"}}).call(d.prototype),b.Gutter=d}),define("ace/layer/marker",function(a,b,c){var d=a("ace/range").Range,e=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_marker-layer",a.appendChild(this.element),this.markers={},this.$markerId=1};(function(){this.setDocument=function(a){this.doc=a},this.addMarker=function(a,b,c){var d=this.$markerId++;this.markers[d]={range:a,type:c||"line",clazz:b};return d},this.removeMarker=function(a){var b=this.markers[a];b&&delete this.markers[a]},this.update=function(a){var a=a||this.config;if(a){this.config=a;var b=[];for(var c in this.markers){var d=this.markers[c],e=d.range.clipRows(a.firstRow,a.lastRow);if(e.isEmpty())continue;e.isMultiLine()?d.type=="text"?this.drawTextMarker(b,e,d.clazz,a):this.drawMultiLineMarker(b,e,d.clazz,a):this.drawSingleLineMarker(b,e,d.clazz,a)}this.element.innerHTML=b.join("")}},this.drawTextMarker=function(a,b,c,e){var f=b.start.row,g=new d(f,b.start.column,f,this.doc.getLine(f).length);this.drawSingleLineMarker(a,g,c,e);var f=b.end.row,g=new d(f,0,f,b.end.column);this.drawSingleLineMarker(a,g,c,e);for(var f=b.start.row+1;f");var g=(b.end.row-d.firstRow)*d.lineHeight,f=Math.round(b.end.column*d.characterWidth);a.push("
");var e=(b.end.row-b.start.row-1)*d.lineHeight;if(e>=0){var g=(b.start.row+1-d.firstRow)*d.lineHeight;a.push("
")}},this.drawSingleLineMarker=function(a,b,c,d){var b=b.toScreenRange(this.doc),e=d.lineHeight,f=Math.round((b.end.column-b.start.column)*d.characterWidth),g=(b.start.row-d.firstRow)*d.lineHeight,h=Math.round(b.start.column*d.characterWidth);a.push("
")}}).call(e.prototype),b.Marker=e}),define("ace/layer/text",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/dom"),f=a("pilot/lang"),g=a("pilot/event_emitter").EventEmitter,h=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_text-layer",a.appendChild(this.element),this.$characterSize=this.$measureSizes(),this.$pollSizeChanges()};(function(){d.implement(this,g),this.EOF_CHAR="¶",this.EOL_CHAR="¬",this.TAB_CHAR="→",this.SPACE_CHAR="·",this.setTokenizer=function(a){this.tokenizer=a},this.getLineHeight=function(){return this.$characterSize.height||1},this.getCharacterWidth=function(){return this.$characterSize.width||1},this.$pollSizeChanges=function(){var a=this;setInterval(function(){var b=a.$measureSizes();if(a.$characterSize.width!==b.width||a.$characterSize.height!==b.height)a.$characterSize=b,a._dispatchEvent("changeCharaterSize",{data:b})},500)},this.$fontStyles={fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},this.$measureSizes=function(){var a=1e3;if(!this.$measureNode){var b=this.$measureNode=document.createElement("div"),c=b.style;c.width=c.height="auto",c.left=c.top="-1000px",c.visibility="hidden",c.position="absolute",c.overflow="visible",c.whiteSpace="nowrap",b.innerHTML=f.stringRepeat("Xy",a),document.body.insertBefore(b,document.body.firstChild)}var c=this.$measureNode.style;for(var d in this.$fontStyles){var g=e.computedStyle(this.element,d);c[d]=g}var h={height:this.$measureNode.offsetHeight,width:this.$measureNode.offsetWidth/(a*2)};return h},this.setDocument=function(a){this.doc=a},this.$showInvisibles=!1,this.setShowInvisibles=function(a){this.$showInvisibles=a},this.$computeTabString=function(){var a=this.doc.getTabSize();if(this.$showInvisibles){var b=a/2;this.$tabString=""+Array(Math.floor(b)).join(" ")+this.TAB_CHAR+Array(Math.ceil(b)+1).join(" ")+""}else this.$tabString=Array(a+1).join(" ")},this.updateLines=function(a,b,c){this.$computeTabString(),this.config=a;var d=Math.max(b,a.firstRow),e=Math.min(c,a.lastRow),f=this.element.childNodes,g=this;this.tokenizer.getTokens(d,e,function(b){for(var c=d;c<=e;c++){var h=f[c-a.firstRow];if(!h)continue;var i=[];g.$renderLine(i,c,b[c-d].tokens),h.innerHTML=i.join("")}})},this.scrollLines=function(a){function g(){a.lastRow>c.lastRow&&b.$renderLinesFragment(a,c.lastRow+1,a.lastRow,function(a){d.appendChild(a)})}function f(e){a.firstRowa.lastRow)for(var e=a.lastRow+1;e<=c.lastRow;e++)d.removeChild(d.lastChild);f(g)},this.$renderLinesFragment=function(a,b,c,d){var e=document.createDocumentFragment(),f=this;this.tokenizer.getTokens(b,c,function(g){for(var h=b;h<=c;h++){var i=document.createElement("div");i.className="ace_line";var j=i.style;j.height=f.$characterSize.height+"px",j.width=a.width+"px";var k=[];f.$renderLine(k,h,g[h-b].tokens),i.innerHTML=k.join(""),e.appendChild(i)}d(e)})},this.update=function(a){this.$computeTabString(),this.config=a;var b=[],c=this;this.tokenizer.getTokens(a.firstRow,a.lastRow,function(d){for(var e=a.firstRow;e<=a.lastRow;e++)b.push("
"),c.$renderLine(b,e,d[e-a.firstRow].tokens),b.push("
");c.element.innerHTML=b.join("")})},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderLine=function(a,b,c){var d=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g,e=" ";for(var f=0;f",h,"")}}this.$showInvisibles&&(b!==this.doc.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+""))}}).call(h.prototype),b.Text=h}),define("ace/range",function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compare=function(a,b){if(!this.isMultiLine())if(a===this.start.row)return bthis.end.column?1:0;if(athis.end.row)return 1;if(this.start.row===a)return b>=this.start.column?0:-1;if(this.end.row===a)return b<=this.end.column?0:1;return 0},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.row=0;h--){var i=g[h],j=c.$rangeFromMatch(f,i.offset,i.str.length);if(d(j))return!0}})}}},this.$rangeFromMatch=function(a,b,c){return new f(a,b,a,b+c)},this.$assembleRegExp=function(){if(this.$options.regExp)var a=this.$options.needle;else a=d.escapeRegExp(this.$options.needle);this.$options.wholeWord&&(a="\\b"+a+"\\b");var b="g";this.$options.caseSensitive||(b+="i");var c=new RegExp(a,b);return c},this.$forwardLineIterator=function(a){function j(d){var e=a.getLine(d);b&&d==c.end.row&&(e=e.substring(0,c.end.column));return e}var b=this.$options.scope==g.SELECTION,c=a.getSelection().getRange(),d=a.getSelection().getCursor(),e=b?c.start.row:0,f=b?c.start.column:0,h=b?c.end.row:a.getLength()-1,i=this.$options.wrap;return{forEach:function(a){var b=d.row,c=j(b),g=d.column,k=!1;while(!a(c,g,b)){if(k)return;b++,g=0;if(b>h)if(i)b=e,g=f;else return;b==d.row&&(k=!0),c=j(b)}}}},this.$backwardLineIterator=function(a){var b=this.$options.scope==g.SELECTION,c=a.getSelection().getRange(),d=b?c.end:c.start,e=b?c.start.row:0,f=b?c.start.column:0,h=b?c.end.row:a.getLength()-1,i=this.$options.wrap;return{forEach:function(g){var j=d.row,k=a.getLine(j).substring(0,d.column),l=0,m=!1;while(!g(k,l,j)){if(m)return;j--,l=0;if(jb.row||a.row==b.row&&a.column>b.column},this.getRange=function(){var a=this.selectionAnchor||this.selectionLead,b=this.selectionLead;return this.isBackwards()?g.fromPoints(b,a):g.fromPoints(a,b)},this.clearSelection=function(){this.selectionAnchor&&(this.selectionAnchor=null,this._dispatchEvent("changeSelection",{}))},this.selectAll=function(){var a=this.doc.getLength()-1;this.setSelectionAnchor(a,this.doc.getLine(a).length),this.$moveSelection(function(){this.moveCursorTo(0,0)})},this.setSelectionRange=function(a,b){b?(this.setSelectionAnchor(a.end.row,a.end.column),this.selectTo(a.start.row,a.start.column)):(this.setSelectionAnchor(a.start.row,a.start.column),this.selectTo(a.end.row,a.end.column))},this.$moveSelection=function(a){var b=!1;this.selectionAnchor||(b=!0,this.selectionAnchor=this.$clone(this.selectionLead));var c=this.$clone(this.selectionLead);a.call(this);if(c.row!==this.selectionLead.row||c.column!==this.selectionLead.column)b=!0;b&&this._dispatchEvent("changeSelection",{})},this.selectTo=function(a,b){this.$moveSelection(function(){this.moveCursorTo(a,b)})},this.selectToPosition=function(a){this.$moveSelection(function(){this.moveCursorToPosition(a)})},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.selectWord=function(){var a=this.selectionLead,b=a.column,c=this.doc.getWordRange(a.row,b);this.setSelectionRange(c)},this.selectLine=function(){this.setSelectionAnchor(this.selectionLead.row,0),this.$moveSelection(function(){this.moveCursorTo(this.selectionLead.row+1,0)})},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.moveCursorLeft=function(){if(this.selectionLead.column==0)this.selectionLead.row>0&&this.moveCursorTo(this.selectionLead.row-1,this.doc.getLine(this.selectionLead.row-1).length);else{var a=this.doc,b=a.getTabSize(),c=this.selectionLead;a.isTabStop(c)&&a.getLine(c.row).slice(c.column-b,c.column).split(" ").length-1==b?this.moveCursorBy(0,-b):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){if(this.selectionLead.column==this.doc.getLine(this.selectionLead.row).length)this.selectionLead.rowa&&(this.$changedLines.firstRow=a),this.$changedLines.lastRowc&&this.scrollToY(c),this.getScrollTop()+this.$size.scrollerHeightb&&this.scrollToX(b),this.scroller.scrollLeft+this.$size.scrollerWidth"+Array(Math.floor(b)).join(" ")+this.TAB_CHAR+Array(Math.ceil(b)+1).join(" ")+""}else this.$tabString=Array(a+1).join(" ")},this.updateLines=function(a,b,c){this.$computeTabString(),this.config=a;var d=Math.max(b,a.firstRow),e=Math.min(c,a.lastRow),f=this.element.childNodes,g=this;this.tokenizer.getTokens(d,e,function(b){for(var c=d;c<=e;c++){var h=f[c-a.firstRow];if(!h)continue;var i=[];g.$renderLine(i,c,b[c-d].tokens),h.innerHTML=i.join("")}})},this.scrollLines=function(a){function g(){a.lastRow>c.lastRow&&b.$renderLinesFragment(a,c.lastRow+1,a.lastRow,function(a){d.appendChild(a)})}function f(e){a.firstRowa.lastRow)for(var e=a.lastRow+1;e<=c.lastRow;e++)d.removeChild(d.lastChild);f(g)},this.$renderLinesFragment=function(a,b,c,d){var e=document.createDocumentFragment(),f=this;this.tokenizer.getTokens(b,c,function(g){for(var h=b;h<=c;h++){var i=document.createElement("div");i.className="ace_line";var j=i.style;j.height=f.$characterSize.height+"px",j.width=a.width+"px";var k=[];f.$renderLine(k,h,g[h-b].tokens),i.innerHTML=k.join(""),e.appendChild(i)}d(e)})},this.update=function(a){this.$computeTabString(),this.config=a;var b=[],c=this;this.tokenizer.getTokens(a.firstRow,a.lastRow,function(d){for(var e=a.firstRow;e<=a.lastRow;e++)b.push("
"),c.$renderLine(b,e,d[e-a.firstRow].tokens),b.push("
");c.element.innerHTML=b.join("")})},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderLine=function(a,b,c){var d=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g,e=" ";for(var f=0;f",h,"")}}this.$showInvisibles&&(b!==this.doc.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+""))}}).call(h.prototype),b.Text=h}),define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/mode/javascript",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h).replace(g,"$1");j.start.row=h,j.end.row=h,j.end.column=k.length+2,b.replace(j,k)}return-2}return b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/javascript_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules;JavaScriptHighlightRules=function(){var a=new f,b=e.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")),c=e.arrayToMap("null|Infinity|NaN|undefined".split("|")),d=e.arrayToMap("class|enum|extends|super|const|export|import|implements|let|private|public|yield|interface|package|protected|static".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(a){return a=="this"?"variable.language":b[a]?"keyword":c[a]?"constant.language":d[a]?"invalid.illegal":a=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"},d.inherits(JavaScriptHighlightRules,g),b.JavaScriptHighlightRules=JavaScriptHighlightRules}),define("ace/mode/matching_brace_outdent",function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){if(!/^\s+$/.test(a))return!1;return/^\s*\}/.test(b)},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h);return h.length-(f-1)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/mode/text",function(a,b,c){var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$tokenizer=new d((new e).getRules())};(function(){this.getTokenizer=function(){return this.$tokenizer},this.toggleCommentLines=function(a,b,c,d){return 0},this.getNextLineIndent=function(a,b,c){return""},this.checkOutdent=function(a,b,c){return!1},this.autoOutdent=function(a,b,c){},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(f.prototype),b.Mode=f}),define("ace/mode/text_highlight_rules",function(a,b,c){var d=function(){this.$rules={start:[{token:"text",regex:".+"}]}};(function(){this.addRules=function(a,b){for(var c in a){var d=a[c];for(var e=0;e