//>>built
require({cache:{"dojo/node":function(){define(["./has"],function(a){var b;if(require.nodeRequire)b=require.nodeRequire("path");else throw Error("node plugin failed to load because it cannot find the original Node.js require");return{load:function(b,a,g){if(!a.nodeRequire)throw Error("Cannot find native require function");a=a.nodeRequire;var e=define,f;define=void 0;try{f=a(b)}finally{define=e}g(f)},normalize:function(a,c){if("."===a.charAt(0)){var g=require.toUrl(c(".")).replace("/",b.sep),e=a.split("/");
e.unshift(g);a=b.join.apply(b,e)}return a}}})},"main/remoteCaller":function(){define(["dojo/_base/declare","dojo/Deferred","dojo/json"],function(a,b,d){return new (a([],{classes:{},call:function(a,g){for(var e={declaredClass:a,fName:g,args:[]},f=2;f<arguments.length;)e.args.push(arguments[f]),++f;var h=new b;require(["dojo/request/xhr"],function(a){a("/apicall",{data:d.stringify(e),method:"PUT",handleAs:"json",headers:{"Content-Type":"application/json"}}).then(function(a){h.resolve(a)},function(a){h.reject(a)})});
return h},add:function(a){this.classes[a.declaredClass]=a},serverCall:function(a){var b=[];a.args&&(b=a.args);var e=this.classes[a.declaredClass];return e[a.fName].apply(e,b)}}))({})})},"main/treeItems":function(){define("dojo/_base/declare main/_RemoteCall dojo/Deferred main/config!node-mirror dojo/_base/array sol/fileName sol/promise dojo/_base/lang main/nameTranslator main/serverOnly!server/files".split(" "),function(a,b,d,c,g,e,f,h,l,m){var n;return n=new (a("treeItems",[b],{remoteFunctions:{getRootDef:!0,
getChildrenDef:!0,getItemDef:!0},getRootDef:function(){return n.getItemDef("")},getItemDef:function(a){var b=new d,f={id:a,name:""===a?e.single(c.dir):e.single(a)};m.dirsDef(l.fileName(a)).then(function(a){f.hasChildren=!!a;b.resolve(f)});return b},getChildrenDef:function(a){var b=new d;m.dirsDef(c.dir+a).then(function(a){if(a){var p=[];f.allDone(g.map(a,function(a){return n.getItemDef(l.reduceName(a)).then(h.hitch(p,"push"))})).then(function(){b.resolve(p)},function(){})}else b.resolve()});return b}}))})},
"main/_RemoteCall":function(){define(["dojo/_base/declare","dojo/has","main/remoteCaller","dojo/_base/lang"],function(a,b,d,c){return a("_RemoteCall",[],{constructor:function(a){d.add(this)},remoteFunctions:{}})})},"main/config":function(){define("dojo/_base/declare dojo/_base/config dojo/_base/lang dojo/has ./config/load!node-mirror main/_RemoteCall dojo/Deferred".split(" "),function(a,b,d,c,g,e,f){var h;return h=new (a("Config",[e],{remoteFunctions:{loadClientConfig:!0,clientSetConfig:!0},clientConfig:{theme:!0},
saveable:{theme:!0},constructor:function(){d.mixin(this,g);this.config=g},set:function(a,b){try{this.config[a]=b,this.saveable[a]&&g.set(a,b),g[a]=b}catch(f){}},set2:function(a,b){try{this.config[a]=b,this.saveable[a]&&g.set(a,b),g[a]=b}catch(f){}},clientSetConfig:function(a,b){var e=new f;this.clientConfig[a]&&this.set2(a,b);e.resolve();return e},get:function(a){var b=new f;b.resolve(this.config[a]);return b},load:function(a,b,f){f(h)},loadClientConfig:function(){var a=new f,b={},e;for(e in this.clientConfig)b[e]=
g[e];a.resolve(b);return a}}))})},"main/config/load":function(){define(["dojo/_base/declare","dojo/_base/config","dojo/_base/lang","dojo/has"],function(a,b,d,c){return{load:function(a,e,f){var c=b.nodeMirrorNodeModule,l=c.getConfig();l.dir||(l.dir=c.getProcessDir());e(["dojo/node!runtime-configuration"],function(b){var e=b(a,{port:3E3,theme:"monokai"},function(a,b){a||(d.mixin(l,b),l.set=function(a,b){e.set(a,b);e.save("ini")},f(l))})})}}})},"sol/fileName":function(){define(["dojo/_base/declare",
"dojo/_base/array","dojo/_base/lang"],function(a,b,d,c){return new (a("File",[],{single:function(a){a=a.split("/");return a[a.length-1]}}))})},"sol/promise":function(){define(["dojo/_base/declare","dojo/Deferred","dojo/_base/array","dojo/promise/all","dojo/_base/lang"],function(a,b,d,c,g){return new (a("SolPromise",[],{_isPromise:function(a){return a&&"function"===typeof a.then},_parseParameter:function(a){var b,d;a instanceof Array?d=a:a&&"object"===typeof a&&(b=a);if(b){d=[];for(var c in b)Object.hasOwnProperty.call(b,
c)&&this._isPromise(b[c])&&d.push(b[c])}if(d)return d},allDone:function(a){ar=this._parseParameter(a);if(!ar||!ar.length)return(new b).resolve(a);var f=new b,c=ar.length,g=function(){0===--c&&f.resolve(a)};d.forEach(ar,function(a,b){a.then(g,g)});return f.promise}}))})},"dojo/promise/all":function(){define(["../_base/array","../Deferred","../when"],function(a,b,d){var c=a.some;return function(a){var e,f;a instanceof Array?f=a:a&&"object"===typeof a&&(e=a);var h,l=[];if(e){f=[];for(var m in e)Object.hasOwnProperty.call(e,
m)&&(l.push(m),f.push(e[m]));h={}}else f&&(h=[]);if(!f||!f.length)return(new b).resolve(h);var n=new b;n.promise.always(function(){h=l=null});var p=f.length;c(f,function(a,b){e||l.push(b);d(a,function(a){n.isFulfilled()||(h[l[b]]=a,0===--p&&n.resolve(h))},n.reject);return n.isFulfilled()});return n.promise}})},"main/nameTranslator":function(){define(["dojo/_base/declare","main/config","dojo/has"],function(a,b,d){var c=0,c=b.dir.length;return new (a("NameTranslator",[],{reduceName:function(a){return a.substr(c)},
fileName:function(a){return b.dir+a}}))})},"main/serverOnly":function(){define(["dojo/has"],function(a){return{load:function(a,d,c){d([a],c)}}})},"server/files":function(){define("dojo/_base/declare dojo/Deferred dojo/node!fs dojo/_base/array dojo/promise/all dojo/_base/lang sol/promise dojo/node!mime-magic dojo/node!mime".split(" "),function(a,b,d,c,g,e,f,h,l){var m={".pl":"application/promiseLand",".pegjs":"application/peg.js"},n;return n=new (a("File",[],{remoteFunctions:{},dirsDef:function(a){var k=
new b;d.stat(a,function(b,e){b||!e.isDirectory()?k.resolve():d.readdir(a,function(b,d){if(b)k.resolve();else{var e=[];f.allDone(c.map(d,function(b){filename=a+"/"+b;return n.isDirDef(filename).then(function(a){e.push(a)})})).then(function(){k.resolve(e)})}})});return k.promise},childrenDef:function(a){var k=new b;n.isDirDef(a).then(function(){d.readdir(a,function(b,d){b?k.resolve():k.resolve(c.map(d,function(b){return a+"/"+b}))})},function(){k.resolve()});return k.promise},isDirDef:function(a){var k=
new b;d.stat(a,function(b,d){d.isDirectory()&&k.resolve(a);k.reject(a)});return k.promise},contentTypeDef:function(a){var k=new b;h(a,function(b,c){b?k.reject(b):d.stat(a,function(b,d){try{if(b)k.reject(b);else{var e=0===d.size;"inode/x-empty"==c&&(e=!0);if("text/plain"==c||e){for(var f in m)if(a.substr(a.length-f.length)==f){c=m[f];k.resolve(c);return}c=l.lookup(a)}k.resolve(c)}}catch(g){}})});return k.promise},readTextDef:function(a){var c=new b;d.readFile(a,{encoding:"utf8"},function(a,b){c.resolve(b)});
return c.promise},createFileDef:function(a){var c=new b;d.open(a,"a",void 0,function(a,b){a?c.reject(a):b?d.close(b,function(){c.resolve()}):c.resolve()});return c.promise},createDirDef:function(a){var c=new b;d.mkdir(a,void 0,function(b){b?c.reject(b):c.resolve(a)});return c.promise},writeTextDef:function(a,c){var e=new b;d.writeFile(a,c,{encoding:"utf8"},function(a,b){e.resolve()});return e.promise}}))})},"main/contentIO":function(){define("dojo/_base/declare main/_RemoteCall dojo/Deferred dojo/_base/array sol/fileName sol/promise dojo/_base/lang main/nameTranslator main/modules main/serverOnly!server/files".split(" "),
function(a,b,d,c,g,e,f,h,l,m){return new (a("ContentIO",[b],{remoteFunctions:{getContentDef:!0,saveTextDef:!0,createFileDef:!0},getContentDef:function(a){var b=new d,c=h.fileName(a);m.contentTypeDef(c).then(function(d){l.getContent({id:a,fileName:c,contentType:d}).then(function(c){b.resolve(f.mixin({id:a,contentType:d},c))})});return b},saveTextDef:function(a,b){var c=h.fileName(a);return m.writeTextDef(c,b)},createFileDef:function(a,b,c){var e=new d,g=a+"/"+b;if(!b||!b.length)e.reject();else return a=
h.fileName(g),c?m.createDirDef(a).then(f.hitch(this,function(){this.getContentDef(g).then(function(a){e.resolve(a)})}),function(){e.reject()}):m.createFileDef(a).then(f.hitch(this,function(){this.getContentDef(g).then(function(a){e.resolve(a)})}),function(){e.reject()}),e.promise}}))})},"main/modules":function(){define([],function(){for(var a={modules:[],register:function(a){this.modules.push(a)},getContent:function(a){for(var b=0,b=this.modules.length-1;0<=b;--b)if("function"==typeof this.modules[b].getContent){var c;
try{c=this.modules[b].getContent(a)}catch(d){}if(c)return c}}},b=["modules/Default","modules/Directory","modules/Text"],d=function(b){a.register(new b)},c=0,c=0;c<b.length;++c)require([b[c]],d);return a})},"main/nodeControl":function(){define("dojo/_base/declare main/_RemoteCall dojo/Deferred main/config!node-mirror dojo/_base/array sol/promise dojo/_base/lang dojo/has".split(" "),function(a,b,d,c,g,e,f,h){return new (a("NodeControl",[b],{remoteFunctions:{restartDef:!0},restartDef:function(){var a=
new d;setTimeout(function(){c.restartableObj&&c.restartableObj.isRestartable&&c.restartableObj.restart()},10);a.resolve({});return a.promise}}))})},"sol/string":function(){define([],function(){return{endsWith:function(a,b){return a.substr(a.length-b.length)==b?!0:!1},startsWith:function(a,b){return a.substr(0,b.length)==b?!0:!1},cutEnd:function(a,b){return a.substr(0,a.length-b)},cutStart:function(a,b){return a.substr(b)}}})},"main/codemirror/subtypes":function(){define(["./meta","dojo/_base/array"],
function(a,b){var d={};b.forEach(a,function(a){d[a.mime.split("/")[1]]=!0});return d})},"main/codemirror/meta":function(){(function(a,b){if("function"==typeof define)define(a,b);else{for(var d=[],c=0,c=0;c<a.length;++c)d.push(require(a[c]));module.exports=b.apply(void 0,d)}})(["main/codemirror/fake"],function(a){a.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl"},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk"},{name:"C",mime:"text/x-csrc",mode:"clike"},{name:"C++",mime:"text/x-c++src",mode:"clike"},
{name:"Cobol",mime:"text/x-cobol",mode:"cobol"},{name:"Java",mime:"text/x-java",mode:"clike"},{name:"C#",mime:"text/x-csharp",mode:"clike"},{name:"Scala",mime:"text/x-scala",mode:"clike"},{name:"Clojure",mime:"text/x-clojure",mode:"clojure"},{name:"CoffeeScript",mime:"text/x-coffeescript",mode:"coffeescript"},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp"},{name:"CSS",mime:"text/css",mode:"css"},{name:"D",mime:"text/x-d",mode:"d"},{name:"diff",mime:"text/x-diff",mode:"diff"},{name:"ECL",
mime:"text/x-ecl",mode:"ecl"},{name:"Erlang",mime:"text/x-erlang",mode:"erlang"},{name:"Gas",mime:"text/x-gas",mode:"gas"},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm"},{name:"GO",mime:"text/x-go",mode:"go"},{name:"Groovy",mime:"text/x-groovy",mode:"groovy"},{name:"Haskell",mime:"text/x-haskell",mode:"haskell"},{name:"Haxe",mime:"text/x-haxe",mode:"haxe"},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded"},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded"},
{name:"JavaServer Pages",mime:"application/x-jsp",mode:"htmlembedded"},{name:"HTML",mime:"text/html",mode:"htmlmixed"},{name:"HTTP",mime:"message/http",mode:"http"},{name:"Jade",mime:"text/x-jade",mode:"jade"},{name:"JavaScript",mime:"text/javascript",mode:"javascript"},{name:"JSON",mime:"application/x-json",mode:"javascript"},{name:"JSON",mime:"application/json",mode:"javascript"},{name:"TypeScript",mime:"application/typescript",mode:"javascript"},{name:"Jinja2",mime:"jinja2",mode:"jinja2"},{name:"LESS",
mime:"text/x-less",mode:"less"},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript"},{name:"Lua",mime:"text/x-lua",mode:"lua"},{name:"Markdown (GitHub-flavour)",mime:"text/x-markdown",mode:"markdown"},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"NTriples",mime:"text/n-triples",mode:"ntriples"},{name:"OCaml",mime:"text/x-ocaml",mode:"ocaml"},{name:"Pascal",mime:"text/x-pascal",mode:"pascal"},{name:"Perl",mime:"text/x-perl",mode:"perl"},{name:"PHP",mime:"text/x-php",mode:"php"},{name:"PHP(HTML)",
mime:"application/x-httpd-php",mode:"php"},{name:"Pig",mime:"text/x-pig",mode:"pig"},{name:"Plain Text",mime:"text/plain",mode:"null"},{name:"Properties files",mime:"text/x-properties",mode:"clike"},{name:"Python",mime:"text/x-python",mode:"python"},{name:"Cython",mime:"text/x-cython",mode:"python"},{name:"R",mime:"text/x-rsrc",mode:"r"},{name:"reStructuredText",mime:"text/x-rst",mode:"rst"},{name:"Ruby",mime:"text/x-ruby",mode:"ruby"},{name:"Rust",mime:"text/x-rustsrc",mode:"rust"},{name:"Sass",
mime:"text/x-sass",mode:"sass"},{name:"Scheme",mime:"text/x-scheme",mode:"scheme"},{name:"SCSS",mime:"text/x-scss",mode:"css"},{name:"Shell",mime:"text/x-sh",mode:"shell"},{name:"Sieve",mime:"application/sieve",mode:"sieve"},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk"},{name:"Smarty",mime:"text/x-smarty",mode:"smarty"},{name:"SmartyMixed",mime:"text/x-smarty",mode:"smartymixed"},{name:"SPARQL",mime:"application/x-sparql-query",mode:"sparql"},{name:"SQL",mime:"text/x-sql",mode:"sql"},{name:"MariaDB",
mime:"text/x-mariadb",mode:"sql"},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex"},{name:"Tcl",mime:"text/x-tcl",mode:"tcl"},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"VB.NET",mime:"text/x-vb",mode:"vb"},{name:"VBScript",mime:"text/vbscript",mode:"vbscript"},{name:"Velocity",mime:"text/velocity",mode:"velocity"},{name:"Verilog",mime:"text/x-verilog",mode:"verilog"},{name:"XML",mime:"application/xml",
mode:"xml"},{name:"HTML",mime:"text/html",mode:"xml"},{name:"XQuery",mime:"application/xquery",mode:"xquery"},{name:"YAML",mime:"text/x-yaml",mode:"yaml"},{name:"Z80",mime:"text/x-z80",mode:"z80"}];return a.modeInfo})},"modules/Text":function(){define("dojo/_base/declare modules/Base dojo/Deferred dojo/has sol/promise dojo/_base/array main/serverOnly!server/files main/codemirror/subtypes sol/string".split(" "),function(a,b,d,c,g,e,f,h,l){var m={"peg.js":!0,"x-empty":!0},n={"inode/x-empty":!0};return a([b],
{getContent:function(a){var b=!1;l.startsWith(a.contentType,"text/")&&(b=!0);if(!b&&l.startsWith(a.contentType,"application/")){var c=a.contentType.split("/")[1];if(h[c]||m[c])b=!0}b||n[a.contentType]&&(b=!0);if(b){var e=new d,g={isText:!0};f.readTextDef(a.fileName).then(function(a){g.text=a;e.resolve(g)});return e}}})})},"modules/Base":function(){define(["dojo/_base/declare","dojo/Deferred"],function(a,b){return a([],{})})},"modules/Directory":function(){define("dojo/_base/declare modules/Base dojo/Deferred dojo/has sol/promise dojo/_base/array main/nameTranslator main/serverOnly!server/files".split(" "),
function(a,b,d,c,g,e,f,h){return a([b],{getContent:function(a){if("inode/directory"==a.contentType){var b=new d;h.childrenDef(a.fileName).then(function(a){var c={children:[]};g.allDone(e.map(a,function(a){var b={id:f.reduceName(a)};c.children.push(b);return h.contentTypeDef(a).then(function(a){b.contentType=a})})).then(function(){b.resolve(c)})});return b}}})})},"modules/Default":function(){define(["dojo/_base/declare","modules/Base","dojo/Deferred"],function(a,b,d){return a([b],{getContent:function(a){a=
new d;a.resolve({download:!0});return a}})})},"main/codemirror/fake":function(){define([],function(){return{}})}}});
define("server/server","dojo/node!express dojo/node!mime-magic dojo/node!pty.js dojo/node!socket.io dojo/node!http dojo/has dojo/node!fs".split(" "),function(a,b,d,c,g,e,f){require("main/remoteCaller main/treeItems server/files main/nameTranslator sol/fileName main/contentIO main/nodeControl dojo/node!easy-zip main/config".split(" "),function(b,c,d,e,p,k,s,r,q){EasyZip=r.EasyZip;c=a();k=g.createServer(c);c.use(a.bodyParser());c.put("/apicall",function(a,c){b.serverCall(a.body).then(function(a){c.send(a)})});
c.get("/download",function(a,b){var c=e.fileName(a.query.id);d.contentTypeDef(c).then(function(a){if("inode/directory"==a){var d=new EasyZip;d.zipFolder(c,function(){b.setHeader("Content-Disposition",'attachment; filename\x3d"'+p.single(c)+'.zip"');d.writeToResponse(b,p.single(c)+".zip");b.end()})}else b.setHeader("Content-Type",a),f.readFile(c,function(a,d){a?b.end():(b.setHeader("Content-Length",d.length),b.setHeader("Content-Disposition",'attachment; filename\x3d"'+p.single(c)+'"'),b.end(d))})})});
c.use(a["static"](q["static"]));c.get("/",function(a,b){b.setHeader("Content-Type","text/html");f.readFile(q["static"]+"/index.html",function(a,c){a?b.end(a):b.end(c)})});k.listen(q.port)})});
//@ sourceMappingURL=server.js.map