From 86301c44a45cf72cee59afeb926d9de86eb9fffd Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Sat, 29 Apr 2017 16:57:00 +0100 Subject: [PATCH] Prep for release --- index.html | 2 ++ js/core/jseden.min.js | 10 +++++----- js/ui/jseden-ui.min.js | 6 +++--- plugins/jseden-plugins.min.js | 12 ++++++------ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index b730ad2c6..6089ce909 100644 --- a/index.html +++ b/index.html @@ -237,6 +237,8 @@ }, "text"); } + if (mobilecheck()) document.location = "mobile-dev.html"; + $(".loadmodal").show(); Construit(undefined, function(loaded) { // Place to record projects by tag. diff --git a/js/core/jseden.min.js b/js/core/jseden.min.js index f1ab318f1..dcbb9c443 100644 --- a/js/core/jseden.min.js +++ b/js/core/jseden.min.js @@ -1,8 +1,8 @@ -function noop(){}function get_time_diff(a){var b=1e3*a,c=Date.now(),d=new Date,e=6e4*d.getTimezoneOffset();if(b-=e,isNaN(b))return"";if(b5)return new Date(b).toDateString();var i="";if(g>0)i+=g,i+=g>1?" days ago":" day ago";else if(h.getUTCHours()>0){var j=h.getUTCHours();i+=j,i+=j>1?" hours ago":" hour ago"}else{var k=h.getUTCMinutes();if(k>0)i+=k,i+=k>1?" minutes ago":" minute ago";else{var l=h.getUTCSeconds();i+=l,i+=" seconds ago"}}return i}function generateTimeStamp(a){for(var b,c=/(\d*)(minutes|minute|min|hours|hour|days|day|weeks|week|months|month|mon|years|year|Quarters|Quarter|seconds|second|sec|s|m|h|d|M|y|Y|Q|ms|w)/g,d=0;null!==(b=c.exec(a));)switch(console.log("Reltime:",b),b[2]){case"second":case"seconds":case"s":d+=1e3*parseInt(b[1]);break;case"minute":case"minutes":case"m":d+=6e4*parseInt(b[1]);break;case"hour":case"hours":case"h":d+=36e5*parseInt(b[1]);break;case"days":case"d":d+=36e5*parseInt(b[1])*24}return d}function hashCode(a){var b=0;if(0==a.length)return b;for(i=0;i1?eden.root.lookup("jseden_url_"+x).assign(urlparams[x],eden.root.scope,Symbol.localJSAgent):eden.root.lookup("jseden_url_"+x).assign(urlparams[x][0],eden.root.scope,Symbol.localJSAgent);""==lang&&(lang="en");var plugins,defaultPlugins=["Canvas2D","DependencyMap","HTMLContent","PluginManager","ScriptInput","SymbolLookUpTable","SymbolViewer","Debugger","VersionViewer"];if(""==pluginsStr)plugins=defaultPlugins;else{var includeDefaultPlugins=" "==pluginsStr[0];includeDefaultPlugins&&(pluginsStr=pluginsStr.slice(1)),plugins=pluginsStr.split(","),includeDefaultPlugins&&(plugins=plugins.concat(defaultPlugins)),""!=views&&"default"!=views||(plugins.push("Canvas2D"),plugins.push("ScriptInput"))}$(document).ready(function(){function invalidVersion(a){$(".loadmessage").html(a)}var browser=$.browser,bversion=browser.version.split(".");bversion=parseInt(bversion[0]),browser.msie?bversion<13&&invalidVersion("Microsoft Internet Explorer is not supported, use Edge, Firefox or Chrome."):browser.mozilla?bversion<29&&invalidVersion("Please upgrade your version of Firefox/Mozilla."):browser.webkit&&!browser.chrome?invalidVersion("Your browser is not supported by JS-Eden, please use Edge, Firefox or Chrome."):browser.chrome?bversion<39&&invalidVersion("Please upgrade your version of Chrome"):invalidVersion(browser.opera?"Opera is not supported, use Chrome or Firefox.":"Your browser is not supported by JS-Eden, use Firefox or Chrome."),document.addEventListener("touchstart",touchHandler,!0),document.addEventListener("touchmove",touchHandler,!0),document.addEventListener("touchend",touchHandler,!0),document.addEventListener("touchcancel",touchHandler,!0),edenUI=new EdenUI(eden),edenUI.scrollBarSize2=window.innerHeight-$(window).height(),Eden.Project.init(),$.ajax({url:"version.json",dataType:"json",success:function(a){a.tag&&(document.title=document.title+" "+a.tag);var b=a.tag.slice(1).split("."),c=b[2].split("-");eden.root.lookup("jseden_version_major").assign(parseInt(b[0]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_minor").assign(parseInt(b[1]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_patch").assign(parseInt(c[0]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_commit").assign(parseInt(c[1]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_name").assign(a.tag,eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_sha").assign(a.sha,eden.root.scope,Symbol.defaultAgent)},cache:!1}),$(document).on("keydown",null,"ctrl+m",function(){edenUI.cycleNextView()}).on("keyup",null,"ctrl",function(){edenUI.stopViewCycling()}).on("keydown",null,"backspace",function(a){var b=a.target,c=b.tagName.toUpperCase();"INPUT"==c||"TEXTAREA"==c||b.isContentEditable||a.preventDefault()}),"false"!=edenUI.getOptionValue("optConfirmUnload")&&window.addEventListener("beforeunload",confirmUnload);var loadLanguage=function(lang,callback){$.getScript("js/language/"+lang+".js",function(data){Language.language=lang,eval(data),menuBar&&(edenUI.menu=new EdenUI.MenuBar),options&&options.noload||(edenUI.feedback=new EdenUI.Feedback,edenUI.explorer=new EdenUI.Explorer),callback()})},loadPlugins=function(a,b){var c=function(){if(a.length>0){var d=a.shift();edenUI.loadPlugin(d,c)}else b()};c()};doneLoading=function(a){window.scrollTo(0,0),edenUI.finishedLoading(),exec&&(";"!=exec.slice(-1)&&(exec+=";"),eden.execute2(exec)),""==myid&&""==master||(eden.peer=new Eden.Peer(""!=master?master:void 0,""!=myid?myid:void 0)),callback&&callback(a)},loadLanguage(lang,function(){options&&options.noload?Eden.DB.connect(Eden.DB.repositories[Eden.DB.repoindex],function(){console.log("DONE LOADING"),doneLoading(!0)}):loadPlugins(plugins,function(){$.getJSON("config.json",function(a){rt.config=a,Eden.DB.connect(Eden.DB.repositories[Eden.DB.repoindex],function(){""!=load?(null!==mode&&""!=mode&&eden.root.lookup("jseden_project_mode").assign(mode,eden.root.scope,Symbol.defaultAgent),Eden.Project.load(parseInt(load),null===vid||""==vid?void 0:parseInt(vid),null===readPassword||""==readPassword?void 0:readPassword,function(){doneLoading(!0)})):""!=restore?(null!==mode&&""!=mode&&eden.root.lookup("jseden_project_mode").assign(mode,eden.root.scope,Symbol.defaultAgent),Eden.project.restore(),doneLoading(!0)):doneLoading(!1)}),Eden.DB.repoindex=(Eden.DB.repoindex+1)%Eden.DB.repositories.length})})})})}function EdenSyntaxData(){this.value=void 0,this.error=!1,this.line=0}function EdenStream(a){this.code=a,this.position=0,this.position_stack=[0],this.prevposition=0,this.line=1,this.prevline=1,this.data=new EdenSyntaxData}function edenTokenTest(a){for(var b=new EdenStream(a),c=[],d={};b.valid();)c.push(b.readToken(d));return c}function sortByCount(a){var b=a.reduce(function(a,b){return a[b]=(a[b]||0)+1,a},{});return Object.keys(b).sort(function(a,c){return b[a]=b&&d.push(e);return d}function negativeFilter(a,b){for(var c=b.reduce(function(a,b){return a[b]=(a[b]||0)+1,a},{}),d=[],e=0;e0&&(e.insert[g+l].consecutive=!0),e.insert[g+l].partial=null===k,h+=lines[l].length,l0&&(e.remove[f+l].consecutive=!0),i+=lines[l].length,l0){for(var j=0;j0){for(var j=0;j=d+window.innerWidth||this.lastDialogLeft+this.lastDialogWidth=e+window.innerHeight||this.lastDialogTop+this.lastDialogHeightd+window.innerWidth?(d=this.lastDialogLeft+this.lastDialogWidth-window.innerWidth,f=!0):this.lastDialogLefte+window.innerHeight-edenUI.menuBarHeight?(e=this.lastDialogTop+this.lastDialogHeight-window.innerHeight-edenUI.menuBarHeight+edenUI.scrollBarSize2+edenUI.bottomBarHeight,f=!0):this.lastDialogTop=0;a--){var b=this.overrides[a];if(void 0!==b.end){if(b.isin){var c=isbound?b.start.value.length:b.start?b.start.length:0;return b.index=0;b--){var c=this.overrides[b];if(void 0!==c.end||c.isin){var d=c.start instanceof BoundValue,e=d?c.start.value.length:c.start?c.start.length:0;if(c.isin){if(c.index "+a)}},Symbol.prototype.logError=function(a){for(var b in this.loggers){var c=this.loggers[b];c.call(this,a)}},Symbol.prototype.getEdenCode=function(){return"&"+this.name},Symbol.prototype.trigger=function(){try{this.value().call(this,this.context,this.context.scope)}catch(a){var b=new Eden.RuntimeError((void 0),Eden.RuntimeError.PROCAGENT,(void 0),"Triggered proc failed: "+a);eden.emit("error",[this,b])}},Symbol.prototype.fireJSObservers=function(){for(var a in this.jsObservers)try{this.jsObservers[a](this,this.value())}catch(b){var c=new Eden.RuntimeError((void 0),Eden.RuntimeError.JSOBSERVER,(void 0),"JavaScript observer '"+a+"' failed: "+b);eden.emit("error",[this,c]);var d;if(this.context){var e=this.cache.value;d="object"==typeof e&&e.jsExceptions}else d=!1;throw b}},Symbol.prototype.expire=function(a,b,c,d){if(this.has_evaled||d&&this.needsGlobalNotify!=Symbol.EXPIRED){for(var e in this.observers)c[e]=this.observers[e];this.definition&&(this.cache.up_to_date=!1,this.has_evaled=!1,a[this.name]=b.value,b.value++,d&&(this.def_scope=void 0)),this.needsGlobalNotify=Symbol.EXPIRED;for(var f in this.subscribers){var g=this.subscribers[f];g&&g.expire(a,b,c,d)}}},Symbol.prototype.isDependentOn=function(a){if(a==this.name||this.dependencies[a])return!0;var b;for(var c in this.dependencies)if(b=this.dependencies[c],b.isDependentOn(a))return!0;for(var c in this.dynamicDependencies)if(b=this.dynamicDependencies[c],b.isDependentOn(a))return!0;return!1},Symbol.prototype.getDependencies=function(){var a=[];for(var b in this.dependencies)a.push(b);return console.log("Dependencies"),a},Symbol.prototype.assertNotDependentOn=function(a,b){if(void 0===b&&(b=[]),b.push(this.name),this.dependencies[a]){var c=b.join(" -> ")+" -> "+a+" -> "+b[0];throw new Error("Cyclic dependency detected: "+c)}var d;for(var e in this.dependencies)d=this.dependencies[e],d.assertNotDependentOn(a,b);for(var e in this.dynamicDependencies)d=this.dynamicDependencies[e],d.assertNotDependentOn(a,b);b.pop()},Symbol.prototype.addSubscriber=function(a,b){this.garbage=!1,this.subscribers[a]=b},Symbol.prototype.removeSubscriber=function(a){delete this.subscribers[a],void 0===this.origin&&this.canSafelyBeForgotten()&&this.forget()},Symbol.prototype.canSafelyBeForgotten=function(){for(var a in this.subscribers)return!1;for(var b in this.observers)return!1;return!0},Symbol.prototype.forget=function(){this.origin=void 0,this.clearEvalIDs(),this.evalResolved=!0,this.definition=void 0,this.cache.value=void 0,this.cache.up_to_date=!0,this.context&&this.context.expireSymbol(this),this.clearObservees(),this.clearDependencies(),this.garbage=!0;for(var a in this.jsObservers)this.jsObservers[a].call(this,this,void 0);this.jsObservers={},this.context.queueForGarbageCollection(this)},Symbol.prototype.addObserver=function(a,b){this.garbage=!1,this.observers[a]=b},Symbol.prototype.addJSObserver=function(a,b){if("function"!=typeof b)throw new Error("Failed adding JavaScript observer "+b);this.jsObservers[a]=b,0==this.cache.up_to_date&&this.value()},Symbol.prototype.removeObserver=function(a){delete this.observers[a],void 0===this.origin&&this.canSafelyBeForgotten()&&this.forget()},Symbol.prototype.removeJSObserver=function(a){delete this.jsObservers[a]},Symbol.prototype.addExtension=function(a,b,c,d,e){if(!this.definition)throw new Error(Eden.RuntimeError.EXTENDSTATIC);void 0===this.extend&&(this.extend={}),this.extend[a]={code:b,source:c,deps:e},this.subscribe(e),this.needsGlobalNotify=Symbol.REDEFINED,this.context&&this.context.expireSymbol(this)},Symbol.prototype.listAssign=function(a,b,c,d,e){if(this.definition)throw new Error(Eden.RuntimeError.ASSIGNTODEFINED);for(var f=this.value(b),g=0;g0){this.needsGlobalNotify=f;var h=this;setTimeout(function(){h.processGlobalNotifyQueue()},0)}}else{var i=this.needsGlobalNotify;i.push.apply(i,f),i.push.apply(i,d)}}},Folder.prototype.processGlobalNotifyQueue=function(){for(var a=this.needsGlobalNotify,b=0;b4)return eden.error(new Error("forgetAll: This function requires at most 4 arguments."),"error"),[[],void 0,[]];if(0==arguments.length)a="";else if("string"==typeof arguments[0])a=arguments[0];else{if(!Array.isArray(arguments[0]))return void 0===arguments[0]?[[],void 0,[]]:(eden.error(new Error("forgetAll: The first argument must be a string, not a "+typeof arguments[0]),"error"),[[],void 0,[]]);g=arguments[0]}if(arguments.length>1){if("boolean"!=typeof arguments[1])return eden.error(new Error("forgetAll: The second argument must be a boolean, not a "+typeof arguments[1]),"error"),[[],void 0,[]];b=arguments[1]}else b=!0;if(void 0!==g&&arguments.length>2)return eden.error(new Error("forgetAll: Cannot specify case sensitivity when selecting using a list."),"error"),[[],void 0,[]];if(arguments.length>=3){if("boolean"!=typeof arguments[2])return eden.error(new Error("forgetAll: The third argument must be a boolean, not a "+typeof arguments[2]),"error"),[[],void 0,[]];c=arguments[2]}else c=void 0===g||2!=arguments.length||arguments[1];if(arguments.length>3){if("boolean"!=typeof arguments[3])return eden.error(new Error("forgetAll: The forth argument must be a boolean, not a "+typeof arguments[3]),"error"),[[],void 0,[]];d=arguments[3]}else d=!1;var h,i={},j=[],k={};if(void 0!==g)for(var l=0;l0&&c)if(x.length<=50)v=confirm("You are about to delete the following "+x.length+" symbols. Is this correct?\n\n"+x.join("\n"));else{var y=x.length-50;v=confirm("You are about to delete "+x.length+" symbols. Is this correct?\n\n"+x.slice(0,50).join("\n")+"\n...\n("+y+" more)")}else v=!0;if(v){root.beginAutocalcOff();for(m in k);for(var l=0;l"),this.$uimsg.appendTo("body"),this.$uimsg.hide(),this.messagetimeout=void 0,this.messagedisplaytime=5e3,this.eden.listenTo("executeFileLoad",this,function(a){edenUI.updateStatus("Loading "+a)}),this.eden.listenTo("executeError",this,function(a,b){console.error("DEPRECATED ERROR REPORTING",a);var c,e=d.htmlEscape(a.message);'
## ERROR number '+b.errorNumber+":
"+(b.path?"## "+b.path+"
":"")+e+"
\n\n";c="string"==typeof a?a:a.message,edenUI.showMessage("error","Error: "+c)}),this.listeners={},this.windowHighlighter=new WindowHighlighter(this),this.currentView=void 0,this.viewCategories={},this.numberOfViewCategories=0,this.addViewCategory("comprehension","Comprehension"),this.addViewCategory("interpretation","Making Definitions"),this.addViewCategory("history","History & State"),this.addViewCategory("visualization","Visualization"),this.addViewCategory("extension","Extensions"),this.addViewCategory("environment","Management"),$(document).on("click",function(a){if(a.ctrlKey||a.metaKey)for(var b=[],c=a.target;"BODY"!=c.nodeName;){var d=c.getAttribute("data-observables");d&&""!=d&&b.push.apply(b,d.split(",")),c=c.parentNode}})}function d(a){this.root=a,a.base=this,this.dictionary={},this.errorNumber=0,this.listeners={},this.reportErrors=!0}"undefined"!=typeof require&&"undefined"!=typeof exports&&(Polyglot=require("./polyglot").Polyglot,rt=require("./runtime").rt),c.prototype.brieflyHighlightView=function(a){var b=$("#"+viewName+"-dialog").dialog.parent();b.addClass("window-activated"),setTimeout(function(){b.removeClass("window-activated")},600)},c.prototype.cycleNextView=function(){this.stopHighlightingView(this.currentView,!0,!1);var a=Object.keys(this.activeDialogs);if(void 0===this.currentView)this.currentView=a[0];else for(i=0;i"+b+""):"error"==a&&this.$uimsg.html("
"+b+"
"),this.$uimsg.show("fast"),clearTimeout(this.messagetimeout),this.messagetimeout=setTimeout(this.hideMessage,this.messagedisplaytime)},c.prototype.finishedLoading=function(){this.loaded=!0},c.prototype.listenTo=listenTo,c.prototype.emit=emit,c.showTooltip=function(a,b){var c=document.getElementById("tooltip"),d=a.clientX+2,e=a.clientY+20,f=window.pageXOffset+window.innerWidth-d-15;f<200&&(d-=200-f,f=200),c.style.left=d+"px",c.style.maxWidth=f+"px",c.style.top=e+"px",c.innerHTML=b,c.style.display="block"},c.closeTooltip=function(){document.getElementById("tooltip").style.display="none"},c.prototype.options={},c.prototype.getOptionValue=function(a){if(a in this.options)return this.options[a];try{if(window.localStorage)return window.localStorage.getItem(a)}catch(b){return null}},c.prototype.setOptionValue=function(a,b){this.options[a]=String(b),this.emit("optionChange",[a,String(b)]);try{if(window.localStorage)return window.localStorage.setItem(a,b),!0}catch(c){return!1}},c.prototype.setDefaultOptionValue=function(a,b){null===this.getOptionValue(a)&&(this.options[a]=String(b),this.emit("optionChange",[a,String(b)]))},c.prototype.unsetOptionValue=function(a){delete this.options[a],this.emit("optionChange",[a,null]);try{window.localStorage&&window.localStorage.removeItem(a)}catch(b){}},c.prototype.fullscreen=function(a,b){var c=eden.root.lookup(b),d=c.value();if(document.webkitExitFullscreen)if(d){document.onwebkitfullscreenchange=function(){document.webkitIsFullScreen||(c.assign(!1,eden.root.scope,Symbol.hciAgent),edenUI.menu.show())};var e=document.getElementById(a+"-canvascontent");e.webkitRequestFullscreen(),edenUI.menu.hide()}else document.webkitExitFullscreen(),edenUI.menu.show();else if(document.mozCancelFullScreen)if(d){document.onmozfullscreenchange=function(){document.mozFullScreen||(c.assign(!1,eden.root.scope,Symbol.hciAgent),edenUI.menu.show())};var e=document.getElementById(a+"-canvascontent");e.mozRequestFullScreen(),edenUI.menu.hide()}else document.mozCancelFullScreen(),edenUI.menu.show()},c.prototype.regExpFromStr=function(a,b,c,d){var e,f,g,h=!0,i=3;"object"==typeof a&&(g=a,a=g[0].value),void 0===b&&(b="");var j;if(void 0===d)j=!/[\\+^$|({[]|(\.\*[^\s*?])/.test(a)&&"false"!==this.getOptionValue("optSimpleWildcards");else if("simple"==d)j=!0;else{if("regexp"!=d)throw new Error("EdenUI.regExpFromStr: Unsupported search language "+d);j=!1}if(/[A-Z]/.test(a)||(b+="i"),j){a=a.replace(/([\\+^$.|(){[])/g,"\\$1").replace(/([*?])/g,".$1");for(var k=a.split(new RegExp("\\s+(?:"+Language.ui.search.disjunction+"|or)\\s+","i")),l=0;l=0?"<>";else{b.push(a),f="[";for(var g=0;g0&&(f+=d.edenCodeForValue(a[a.length-1],b,c)),f+="]",b.pop()}else if("object"==e){if("getEdenCode"in a?f=a.getEdenCode(c):"keys"in a&&Array.isArray(a.keys)&&a.keys.length>0&&"parent"in a&&a.parent instanceof Symbol?f="&"+a.parent.name.slice(1)+"["+a.keys[0]+"]":"object"==typeof window&&"object"==typeof document&&"function"==typeof Element&&(a==window?f="${{ window }}$":a==document?f="${{ document }}$":a==document.documentElement?f="${{ document.documentElement }}$":a==document.body?f="${{ document.body }}$":a instanceof Element&&a.id&&(f='${{ document.getElementById("'+a.id+'") }}$')),""==f)if(void 0===b&&(b=[]),b.indexOf(a)!=-1)f+="<>";else{b.push(a),f="Object(";for(var h in a)h in Object.prototype||(f=f+h+", "+d.edenCodeForValue(a[h],b,c)+", ");"Object("!=f&&(f=f.slice(0,-2)),f+=")",b.pop()}}else f="function"==e?"${{\n\t"+a.toString().replace(/\n/g,"\n\t")+"\n}}$":"number"==e&&c?a.toFixed(c):String(a);return f},d.edenCodeForValues=function(){for(var a="",b=0;bc+1&&(i=i.slice(0,c)+"...",j=!0);else if(Array.isArray(b))if(void 0===g&&(g=[]),g.indexOf(b)!=-1)i+="...";else{g.push(b),i="[";for(var k=0;k=c-1){"..."!=i.slice(-3)&&(i+="..."),j=!0;break}i+=" "}b.length>0&&!j&&(i=d.prettyPrintValue(i,b[b.length-1],c,e,f,g)),i+="]",g.pop()}else if("object"==h){if(b instanceof Symbol?i=b.getEdenCode():"keys"in b&&Array.isArray(b.keys)&&b.keys.length>0&&"parent"in b&&b.parent instanceof Symbol?i="&"+b.parent.name.slice(1)+"["+b.keys[0]+"]":"object"==typeof window&&"object"==typeof document&&"function"==typeof Element&&(b==window?i="${{ window }}$":b==document?i="${{ document }}$":b==document.documentElement?i="${{ document.documentElement }}$":b==document.body?i="${{ document.body }}$":b instanceof Element&&b.id&&(i='${{ document.getElementById("'+b.id+'") }}$')),""==i)if(b.toString!=Object.prototype.toString)i=b.toString(),void 0!==c&&i.length>c&&(i=i.slice(0,c)+"...",j=!0);else if(void 0===g&&(g=[]),g.indexOf(b)!=-1)i+="...";else{g.push(b),i="{";var l=!1;for(var m in b)if(!(m in Object.prototype)){if(l){i=i.slice(0,-1)+"...",j=!0;break}if(i=i+m+": ",i=d.prettyPrintValue(i,b[m],c,e,f,g),"..."==i.slice(-3)){j=!0;break}void 0!==c&&i.length>=c&&(l=!0),i+=", "}"{"==i||j||(i=i.slice(0,-2)),i+="}",g.pop()}}else"function"==h?e?(i="${{\n\t"+b.toString().replace(/\n/g,"\n\t")+"\n}}$",void 0!==c&&i.length>c&&(i=i.slice(0,c)+"...",j=!0)):i="func":i=String(b);if(a)return a+i;var n=d.htmlEscape(i,!f);return n=n.replace(/\.\.\./g,"…"),f||(n=n.replace(/\n/g,"\\n")),n},d.htmlEscape=function(a,b,c){return void 0===a?"":(a=String(a),a=a.replace(/&/g,"&"),a=a.replace(//g,">"),a=a.replace(/"/g,"""),a=a.replace(/'/g,"'"),c?a=b?a.replace(/\n/g," "):a.replace(/\n/g,"
"):b||(a=a.replace(/\n/g,"
\n")),a)},d.prototype.nextEvalID=0,d.prototype.initialDefinition=function(){console.error("INIT DEF DEP")},d.prototype.getDefinition=function(a,b){return b.eden_definition?b.eden_definition+";":a+" = "+b.context.scope.lookup(b.name).value+";"},a.EdenUI=c,a.Eden=d,"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.Eden=d)}("undefined"!=typeof window?window:global),Eden.DB={directory:{},meta:{},remoteMeta:{},remoteURL:void 0,username:void 0,userid:void 0,repositories:["http://jseden.dcs.warwick.ac.uk/construalmanager","http://localhost:18882"],repoindex:0,retrycount:0,connected:!1,searchServer:"http://jseden.dcs.warwick.ac.uk"},Eden.DB.listeners={},Eden.DB.emit=emit,Eden.DB.listenTo=listenTo,Eden.DB.isConnecting=function(){return void 0!==Eden.DB.remoteURL},Eden.DB.isConnected=function(){return Eden.DB.connected},Eden.DB.isLoggedIn=function(){return void 0!==Eden.DB.username},Eden.DB.logOut=function(a){Eden.DB.isLoggedIn()&&$.ajax({url:Eden.DB.remoteURL+"/logout",type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(b){function c(){Eden.DB.isConnected()&&void 0===Eden.DB.username&&setTimeout(function(){Eden.DB.getLoginName(function(a){a?(Eden.DB.emit("login",[a]),eden.root.lookup("jseden_pm_user").assign(a,eden.root.scope,Symbol.localJSAgent)):c()})},5e3)}Eden.DB.username=void 0,a&&a(),c()},error:function(a){Eden.DB.disconnect(!0)}})},Eden.DB.connect=function(a,b){function c(a){for(var b in a)a[b].missing=!0,a[b].children&&c(a[b].children)}function d(){Eden.DB.isConnected()&&setTimeout(function(){Eden.DB.getLoginName(function(a){a?d():Eden.DB.disconnect()})},3e5)}function e(){Eden.DB.isConnected()&&void 0===Eden.DB.username&&setTimeout(function(){Eden.DB.getLoginName(function(a){a?(Eden.DB.emit("login",[a]),eden.root.lookup("jseden_pm_user").assign(a,eden.root.scope,Symbol.localJSAgent),d()):e()})},5e3)}Eden.DB.remoteURL=a,c(Eden.DB.directory),Eden.DB.refreshint=setInterval(function(){for(var a in Eden.DB.directory)Eden.DB.directory[a].missing=!0},2e4),Eden.DB.getLoginName(function(c){Eden.DB.isConnected()?(Eden.DB.retrycount=0,b&&b(Eden.DB.isConnected()),Eden.DB.emit("connected",[a]),eden.root.lookup("jseden_pm_connected").assign(!0,eden.root.scope,Symbol.localJSAgent),c?(Eden.DB.emit("login",[c]),eden.root.lookup("jseden_pm_user").assign(c,eden.root.scope,Symbol.localJSAgent)):e()):b&&b(Eden.DB.isConnected())})},Eden.DB.disconnect=function(a){Eden.DB.remoteURL=void 0,Eden.DB.connected&&(Eden.DB.emit("disconnected",[]),eden.root.lookup("jseden_pm_connected").assign(!1,eden.root.scope,Symbol.localJSAgent)),Eden.DB.connected=!1,Eden.DB.refreshint&&(clearInterval(Eden.DB.refreshint),Eden.DB.refreshint=void 0),a&&(Eden.DB.retrycount<12&&Eden.DB.retrycount++,setTimeout(function(){Eden.DB.repoindex>=Eden.DB.repositories.length&&(Eden.DB.repoindex=Eden.DB.repositories.length-1),Eden.DB.connect(Eden.DB.repositories[Eden.DB.repoindex]),Eden.DB.repoindex=(Eden.DB.repoindex+1)%Eden.DB.repositories.length},200*Math.pow(2,Math.ceil(Eden.DB.retrycount/Eden.DB.repositories.length))))},Eden.DB.getLoginName=function(a){Eden.DB.isConnecting()?$.ajax({url:Eden.DB.remoteURL+"/user/details",type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(b){Eden.DB.connected=!0,null==b||b.error?(Eden.DB.username=void 0,a()):(Eden.DB.username=b.name,Eden.DB.userid=b.id,!b.id||""!=b.name&&b.name||(Eden.DB.username="NoName"),a(Eden.DB.username))},error:function(b,c,d){Eden.DB.disconnect(!0),a(void 0)}}):a()},Eden.DB.save=function(a,b,c){Eden.DB.isConnected()?$.ajax({url:this.remoteURL+"/project/add",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:a.id,title:a.title,source:a.generate(),tags:a.tags.join(" "),minimisedTitle:a.name,from:a.vid,image:a.thumb,listed:b,metadata:JSON.stringify({description:a.desc}),parentProject:a.parentid},success:function(b){null===b||b.error?(console.error(b),Eden.DB.emit("error",[b?b.description:"No response from server"]),c&&c(!1)):(console.log("Saved",b),a.id=b.projectID,a.vid=b.saveID,a.readPassword=b.readPassword,c&&c(!0))},error:function(a,b,d){Eden.DB.handleError(a,b,d),c&&c(!1)}}):(console.error("Cannot upload, not connected to server"),c&&c(!1),eden.error("Cannot upload "+path+", not connected to server"))},Eden.DB.getVersions=function(a,b){Eden.DB.isConnected()?$.ajax({url:Eden.DB.remoteURL+"/project/versions?projectID="+a,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){b(a)},error:function(a){Eden.DB.disconnect(!0)}}):b(void 0)},Eden.DB.load=function(a,b,c,d){3==arguments.length&&(d=c,c=void 0),Eden.DB.isConnected()?$.ajax({url:Eden.DB.remoteURL+"/project/get?projectID="+a+(b?"&to="+b:"")+(c?"&readPassword="+c:""),type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(c){null==c||c.error?(d(void 0,"No such version"),console.error("No such version "+b+" for "+a),console.log(c),Eden.DB.emit("error",[c?c.description:"No response from server"])):d(c)},error:function(a,b,c){Eden.DB.handleError(a,b,c),d(void 0,"Disconnected")}}):d&&d(void 0,"Disconnected")},Eden.DB.search=function(a,b,c,d,e){var f=this.remoteURL+"/project/";f+=""==a?"search?limit="+c+"&offset="+(b-1)*c:"search?limit="+c+"&offset="+(b-1)*c+"&query="+encodeURIComponent(a),d&&(f+="&by="+d),$.ajax({url:f,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return a&&a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),void e(void 0)):a?void e(a):void e(void 0)},error:function(a,b,c){Eden.DB.handleError(a,b,c),e(void 0)}})},Eden.DB.getMeta=function(a,b){var c=this.remoteURL+"/project/";c+="search?limit=20&query=.id("+a+")",$.ajax({url:c,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return a&&a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),void b(void 0)):a?void b(a):void b(void 0)},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.remove=function(a,b){$.ajax({url:this.remoteURL+"/project/remove",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:a},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),b&&b(!1)):(console.log("Removed",a),b&&b(!0))},error:function(a,c,d){Eden.DB.handleError(a,c,d),b&&b(!1)}})},Eden.DB.rate=function(a,b){$.ajax({url:this.remoteURL+"/project/rate",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:a,stars:b},success:function(a){(null===a||a.error)&&(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]))},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.searchSelector=function(a,b,c){$.ajax({url:this.remoteURL+"/code/search?selector="+a.replace("#","%23")+"&outtype="+b,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return(null===a||a.error)&&(Eden.DB.emit("error",[a?a.description:"No response from server"]),c([])),a?void c(a):void c([])},error:function(a,b,d){c([]),Eden.DB.handleError(a,b,d)}})},Eden.DB.postComment=function(a,b,c){var d=a?a.id:-1,e=a?a.vid:-1;Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/comment/post",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:d,versionID:e,publiclyVisible:c?0:1,comment:b},success:function(a){(null===a||a.error)&&(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]))},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.searchComments=function(a,b,c,d,e,f){var g=a?a.id:-1;Eden.DB.isConnected()&&$.ajax({url:this.remoteURL+"/comment/search?projectID="+g+(e?"&newerThan="+e:"")+"&offset="+(c-1)*d+"&limit="+d,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return a?void f(a):void f([])},error:function(a,b,c){f([]),Eden.DB.handleError(a,b,c)}})},Eden.DB.removeComment=function(a){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/comment/delete",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{commentID:a -},success:function(a){(null===a||a.error)&&(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]))},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.follow=function(a,b){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/social/followproject?projectID="+a,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),b&&b(!1)):b&&b(!0)},error:function(a,c,d){Eden.DB.handleError(a,c,d),b&&b(!1)}})},Eden.DB.adminCommentActivity=function(a,b,c){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/comment/activity?limit=10&offset="+b+(a?"&newerThan="+a:""),type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),c&&c(!1)):c&&c(a)},error:function(a,b,d){Eden.DB.handleError(a,b,d),c&&c(!1)}})},Eden.DB.handleError=function(a,b,c){console.log("DB ERROR",b,c),"error"!=b||c?"error"==b?Eden.DB.emit("error",[c]):"timeout"==b?(Eden.DB.emit("error",["Network timeout"]),Eden.disconnect(!0)):(Eden.DB.emit("error","Unknown network error"),Eden.disconnect(!0)):(Eden.DB.disconnect(!0),Eden.DB.emit("error",["Not connected to construal cloud"]))},Eden.DB.adminProjectActivity=function(a,b,c){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/project/activity?limit=15&offset="+b+(a?"&newerThan="+a:""),type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),c&&c(!1)):c&&c(a)},error:function(a,b,d){Eden.DB.handleError(a,b,d),c&&c(!1)}})},Eden.DB.getPopularTags=function(a,b){$.ajax({url:this.remoteURL+"/project/tags?tag="+a,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),b&&b(!1)):b&&b(a)},error:function(a,c,d){Eden.DB.handleError(a,c,d),b&&b(!1)}})},function(){function a(a,b){return root.lookup("view_"+a+"_"+b)}function b(a){return $("#"+a+"-dialog")}EdenUI.prototype.menuBarHeight=45,EdenUI.prototype.dialogBorderWidth=1,EdenUI.prototype.titleBarHeight=0,EdenUI.prototype.largeTitleBar=41.22+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.scrollBarSize=14+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.scrollBarSize2=window.innerHeight-$(window).height(),EdenUI.prototype.dialogFrameWidth=2*EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.dialogFrameHeight=EdenUI.prototype.titleBarHeight+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.bottomBarHeight=34.906,EdenUI.prototype.gridSizeX=Math.floor(30*window.innerWidth/1920),EdenUI.prototype.gridSizeY=Math.floor(30*window.innerHeight/1920),EdenUI.prototype.minimumWindowWidthShowing=72+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.createEmbedded=function(a,b){if(this.embeddedInstances[a])return this.embeddedInstances[a];var c;return edenUI.views[b].embed?c=edenUI.views[b].embed(a,a,""):edenUI.views[b].embedded&&(c=edenUI.views[b].embedded(a,a,"")),c?(this.embeddedInstances[a]=c,c):void 0},EdenUI.prototype.createView=function(c,d,e){function f(a){return"view_"+c+"_"+a}function g(a,b){n.resizeView(c)}function h(a,b){n.moveView(c)}function i(a,b){var d=z.dialogExtend("state");"hidden"==b?"minimized"!=d&&n.minimizeView(c):"maximized"==b||z.dialog("isOpen")&&"minimized"!=d&&"collapsed"!=d||n.showView(c)}function j(a,b){var c=b;void 0!==w.titleBarInfo&&(c=c+" ("+w.titleBarInfo+")"),z.dialog("option","title",c),edenUI.menu.updateViewsMenu()}function k(a,b){lockVal=b,b?(z.siblings(".ui-dialog-titlebar").css("display","none"),z.dialog("option","resizable",!1),n.resizeView(c)):(z.siblings(".ui-dialog-titlebar").css("display","block"),z.dialog("option","resizable",!0),n.resizeView(c))}function l(a,b){var c=z.get(0).parentNode.style;b?(c.border="none",c.boxShadow="none"):(c.border="1px solid #777",c.boxShadow="0 0 15px #4a6887")}function m(a,b){b?n.pinView(c):n.unpinView(c)}if(!(d in this.views))return void this.eden.error(new Error("View type "+d+" is unavailable. Check that the associated plug-in is loaded."));"name"in this.views[d]&&(c=this.views[d].name);var n=this,o=Symbol.defaultAgent,p=this.activeDialogs[c],q=a(c,"visibility"),r=q.value(),s=a(c,"title"),t=s.value();if(p==d)return"visible"!=r&&q.assign("visible",root.scope,o),this.brieflyHighlightView(c),this.viewInstances[c];this.eden.root.beginAutocalcOff(),void 0!==p&&(t==this.views[p].title&&(t=void 0),this.destroyView(c,!1)),this.titleBarHeight="ScriptView"==p?this.largeTitleBar:this.titleBarHeight;var u=this.menuBarHeight,v=this.views[d].title,w=this.views[d].dialog(c+"-dialog",v);void 0===w&&(w={}),this.viewInstances[c]=w;var x,y=(w.position,edenUI.getOptionValue("optCollapseToTitleBar"));x="true"==y?"collapse":"maximize";var z=b(c);z.dialog({closeOnEscape:!1,position:{using:function(){}},beforeClose:function(){return w.closing?(w.closing=!1,!0):n.closeView(c)},focus:function(){}});var A=[f("type"),f("x"),f("y"),f("width"),f("height"),f("lock"),f("noborder"),f("title"),f("visibility")];z.get(0).setAttribute("data-observables",A.join(","));var B=this.getDialogWindow(c);z.dialogExtend({dblclick:x,minimizable:!0,maximizable:!0,beforeMinimize:function(a){return $(a.target).parent().removeClass("window-activated"),n.hideView(c),!1},minimize:function(){var a=b(c).data("dialog-extend-minimize-controls");a.css("position","relative"),a.css("top",""),a.css("left","")},maximize:function(a){var b=B[0],c=z[0];b.style.top=u+"px";var d=window.innerHeight-u-n.scrollBarSize2-2*n.dialogBorderWidth;"true"!=edenUI.getOptionValue("optHideOnMinimize")&&(d-=n.bottomBarHeight),b.style.height=d+"px",c.style.height=d-n.titleBarHeight+"px"},restore:function(a){z.dialog("moveToTop"),n.brieflyHighlightView(a.target.id.slice(0,-7)),z.dialog("widget").draggable("option","containment",[-Number.MAX_VALUE,u,Number.MAX_VALUE,Number.MAX_VALUE])}}),this.activeDialogs[c]=d;var C=a(c,"type");C.value()!=d&&(C.removeJSObserver("changeType"),C.assign(d,root.scope,Symbol.localJSAgent),C.addJSObserver("changeType",function(a,b){void 0!==b&&root.lookup("views_list").value().indexOf(c)!==-1&&n.createView(c,b)}));var D=root.lookup("views_list"),E=D.value();Array.isArray(E)?E.indexOf(c)===-1&&(E=E.slice(),E.push(c),D.assign(E,root.scope,Symbol.localJSAgent)):D.assign([c],root.scope,Symbol.localJSAgent);var F=a(c,"lock"),G=F.value();widthSym=a(c,"width"),widthSym.addJSObserver("plugins",g),widthSym.definition||void 0!==widthSym.value()||widthSym.assign(z.dialog("option","width"),root.scope,o);var H=a(c,"height");H.addJSObserver("plugins",g),H.definition||void 0!==H.value()||H.assign(z.dialog("option","height")-(G?0:this.titleBarHeight),root.scope,o),g();var I=z.closest(".ui-dialog").position(),J=a(c,"x");J.addJSObserver("plugins",h),J.definition||void 0!==J.value()||J.assign(I.left,root.scope,o);var K=a(c,"y");K.addJSObserver("plugins",h),K.definition||void 0!==K.value()||K.assign(I.top,root.scope,o),h(),"visible"!=r&&(void 0===r?q.assign("visible",root.scope,o):i(q,r)),q.addJSObserver("changeState",i);var L=w.titleBarInfo;delete w.titleBarInfo,Object.defineProperty(w,"titleBarInfo",{get:function(){return L},set:function(a){L=a;var b=s.value();void 0!==a&&(b=b+" ("+a+")"),z.dialog("option","title",b)},enumerable:!0}),s.addJSObserver("updateTitleBar",j),void 0===t?s.assign(v,root.scope,o):j(s,t),F.addJSObserver("changeState",k),void 0!==G&&k(F,G);var M=a(c,"noborder");M.addJSObserver("changeState",l);var N=M.value();void 0!==N&&l(M,N);var O=a(c,"pin");O.addJSObserver("changeState",m);var P=O.value();void 0!==P?m(O,P):this.unpinView(c),z.dialog("widget").draggable("option","containment",[-Number.MAX_VALUE,u,Number.MAX_VALUE,Number.MAX_VALUE]),z.resizeExtend=0,z.on("dialogresizestop",function(b,d){z.previousWidth=void 0,z.momentum=0,z.resizeExtend=0;var e=a(c,"width"),f=a(c,"height"),g=n.eden.root;g.beginAutocalcOff(),e.assign(d.size.width,g.scope,Symbol.hciAgent),f.assign(d.size.height-n.titleBarHeight,g.scope,Symbol.hciAgent),g.endAutocalcOff()}),z.on("dialogdragstop",function(b,d){var e=n.eden.root;e.beginAutocalcOff(),console.log(d),a(c,"x").assign(d.position.left,eden.root.scope,Symbol.hciAgent),a(c,"y").assign(d.position.top,eden.root.scope,Symbol.hciAgent),e.endAutocalcOff()}),z.on("dialogdragstart",function(){if(a(c,"x").definition||a(c,"y").definition)return!1}),z.on("dialogresizestart",function(){if(a(c,"width").definition||a(c,"height").definition)return!1}),this.eden.root.endAutocalcOff(),this.emit("createView",[c,d]);var Q=a(c,"nostack");return Q.value()?z.get(0).parentNode.className+=" ui-back":z.get(0).parentNode.className+=" ui-front",w},EdenUI.prototype.closeView=function(a){return this.hideView(a),edenUI.eden.root.collectGarbage(),!0},EdenUI.prototype.destroyAllViews=function(){for(var a in this.viewInstances)this.destroyView(a,!0)},EdenUI.prototype.destroyView=function(a,c){if(a in this.viewInstances&&!this.viewInstances[a].closing){this.viewInstances[a].closing=!0,this.viewInstances[a].destroy&&this.viewInstances[a].destroy(),root.forgetAll("^View_"+a+"_",!0,!1,!0),c?root.forgetAll("^view_"+a+"_",!0,!1,!0):root.lookup("view_"+a+"_title").removeJSObserver("updateTitleBar");var d=b(a);if(d.dialog("destroy"),d.remove(),d.html(""),delete this.activeDialogs[a],delete this.viewInstances[a],c){var e=root.lookup("views_list"),f=e.value();if(Array.isArray(f)){var g=f.indexOf(a);if(g!==-1){var h;0==g?h=f.slice(1):(f.splice(g,1),h=f),e.assign(h,root.scope,Symbol.hciAgent)}}}this.emit("destroyView",[a])}},EdenUI.prototype.getDialogContent=function(a){return b(a)},EdenUI.prototype.getDialogWindow=function(a){return b(a).parent()},EdenUI.prototype.showView=function(a){var c=b(a);c.dialog("open").dialog("moveToTop");var d=c.dialogExtend("state");return"normal"!=d&&"maximized"!=d&&c.dialogExtend("restore"),this.activeDialogs[a]},EdenUI.prototype.updateView=function(a,b){var c=this.viewInstances[a];c&&c.update&&c.update(b)},EdenUI.prototype.highlightView=function(a,b){if(b)this.windowHighlighter.highlight(a);else{var c=this.getDialogContent(a).data("dialog-extend-minimize-controls")||this.getDialogWindow(a);c.addClass("window-highlighted")}},EdenUI.prototype.stopHighlightingView=function(a,b,c){if(b)this.windowHighlighter.stopHighlight(a,c),c&&this.getDialogContent(a).dialog("moveToTop");else{var d=this.getDialogContent(a).data("dialog-extend-minimize-controls")||this.getDialogWindow(a);d.removeClass("window-highlighted")}},EdenUI.prototype.brieflyHighlightView=function(a){var b=this.getDialogWindow(a);b.addClass("window-activated"),setTimeout(function(){b.removeClass("window-activated")},600)},EdenUI.prototype.hideView=function(a){a in this.viewInstances&&(this.viewInstances[a].closing=!0,b(a).dialog("close"))},EdenUI.prototype.minimizeView=function(a){var c=edenUI.getOptionValue("optHideOnMinimize");if("true"==c)this.hideView(a);else{if(!(a in this.viewInstances))return;b(a).dialogExtend("minimize")}},EdenUI.prototype.minimizeObscuredViews=function(a){if("true"!=edenUI.getOptionValue("optHideOnMinimize")){var c=b(a),d=c.closest(".ui-dialog");if(!d.is(this.windowHighlighter.lastDialog)&&"normal"==c.dialogExtend("state"))for(var e=c.get(0),f=0,g=d.position(),h=g.left,i=g.top,j=c.dialog("option","width")+2*EdenUI.prototype.dialogBorderWidth,k=c.dialog("option","height")+2*EdenUI.prototype.dialogBorderWidth,l=d.hasClass("ui-top"),m=$(".ui-dialog-content"),n=0;n=h-f&&r+t<=h+j+f&&s>=i-f&&s+u<=i+k+f&&o.dialogExtend("minimize")}}}}},EdenUI.prototype.moveView=function(c){var d,e,f=b(c),g=a(c,"x"),h=a(c,"y"),i=g.value(),j=h.value(),k=this.minimumWindowWidthShowing-f.dialog("option","width");d=i'),g=function(a){return function(b){f.dialog("destroy"),f.remove(),e(a)}},h=$("
"+b+"
");f.append(h);for(var i=[],j=0;j1&&d[f[0]].push(decodeURIComponent(f[1]))}return d},URLUtil.getArrayParameterByName=function(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");for(var b="[\\?&]"+a+"=([^&#]*)",c=new RegExp(b,"g"),d=window.location.href,e=c.exec(d),f=[];null!==e;){var g=decodeURIComponent(e[1].replace(/\+/g," "));f.push(g),e=c.exec(d)}return f},URLUtil.isCrossDomain=function(a){var b=a.match(/^([a-zA-Z][a-zA-Z\d+.\-]*:)(\/\/)?([^\/@]*@)?([^\/:]+)(:\d+)?(\/|$)/);return null!==b&&(b[1]!=window.location.protocol||b[4]!=document.domain||b[5].slice(1)!=window.location.port)},URLUtil.downloadFile=function(a){var b=a.url,c=a.dataType,d=a.sync,e=a.success,f=a.error;if(void 0===c&&(c="text"),"function"!=typeof f)throw new Error("An error handling function must be specified.");if("function"!=typeof e)return void f(null,"error","A success callback function must be specified.");if(void 0===b)return void f(null,"error","A URL must be specified.");b=String(b);var g=rt.config.proxyBaseURL,h=this.isCrossDomain(b);if(d===!0&&h&&this.isCrossDomain(g))return void f(null,"error","Synchronous downloading not possible");if("boolean"!=typeof d)return void f(null,"error","The sync option must be a boolean, not a "+typeof d);if(h){var i="crossDomainCallback"+Math.floor(9007199254740991*Math.random());return window[i]=function(a){try{if(a.success){var b,d=a.success,g=!1;switch(c){case"text":b=d;break;case"json":try{b=JSON.parse(d)}catch(h){f(null,"parserror",h),g=!0}break;default:f(null,"error","No cross-domain interpretation available for data type "+c),g=!0}g||e(b,"success",null)}else f(null,"error",a.error)}finally{delete window[i]}},$.ajax({url:g+"?url="+encodeURI(b)+"&callback="+i,dataType:"script",async:!d,error:f})}return a.async=!d,$.ajax(a)};var root,eden,edenUI,doneLoading;"isInteger"in Number||(Number.isInteger=function(a){return parseInt(a)===a});var doingNavigateAway=!1,confirmUnload=function(a){if(!doingNavigateAway){eden.project.localSave();var b="Leaving this page will discard the current script. Your work will not be saved.";return a.returnValue=b,b}};EdenStream.prototype.pushPosition=function(){this.position_stack.push(this.position)},EdenStream.prototype.popPosition=function(){this.position=this.position_stack.pop()},EdenStream.prototype.discardPosition=function(){this.position_stack.pop()},EdenStream.prototype.get=function(){return this.position=this.code.length?0:this.code.charCodeAt(this.position+1)},EdenStream.prototype.peek3=function(){return this.position+2>=this.code.length?0:this.code.charCodeAt(this.position+2)},EdenStream.prototype.readLine=function(){var a=this.code.indexOf("\n",this.position);if(a==-1){var b=this.code.substring(this.position);return this.position=this.code.length,b}var b=this.code.substring(this.position,a+1);return this.position=a+1,this.line++,b},EdenStream.prototype.peekLine=function(){var a=this.code.indexOf("\n",this.position);if(a==-1){var b=this.code.substring(this.position);return b}var b=this.code.substring(this.position,a+1);return b},EdenStream.prototype.move=function(a){this.position=a},EdenStream.prototype.reset=function(){this.position=0,this.position_stack=[0],this.prevposition=0,this.line=1},EdenStream.prototype.tokenText=function(){return this.code.substr(this.prevposition,this.position-this.prevposition)},EdenStream.prototype.isBEOL=function(){if(10==this.peek2())return!0;for(var a=this.prevposition-1,b=this.code.charCodeAt(a);9==b||32==b;)a--,b=this.code.charCodeAt(a);return 10==b},EdenStream.prototype.skip=function(){this.position++},EdenStream.prototype.eof=function(){return this.position>=this.code.length},EdenStream.prototype.valid=function(){return this.position=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||95==a||a>=128||36==a},EdenStream.prototype.isNumeric=function(a){return a>=48&&a<=57},EdenStream.prototype.tokenType=function(a){return"OBSERVABLE"==a?"identifier":"JAVASCRIPT"==a?"javascript":"NUMBER"==a?"number":"STRING"==a?"string":"CHARACTER"==a?"character":"BOOLEAN"==a?"boolean":"string"!=typeof a?(console.error(a),"INVALID"):this.isAlphaNumeric(a.charCodeAt(0))?"keyword":"("==a||"["==a||"{"==a?"openbracket":")"==a||"]"==a||"}"==a?"closebracket":","==a||"."==a||";"==a||":"==a?"separator":"operator"},EdenStream.prototype.parseAlphaNumeric=function(a){var b="";if(0==this.isAlphaNumeric(this.peek()))return!1;for(;this.valid()&&this.isAlphaNumeric(this.peek());)b+=String.fromCharCode(this.get());return a.value=b,!0},EdenStream.prototype.parseString=function(a,b){for(var c="";this.valid()&&this.peek()!=b;){var d=String.fromCharCode(this.get());if("\n"==d)return this.unget(),a.error=!0,void(a.value="LINEBREAK");"\\"==d?(d=String.fromCharCode(this.get()),c+="\\"+d):c+=d}this.valid()&&this.peek()==b?(this.skip(),a.error=!1):a.error=!0,a.value=c},EdenStream.prototype.parseCharacter=function(a){var b=String.fromCharCode(this.get());return"'"==b?(a.value="",void(a.error=!0)):("\\"==b&&(b=String.fromCharCode(this.get())),a.value=b,void(this.valid()&&39==this.peek()?this.skip():a.error=!0))},EdenStream.prototype.parseNumber=function(a){for(var b="";this.valid()&&this.isNumeric(this.peek());)b+=String.fromCharCode(this.get());if(46==this.peek()&&this.isNumeric(this.peek2()))for(this.skip(),b+=".";this.valid()&&this.isNumeric(this.peek());)b+=String.fromCharCode(this.get());a.value=parseFloat(b)},EdenStream.prototype.readToken=function(a){if(this.prevline=this.line,this.skipWhiteSpace(),this.prevposition=this.position,this.eof())return"EOF";var b=this.code.charCodeAt(this.position);switch(this.position++,b){case 33:return 61==this.peek()?(this.skip(),"!="):126==this.peek()?(this.skip(),"!~"):"!";case 34:return a?'"':(this.parseString(this.data,34),"STRING");case 35:return 35==this.peek()?(this.skip(),"##"):"#";case 36:if(123==this.peek()&&123==this.peek2())return this.skip(),this.skip(),"${{";break;case 37:return"%";case 38:return 38==this.peek()?(this.skip(),"&&"):61==this.peek()?(this.skip(),"&="):"&";case 39:return a?"'":(this.parseString(this.data,39),"STRING");case 40:return"(";case 41:return")";case 42:return 61==this.peek()?(this.skip(),"*="):47==this.peek()?(this.skip(),"*/"):"*";case 43:return 43==this.peek()?(this.skip(),"++"):61==this.peek()?(this.skip(),"+="):"+";case 44:return",";case 45:return 45==this.peek()?(this.skip(),"--"):61==this.peek()?(this.skip(),"-="):"-";case 46:return 46==this.peek()?(this.skip(),".."):".";case 47:return 47==this.peek()&&61==this.peek2()?(this.skip(),"//="):47==this.peek()?(this.skip(),"//"):61==this.peek()?(this.skip(),"/="):42==this.peek()?(this.skip(),"/*"):"/";case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.unget(),this.parseNumber(this.data),"NUMBER";case 58:return 58==this.peek()?(this.skip(),"::"):":";case 59:return";";case 60:return 60==this.peek()?(this.skip(),"<<"):61==this.peek()?(this.skip(),"<="):"<";case 61:return 61==this.peek()?(this.skip(),"=="):126==this.peek()?(this.skip(),"=~"):"=";case 62:return 62==this.peek()?(this.skip(),">>"):61==this.peek()?(this.skip(),">="):">";case 63:return"?";case 64:return"@";case 91:return"[";case 92:return'"';case 93:return"]";case 94:return"^";case 96:return"`";case 123:return"{";case 124:return 124==this.peek()?(this.skip(),"||"):61==this.peek()?(this.skip(),"|="):"|";case 125:return 125==this.peek()&&36==this.peek2()?(this.skip(),this.skip(),"}}$"):"}";case 126:return 62==this.peek()?(this.skip(),"~>"):"~"}if(this.unget(),this.parseAlphaNumeric(this.data))return Language.keywords.hasOwnProperty(this.data.value)?Language.keywords[this.data.value]:Language.values.hasOwnProperty(this.data.value)?(this.data.value=Language.values[this.data.value],"BOOLEAN"):"OBSERVABLE";throw this.skip(),new Error("Invalid Token: "+b)},"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.EdenStream=EdenStream,exports.EdenSyntaxData=EdenSyntaxData),Eden.SyntaxError=function(a,b,c){this.type="syntax",this.context=a,this.errno=b,this.extra=c,this.token=a.token,this.prevtoken=a.previous,this.line=a.stream.prevline,this.position=a.stream.position,this.prevposition=a.stream.prevposition},Eden.SyntaxError.UNKNOWN=0,Eden.SyntaxError.EXPCLOSEBRACKET=1,Eden.SyntaxError.BADFACTOR=2,Eden.SyntaxError.ACTIONCOLON=3,Eden.SyntaxError.ACTIONNOWATCH=4,Eden.SyntaxError.ACTIONCOMMAS=5,Eden.SyntaxError.ACTIONOPEN=6,Eden.SyntaxError.ACTIONCLOSE=7,Eden.SyntaxError.LOCALNAME=8,Eden.SyntaxError.LOCALSEMICOLON=9,Eden.SyntaxError.WHENTYPE=10,Eden.SyntaxError.LISTINDEXEXP=11,Eden.SyntaxError.LISTINDEXCLOSE=12,Eden.SyntaxError.LVALUE=13,Eden.SyntaxError.SEMICOLON=14,Eden.SyntaxError.STATEMENT=15,Eden.SyntaxError.DEFINITION=16,Eden.SyntaxError.FUNCCALLEND=17,Eden.SyntaxError.LISTLITCLOSE=18,Eden.SyntaxError.TERNIFCOLON=19,Eden.SyntaxError.IFCONDOPEN=20,Eden.SyntaxError.IFCONDCLOSE=21,Eden.SyntaxError.PARAMNAME=22,Eden.SyntaxError.PARAMSEMICOLON=23,Eden.SyntaxError.FUNCOPEN=24,Eden.SyntaxError.FUNCCLOSE=25,Eden.SyntaxError.FUNCNAME=26,Eden.SyntaxError.FOROPEN=27,Eden.SyntaxError.FORCLOSE=28,Eden.SyntaxError.FORSTART=29,Eden.SyntaxError.FORCOND=30,Eden.SyntaxError.SUBSCRIBEOPEN=31,Eden.SyntaxError.SUBSCRIBECLOSE=32,Eden.SyntaxError.SWITCHOPEN=33,Eden.SyntaxError.SWITCHCLOSE=34,Eden.SyntaxError.DEFAULTCOLON=35,Eden.SyntaxError.CASELITERAL=36,Eden.SyntaxError.CASECOLON=37,Eden.SyntaxError.INSERTCOMMA=38,Eden.SyntaxError.DELETECOMMA=39,Eden.SyntaxError.APPENDCOMMA=40,Eden.SyntaxError.SCOPENAME=41,Eden.SyntaxError.SCOPEEQUALS=42,Eden.SyntaxError.SCOPECLOSE=43,Eden.SyntaxError.BACKTICK=44,Eden.SyntaxError.WHILEOPEN=45,Eden.SyntaxError.WHILECLOSE=46,Eden.SyntaxError.WHILENOSTATEMENT=47,Eden.SyntaxError.NEGNUMBER=48,Eden.SyntaxError.DEFINELISTIX=49,Eden.SyntaxError.OUTOFBOUNDS=50,Eden.SyntaxError.PROPERTYNAME=51,Eden.SyntaxError.WHILEOFDO=52,Eden.SyntaxError.PARAMNUMBER=53,Eden.SyntaxError.AFTEROPEN=55,Eden.SyntaxError.AFTERCLOSE=56,Eden.SyntaxError.ACTIONNAME=57,Eden.SyntaxError.WHENOPEN=58,Eden.SyntaxError.WHENCLOSE=59,Eden.SyntaxError.DONAME=60,Eden.SyntaxError.PROCNAME=61,Eden.SyntaxError.IMPORTPATH=62,Eden.SyntaxError.IMPORTOPTION=63,Eden.SyntaxError.IMPORTCOMB=64,Eden.SyntaxError.IFNOSTATEMENT=65,Eden.SyntaxError.AFTERNOSTATEMENT=66,Eden.SyntaxError.WHENNOSTATEMENT=67,Eden.SyntaxError.LITCHAREMPTY=68,Eden.SyntaxError.LITCHARCLOSE=69,Eden.SyntaxError.LITSTRLINE=70,Eden.SyntaxError.LITSTRCLOSE=71,Eden.SyntaxError.IMPORTTAG=72,Eden.SyntaxError.SWITCHSCRIPT=73,Eden.SyntaxError.RANGEBANNED=74,Eden.SyntaxError.HEREDOCTOKEN=75,Eden.SyntaxError.SELECTORACTION=76,Eden.SyntaxError.SELECTORATTRIB=77,Eden.SyntaxError.SELECTORTAG=78,Eden.SyntaxError.SELECTORBTICK=79,Eden.SyntaxError.SELECTOROPTION=80,Eden.SyntaxError.QUERYOPEN=81,Eden.SyntaxError.QUERYCLOSE=82,Eden.SyntaxError.QUERYSELECTOPEN=83,Eden.SyntaxError.QUERYSELECTCLOSE=84,Eden.SyntaxError.QUERYSELECTCOMMA=85,Eden.SyntaxError.BLOCKCOMMENT=86,Eden.SyntaxError.NEWLINE=87,Eden.SyntaxError.db=[{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return"}"==this.token||"]"==this.token?0:";"==this.token?1:2},suggestion:{expected:[")"],next:[";","+","-","==","<=",">=","!=","/","*","%","^"]}},{message:function(){if("{"==this.token)return 0;if(")"==this.token){var a=this.context.stream.tokenType(this.prevtoken);return"operator"==a?3:1}var b=this.context.stream.tokenType(this.token);return"keyword"==b?4:"operator"==b?3:2},suggestion:{expected:["NUMBER","STRING","OBSERVABLE","&","!","("],next:["NUMBER","STRING","OBSERVABLE","&","!","(",";","+","-","==","<=",">=","!=","/","*","%","^"]}},{message:function(){if("{"==this.token)return 1;if("OBSERVABLE"==this.token)return 0;var a=this.context.stream.tokenType(this.token);return"keyword"==a?3:2},suggestion:{expected:[":"],next:["OBSERVABLE"]}},{message:function(){if("{"==this.token)return 2;if("("==this.token)return 3;if("["==this.token&&(":"==this.prevtoken||","==this.prevtoken))return 6;if("NUMBER"==this.token||"STRING"==this.token)return 4;if(","==this.token)return 5;var a=this.context.stream.tokenType(this.token);return"keyword"==a?0:1},suggestion:{expected:["OBSERVABLE"],next:[",","{"]}},{message:function(){if("{"==this.token)return 0;if("("==this.token&&!this.context.stream.isBEOL())return 1;var a=this.context.stream.tokenType(this.token);return"keyword"==a?2:3},suggestion:{expected:["OBSERVABLE"],next:[",","{"]}},{message:function(){if(("("==this.token||"["==this.token)&&this.context.stream.isBEOL())return 6;if("("==this.token)return 0;if("["==this.token)return 1;if(";"==this.token)return 2;var a=this.context.stream.tokenType(this.token);return"keyword"==a||"identifier"==a?3:"separator"==a?4:5},suggestion:{expected:["{"],next:["local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){return(")"==this.token||"]"==this.token)&&this.context.stream.isBEOL()?0:1},suggestion:{expected:["}"],next:["proc","func","if","for","OBSERVABLE","switch","while","return","continue","break"]}},{message:function(){var a=this.context.stream.tokenType(this.token);return"keyword"==a?0:";"==this.token?1:2},suggestion:{expected:["OBSERVABLE"],next:[";"]}},{message:function(){return"is"==this.token||"="==this.token?1:0},suggestion:{expected:[";"],next:["local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){return 0},suggestion:{expected:["touch","change","("],next:["OBSERVABLE",":","NUMBER","STRING","!","&"]}},{message:function(){return 0},suggestion:{expected:["(","OBSERVABLE","NUMBER"],next:["]","OBSERVABLE","NUMBER","+","-","/","*","%","^"]}},{message:function(){return 1},suggestion:{expected:["]"],next:["[",".","=","+=","-=","==","+","-","/","*",";","/=","*=","%","^","is"]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:[".","[","is","=","+=","-=","++","--","*=","/="]}},{message:function(){if("."==this.token){var a=this.position>=2?this.context.stream.code.charCodeAt(this.position-2):0;return"NUMBER"==this.prevtoken&&32!=a&&160!=a?1:2}return"OBSERVABLE"==this.token?this.context.stream.isBEOL()?3:4:0},suggestion:{expected:[";"],next:["proc","when","OBSERVABLE","if","for","while","EOF","switch","func"]}},{message:function(){return 0},suggestion:{expected:["proc","func","when","if","for","while","switch","OBSERVABLE","{"],next:["OBSERVABLE","(","change","touch","is","=","+=","-=","*=","proc","func","when","if","for","while","switch"]}},{message:function(){return 0},suggestion:{expected:["=","is","+=","-=","/=","*="],next:["(","OBSERVABLE","NUMBER","STRING","!"]}},{message:function(){return 0},suggestion:{expected:[")"],next:[";","(","[","+","-","/","*","%","^"]}},{message:function(){return 0},suggestion:{expected:["]"],next:[]}},{message:function(){return 0},suggestion:{expected:[":"],next:[]}},{message:function(){return 0},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:[")"],next:[]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:[";"]}},{message:function(){return 0},suggestion:{expected:[";"],next:["para","local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){if(("("==this.token||"["==this.token)&&this.context.stream.isBEOL())return 6;if("("==this.token)return 0;if("["==this.token)return 1;if(";"==this.token)return 2;var a=this.context.stream.tokenType(this.token);return"keyword"==a||"identifier"==a?3:"separator"==a?4:5},suggestion:{expected:["{"],next:["local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){return 0},suggestion:{expected:["}"],next:[";"]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:["{"]}},{message:function(){return 0},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:[")"],next:[]}},{message:function(){return 0},suggestion:{expected:[";"],next:[]}},{message:function(){return 0},suggestion:{expected:[";"],next:[]}},{message:function(){return 0},suggestion:{expected:["["],next:[]}},{message:function(){return 0},suggestion:{expected:["]"],next:[]}},{message:function(){return 0},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:["]"],next:[]}},{message:function(){return 0},suggestion:{expected:[":"],next:[]}},{message:function(){return 0},suggestion:{expected:["NUMBER","STRING"],next:[]}},{message:function(){return 0},suggestion:{expected:[":"],next:[]}},{message:function(){return 0},suggestion:{expected:[","],next:[]}},{message:function(){return 0},suggestion:{expected:[","],next:[]}},{message:function(){return 0},suggestion:{expected:[","],next:[]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:[]}},{message:function(){return 0},suggestion:{expected:["="],next:[]}},{message:function(){return 0},suggestion:{expected:["}"],next:[]}},{message:function(){return 0},suggestion:{expected:["`"],next:[]}},{message:function(){return 0; -},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:[")"],next:[]}},{message:function(){return 0},suggestion:{expected:[")"],next:[]}},{message:function(){return 0},suggestion:{expected:["NUMBER"],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){var a=this.context.stream.tokenType(this.token);return"keyword"==a?0:"boolean"==a||"character"==a||"string"==a||"number"==a?1:":"==this.token?4:"{"==this.token?5:"closebracket"==this.token?3:2},suggestion:{expected:["OBSERVABLE"],next:[":"]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}}],Eden.SyntaxError.prototype.extractBefore=function(a){for(var b=this.prevposition;b>0&&a>0&&10!=this.context.stream.code.charCodeAt(b);)b--,a--;return 10==this.context.stream.code.charCodeAt(b)&&b++,this.context.stream.code.substr(b,this.prevposition-b)},Eden.SyntaxError.prototype.extractToken=function(){return this.context.stream.code.substr(this.prevposition,this.position-this.prevposition)},Eden.SyntaxError.prototype.extractAfter=function(a){for(var b=this.position;b0&&10!=this.context.stream.code.charCodeAt(b);)b++,a--;return this.context.stream.code.substr(this.position,b-this.position)},Eden.SyntaxError.prototype.buildSuggestion=function(){var a=Eden.SyntaxError.db[this.errno].suggestion;return a.next.indexOf(this.token)!=-1?this.extractBefore(10)+a.expected[0]+" "+this.extractToken()+this.extractAfter(10):this.extractBefore(10)+a.expected[0]+" "+this.extractAfter(10)},Eden.SyntaxError.prototype.messageText=function(){var a=Eden.SyntaxError.db[this.errno],b=Language.errors[this.errno][a.message.call(this)];return void 0===this.extra?b:b+": "+this.extra},Eden.SyntaxError.prototype.prettyPrint=function(){this.context.stream.pushPosition(),this.context.stream.move(this.position);var a=Eden.SyntaxError.db[this.errno],b=Language.errors[this.errno][a.message.call(this)],c="Error:\n "+b+"\n Source : "+this.context.src+", line "+this.line+"\n Code : "+this.errno;return c+="\n Here : "+this.extractBefore(10)+">>> "+this.extractToken()+" <<<"+this.extractAfter(10),a.suggestion&&(c+="\n Suggestion : "+this.buildSuggestion()),this.context.stream.popPosition(),c},Eden.SyntaxError.prototype.toString=function(){return this.prettyPrint()},Eden.RuntimeError=function(a,b,c,d){this.type="runtime",this.line=-1,this.statement=c,this.extra=d,this.errno=b,this.context=a,this.lastsymbol=eden.root.lastlookup,console.error(d)},Eden.RuntimeError.UNKNOWN=0,Eden.RuntimeError.ASSIGNEXEC=1,Eden.RuntimeError.FUNCCALL=2,Eden.RuntimeError.ACTIONNAME=3,Eden.RuntimeError.NOAGENT=4,Eden.RuntimeError.NOTSUPPORTED=5,Eden.RuntimeError.ASSIGNTODEFINED=6,Eden.RuntimeError.ASSIGNDIMENSION=7,Eden.RuntimeError.EXTENDSTATIC=8,Eden.RuntimeError.INFINITERANGE=9,Eden.RuntimeError.NOLISTRANGE=10,Eden.RuntimeError.LEFTCONCAT=11,Eden.RuntimeError.RIGHTCONCAT=12,Eden.RuntimeError.AGENTSOURCE=13,Eden.RuntimeError.JSOBSERVER=14,Eden.RuntimeError.PROCAGENT=15,Eden.RuntimeError.ARGUMENTS=16,Eden.RuntimeError.NOTCHILD=17,Eden.RuntimeError.prototype.messageText=function(){var a=!this.statement||"functioncall"!=this.statement.type&&"definition"!=this.statement.type&&"assignment"!=this.statement.type?"":"'"+this.statement.lvalue.name+"': ";switch(this.errno){case Eden.RuntimeError.ACTIONNAME:case Eden.RuntimeError.NOAGENT:case Eden.RuntimeError.NOTSUPPORTED:case Eden.RuntimeError.AGENTSOURCE:case Eden.RuntimeError.JSOBSERVER:case Eden.RuntimeError.PROCAGENT:case Eden.RuntimeError.ARGUMENTS:case Eden.RuntimeError.EXTENDSTATIC:return a+this.extra;case Eden.RuntimeError.ASSIGNTODEFINED:return a+"cannot assign to a defined list, use 'is'";case Eden.RuntimeError.ASSIGNDIMENSION:return a+"list does not have this many dimensions";case Eden.RuntimeError.RIGHTCONCAT:return a+"Concatenation: When the right hand side is a list then the left hand side must also be a list";case Eden.RuntimeError.LEFTCONCAT:return a+"Concatenation: When the left hand side is a list then the right hand side must also be a list";case Eden.RuntimeError.INFINITERANGE:return a+"range scope is infinite";case Eden.RuntimeError.NOLISTRANGE:return a+"range 'in' is not a list"}return String(this.extra).search("is not a function")>=0?a+"function used does not exist":this.errno==Eden.RuntimeError.FUNCCALL&&String(this.extra).search("Cannot read property 'call'")>=0?a+"procedure does not exist":String(this.extra).match(/Cannot read property .* of undefined/)?a+"uses an undefined list":this.extra},Eden.RuntimeError.prototype.edenSource=function(){if(this.statement)if("definition"==this.statement.type){var a=eden.root.symbols[this.statement.lvalue.name];if(a&&a.definition)return a.getSource()}else if(this.context)return this.context.getSource(this.statement)},Eden.RuntimeError.prototype.javascriptSource=function(){return this.statement.generate({scopes:[],dependencies:{}},"scope")},Eden.RuntimeError.prototype.details=function(){var a="";return"definition"!=this.statement.type&&"assignment"!=this.statement.type||(a+="Symbol: "+this.statement.lvalue.name+"\n"),a+=String(this.extra).search("SyntaxError")>=0?"JavaScript: "+this.javascriptSource()+"\n":"Source: "+this.edenSource()+"\n",this.extra.message&&(a+="Original: "+this.extra.message+"\n"),a},Eden.RuntimeError.prototype.prettyPrint=function(){return this.extra&&this.extra.stack?"Run-time Error:\n"+this.extra.stack:"Run-time Error:\n"},Eden.Selectors={cache:{}},Eden.Selectors.getScriptBase=function(a){for(var b=a;b.parent;)b=b.parent;return b.base.origin.name},Eden.Selectors.buildScriptTree=function(a){for(var b={},c=0;c ")},Eden.Selectors.getPath=function(a){},Eden.Selectors.testType=function(a){if("binaryop"==a.type)switch(a.op){case"+":case"-":case"/":case"*":case"^":case"%":return"number";case"//":return"list";case"==":case"<":case">":case"<=":case">=":case"||":case"&&":case"!=":return"boolean";default:return"unknown"}else if("literal"==a.type)switch(a.datatype){case"NUMBER":return"number";case"BOOLEAN":return"boolean";case"STRING":return"string";case"LIST":return"list";default:return"unknown"}return"unknown"},Eden.Selectors.getChildren=function(a,b){var c=[];if(void 0===a)return c;for(var d=0;da[d].depth);)"dummy"!=e.type&&(c.push(e),f.push(e)),e=e.nextSibling;b&&c.push.apply(c,Eden.Selectors.getChildren(f,b))}return c=c.filter(function(a){return"dummy"!=a.type})},Eden.Selectors.allowedOptions={external:!0,history:!0,all:!0,indexed:!0,index:!0,nosort:!0,remote:!0},Eden.Selectors.resultTypes={brief:!0,comment:!0,source:!0,innersource:!0,title:!0,path:!0,name:!0,symbol:!0,line:!0,depends:!0,value:!0,tags:!0,rawcomment:!0,id:!0,remote:!0,root:!0,enabled:!0,executed:!0,exprtree:!0},Eden.Selectors.expressionToLists=function(a){switch(a.type){case"binaryop":return[Eden.Selectors.expressionToLists(a.l),a.op,Eden.Selectors.expressionToLists(a.r)];case"ternaryop":return[Eden.Selectors.expressionToLists(a.first),"if",Eden.Selectors.expressionToLists(a.condition),"else",Eden.Selectors.expressionToLists(a.second)];case"unaryop":return[a.op,Eden.Selectors.expressionToLists(a.r)];case"length":return[Eden.Selectors.expressionToLists(a.l),"#"];case"index":return Eden.Selectors.expressionToLists(a.expression)}if(console.log(a),"functioncall"==a.type){console.log("FUNCCALL");for(var b=[],c=0;c0;break;case"historic":i=f.executed==-1;break;case"tags":f.doxyComment&&(i=f.doxyComment.getHashTags());break;case"rawcomment":f.doxyComment&&(i=f.doxyComment.content);break;case"controls":case"id":i=f.id;break;case"path":i=Eden.Selectors.getID(f);break;case"remote":for(var l=f;l.parent;)l=l.parent;if(!l.base||!l.base.origin){i=!1;break}i=l.base.origin.remote;break;case"root":i=void 0===f.parent}g.push(i)}c.length>1?d.push(g):1==c.length&&g.length>0&&d.push(g[0])}return d}return a},Eden.Selectors.outerBracket=function(a){for(var b=0,c=0;c0&&"@"==a.charAt(0);){c||(c={}),a=a.substring(1);var d=a.search(/[^a-z]+/);d==-1&&(d=a.length);var e=a.substring(0,d);a=a.substring(d).trim(),c[e]=!0}return Eden.Selectors._parse(a,c)}},Eden.Selectors._parse=function(a,b){var c;if(a&&""!=a){if(">"==a.charAt(0))">"==a.charAt(1)?(c=new Eden.Selectors.NavigateNode(">",(!0)),a=a.substring(2).trim()):(c=new Eden.Selectors.NavigateNode(">",(!1)),a=a.substring(1).trim());else if("<"==a.charAt(0))"<"==a.charAt(1)?(c=new Eden.Selectors.NavigateNode("<",(!0)),a=a.substring(2).trim()):(c=new Eden.Selectors.NavigateNode("<",(!1)),a=a.substring(1).trim());else if(","==a.charAt(0))c=new Eden.Selectors.UnionNode,a=a.substring(1).trim();else if(":"==a.charAt(0)||"."==a.charAt(0)){var d=a.substring(1),e=d.search(/[^a-zA-Z0-9\-]/);e==-1?e=a.length:e++;var f=a.substring(0,e),g=void 0;if(e]/);j==-1&&(j=a.length);var k=a.substring(0,j).trim();if(k.startsWith("plugins")){for(var l=a.split(">"),m="",n=0;n0){for(var c=0;c0?c(0):b&&b()})},Eden.Selectors.goto=function(a){Eden.Selectors.query(a,void 0,{minimum:1,noindex:!0},function(b){if(0==b.length)return!1;for(var c=[b[0]],d=b[0];d.parent;)c.push(d.parent),d=d.parent;for(var e=!1,f=0;f":this.compare="="==b.charAt(1)?">=":">";break;case"=":this.compare="=";break;case"!":this.compare="!="}if(this.compare)switch(this.compare){case"!":case"=":case">":case"<":this.value=b.substring(1);break;case">=":case"<=":this.value=b.substring(2)}if(this.isreg?this.value=Eden.Selectors.makeRegex(this.value):null!==b.match(/^[0-9]+\-[0-9]+$/)?this.range=!0:null!==b.match(/^[0-9]+$/)&&(this.value=parseInt(b)),".type"==this.name)switch(this.param){case"is":this.param="definition";break;case"assign":case"=":this.param="assignment";break;case"call":this.param="functioncall";break;case"proc":this.param="action";break;case"action":this.param="script";break;case"+=":case"-=":case"*=":case"/=":case"++":case"--":this.param="modify"}}},Eden.Selectors.PropertyNode.attributes={name:{local:!1,indexed:!0,rank:1},type:{local:!1,indexed:!1,rank:3},datatype:{local:!1,indexed:!1,rank:30},id:{local:!1,indexed:!0,rank:2},lines:{local:!1,indexed:!1,rank:3},depends:{local:!1,indexed:!1,rank:4},time:{local:!0,indexed:!1,rank:3},date:{local:!1,indexed:!1,rank:3},title:{local:!1,indexed:!1,rank:10},author:{local:!1,indexed:!1,rank:10},v:{local:!1,indexed:!1,rank:20},version:{local:!1,indexed:!1,rank:20},source:{local:!0,indexed:!1,rank:50},comment:{local:!0,indexed:!1,rank:50}},Eden.Selectors.PropertyNode.pseudo={line:{local:!1,indexed:!1,rank:50},determines:{local:!0,indexed:!0,rank:10},first:{local:!1,indexed:!0,rank:5},last:{local:!1,indexed:!0,rank:5},unexecuted:{local:!0,indexed:!1,rank:3},executed:{local:!0,indexed:!1,rank:3},root:{local:!1,indexed:!0,rank:3},project:{local:!0,indexed:!0,rank:3},nth:{local:!1,indexed:!0,rank:5},value:{local:!0,indexed:!1,rank:50},matches:{local:!1,indexed:!1,rank:100},age:{local:!1,indexed:!1,rank:6},remote:{local:!0,indexed:!0,rank:20},not:{local:!1,indexed:!1,rank:100},active:{local:!0,indexed:!1,rank:10},me:{local:!1,indexed:!1,rank:20},listed:{local:!1,indexed:!1,rank:20}},Eden.Selectors.PropertyNode.prototype.append=function(a){if(!a)return this;switch(a.type){case"property":case"tag":case"name":var b=new Eden.Selectors.IntersectionNode(this,a);return b.options=this.options,b;case"union":case"intersection":return a.prepend(this),a;case"navigate":return a.prepend(this),a}return this},Eden.Selectors.PropertyNode.prototype.prepend=function(a){if(!a)return this;switch(a.type){case"property":case"tag":case"name":var b=new Eden.Selectors.IntersectionNode(a,this);return b.options=this.options,b;case"union":case"intersection":return a.append(this),a;case"navigate":return a.append(this),a}return this},Eden.Selectors.PropertyNode.prototype.filter=function(a){a||(a=this.construct());var b=this,c=this.value,d=this.name;if("number"==typeof this.name)return a&&a.length>=this.name?[a[this.name-1]]:[];switch(d){case".name":if(!c)return a.filter(function(a){return void 0!==a.lvalue||void 0!==a.name});var e=edenUI.regExpFromStr(c);return a.filter(function(a){return a.lvalue&&e.test(a.lvalue.name)||a.name&&e.test(a.name)});case".id":return a.filter(function(a){return 0==a.id&&a.buildID(),a.id==c});case".type":if(!c)break;return a.filter(function(a){return a.type==c});case".datatype":return a.filter(function(a){return a.expression&&Eden.Selectors.testType(a.expression)==c||a.expression&&"scope"==a.expression.type&&a.expression.range&&"list"==c});case".lines":return a;case":line":return a;case".op":case".operator":return a;case":pattern":return a;case":determines":return a;case".depends":return a.filter(function(a){return("definition"==a.type||"when"==a.type)&&a.dependencies[c]});case":active":return a.filter(function(a){if("definition"==a.type||"assignment"==a.type){var b=eden.root.symbols[a.lvalue.name];return b&&(b.origin===a||b.origin&&b.origin.id==a.id)}return"when"==a.type&&a.enabled});case":first":return a.length>0?[a[0]]:[];case":last":return a.length>0?[a[a.length-1]]:[];case":unexecuted":return a.filter(function(a){return 0==a.executed});case":executed":return a.filter(function(a){return 1==a.executed});case":root":return a.filter(function(a){return void 0===a.parent});case":project":return[eden.project.ast.script];case":nth":return a.filter(function(a){return a.parent&&Eden.Selectors.getChildren([a.parent],!1)[b.value-1]===a});case":value":return a;case":":case":matches":var f=Eden.Selectors.parse(this.param);return f?f.filter(a):[];case".title":return this.isreg?a.filter(function(a){if(!a.doxyComment)return!1;var c=a.doxyComment.getProperty("title");return c&&b.value.test(c)}):a.filter(function(a){if(!a.doxyComment)return!1;var c=a.doxyComment.getProperty("title");return c&&c==b.value});case".author":return a;case".version":return a;case".source":return this.isreg?a.filter(function(a){return b.value.test(a.getSource())}):a.filter(function(a){return a.getSource()==b.value});case".comment":return this.isreg?a.filter(function(a){return a.doxyComment&&b.value.test(a.doxyComment.stripped())}):a.filter(function(a){return a.doxyComment&&a.doxyComment.stripped()==b.value});case":age":var g=generateTimeStamp(this.value),h=Date.now(),i=h-g;return console.log("AGE",g,h,i),void 0===this.compare||"<"==this.compare?a.filter(function(a){return a.stamp>i}):a.filter(function(a){return a.stamp=0})},Eden.Selectors.NameNode=function(a){this.type="name",this.name=a,this.options=void 0,this.isreg="/"==a.charAt(0)||a.indexOf("*")!=-1,this.local=!1},Eden.Selectors.NameNode.prototype.filter=function(a){if(!a)return this.construct();var b=this.name;if(this.isreg){var c=Eden.Selectors.makeRegex(this.name);return a.filter(function(a){return a.lvalue&&c.test(a.lvalue.name)||a.name&&c.test(a.name)})}return a.filter(function(a){return a.lvalue&&a.lvalue.name==b||a.name&&a.name==b})},Eden.Selectors.NameNode.prototype.construct=function(){if(this.isreg){var a=Eden.Selectors.makeRegex(this.name);stats=Eden.Index.getByNameRegex(a)}else{stats=Eden.Index.getByName(this.name);for(var b=this.name.toLowerCase().split(" "),c=Eden.Index.getByTag("#"+b[0]),d=1;d=0})},Eden.Selectors.NameNode.prototype.append=Eden.Selectors.PropertyNode.prototype.append,Eden.Selectors.NameNode.prototype.prepend=Eden.Selectors.PropertyNode.prototype.prepend,Eden.Selectors.TagNode=function(a){this.type="tag",this.tag=a,this.options=void 0,this.isreg=a.indexOf("*")!=-1,this.local=!1},Eden.Selectors.TagNode.prototype.filter=function(a){if(!a)return this.construct();var b=this;return a.filter(function(a){return a.doxyComment&&a.doxyComment.hasTag(b.tag)})},Eden.Selectors.TagNode.prototype.construct=function(){if(this.isreg){var a=Eden.Selectors.makeRegex(this.tag);stats=Eden.Index.getByTagRegex(a)}else stats=Eden.Index.getByTag(this.tag);return this.options&&this.options.history?stats:stats.filter(function(a){return a.executed>=0; -})},Eden.Selectors.TagNode.prototype.append=Eden.Selectors.PropertyNode.prototype.append,Eden.Selectors.TagNode.prototype.prepend=Eden.Selectors.PropertyNode.prototype.prepend,Eden.Selectors.IntersectionNode=function(a,b){this.type="intersection",this.children=[a,b],this.local=!1},Eden.Selectors.IntersectionNode.prototype.append=function(a){if(!a)return this;switch(a.local&&(this.local=!0),a.type){case"navigate":return a.prepend(this),a}return this.children.push(a),this},Eden.Selectors.IntersectionNode.prototype.prepend=function(a){return a?(a.local&&(this.local=!0),this.children.splice(0,0,a),this):this},Eden.Selectors.IntersectionNode.prototype.filter=function(a,b){for(var c=0;c"==this.direction){if(!a&&void 0===this.left)return this.right?this.right.filter(a,b).filter(function(a){return void 0!==a.parent}):Eden.Index.getAll().filter(function(a){return void 0!==a.parent});var c;return c=void 0===this.left?Eden.Selectors.getChildren(a,this.deep):Eden.Selectors.getChildren(this.left.filter(a,b),this.deep),this.right?this.right.filter(c,b):c}if("<"==this.direction){if(!a&&void 0===this.left)return this.right?this.right.filter(a,b).filter(function(a){return"script"==a.type||"when"==a.type||"if"==a.type||"for"==a.type}):Eden.Index.getAll().filter(function(a){return"script"==a.type||"when"==a.type||"if"==a.type||"for"==a.type});var c;if(c=void 0===this.left?a.filter(function(a){return"script"==a.type||"when"==a.type||"if"==a.type||"for"==a.type}):this.left.filter(a,b),this.deep){for(var d=[],e=0;e=0&&Eden.Index.name_index[d].splice(e,1)}if(a.tags)for(var f=a.tags,c=0;c=0&&Eden.Index.tag_index[f[c]].splice(e,1)}}}},Eden.Index.update=function(a){if(void 0===Eden.Index.id_index[a.id]&&(Eden.Index.id_index[a.id]=[]),Eden.Index.id_index[a.id].push(a),1==Eden.Index.id_index[a.id].length){if(void 0===Eden.Index.type_index[a.type]&&(Eden.Index.type_index[a.type]={}),Eden.Index.type_index[a.type][a.id]=!0,a.name&&"do"!=a.type||a.lvalue){var b=a.name?a.name:a.lvalue.name;void 0===Eden.Index.name_index[b]&&(Eden.Index.name_index[b]=[]),Eden.Index.name_index[b].indexOf(a.id)==-1&&Eden.Index.name_index[b].push(a.id)}if(a.tags)for(var c=a.tags,d=0;d0&&this.errors.push.apply(this.errors,a.errors),a&&a.warning&&(this.warning=a.warning)},Eden.AST.debug=!1,Eden.AST.debugstep=!1,Eden.AST.debugstep_cb=void 0,Eden.AST.debugspeed=500,Eden.AST.debugbreakpoint=void 0,Eden.AST.debugbreakpoint_cb=void 0,Eden.AST.debug_begin_cb=void 0,Eden.AST.debug_end_cb=void 0,Eden.AST.fromNode=function(a,b){var c=new Eden.AST(a.getInnerSource(),(void 0),b,{noindex:!0,noparse:!0});return c.script=a,c.whens=Eden.Selectors.queryWithin([a],">>.type(when)"),c.errors=a.errors,c},Eden.AST.prototype.doxyFromOrigin=function(){var a=this.origin.name;if(this.origin.title&&(a+="\n * @title "+this.origin.title),this.origin.author&&(a+="\n * @author "+this.origin.author),this.origin.id&&(a+="\n * @id "+this.origin.id),this.origin.saveID&&(a+="\n * @version "+this.origin.vid),this.origin.tags&&this.origin.tags.length>0){a+="\n *";for(var b=0;b>"),b=0;b0&&(this.lines[a].executed=0)},Eden.AST.prototype.executeLine=function(a,b,c){var d,e=a;d=a==-1?this.script:this.lines[e],void 0!==d&&(d=this.getBase(d),this.executeStatement(d,e,b,c))},Eden.AST.parseStatement=function(a,b){var c=new Eden.AST(a,(void 0),b?b:{},{noparse:!0,noindex:!0});c.next();var d=c.pSTATEMENT();d.base=c,d.setSource(0,a.length,a),d.stamp=c.stamp;var e=a.match("\n");return null===e?d.numlines=0:d.numlines=e.length,d},Eden.AST.parseScript=function(a,b){var c=new Eden.AST(a,(void 0),b?b:{},{noparse:!0,noindex:!0});c.next();var d=c.pSCRIPT();d.base=c,d.setSource(0,a.length,a),d.stamp=c.stamp;var e=a.match("\n");return null===e?d.numlines=0:d.numlines=e.length,d},Eden.AST.parseExpression=function(a){var b=new Eden.AST(a,(void 0),{},{noparse:!0,noindex:!0});b.next();var c=b.pEXPRESSION();return c},Eden.AST.registerStatement=function(a){a.prototype.getOrigin=Eden.AST.BaseStatement.getOrigin,a.prototype.hasErrors=Eden.AST.BaseStatement.hasErrors,a.prototype.setSource=Eden.AST.BaseStatement.setSource,a.prototype.getSource=Eden.AST.BaseStatement.getSource,a.prototype.getOuterSource=Eden.AST.BaseStatement.getOuterSource,a.prototype.getNumberOfLines=Eden.AST.BaseStatement.getNumberOfLines,a.prototype.getStartLine=Eden.AST.BaseStatement.getStartLine,a.prototype.getEndLine=Eden.AST.BaseStatement.getEndLine,a.prototype.getRange=Eden.AST.BaseStatement.getRange,a.prototype.error=Eden.AST.fnEdenASTerror,a.prototype.addIndex=Eden.AST.BaseStatement.addIndex,a.prototype.removeIndex=Eden.AST.BaseStatement.removeIndex,a.prototype.destroy=Eden.AST.BaseStatement.destroy,a.prototype.buildID=Eden.AST.BaseStatement.buildID,a.prototype.setDoxyComment=Eden.AST.BaseStatement.setDoxyComment},Eden.AST.registerScript=function(a){Eden.AST.registerStatement(a),a.prototype.getStatementByLine=Eden.AST.BaseScript.getStatementByLine,a.prototype.getRelativeLine=Eden.AST.BaseScript.getRelativeLine,a.prototype.getNumberOfLines=Eden.AST.BaseScript.getNumberOfLines,a.prototype.append=Eden.AST.BaseScript.append,a.prototype.appendChild=Eden.AST.BaseScript.appendChild,a.prototype.removeChild=Eden.AST.BaseScript.removeChild,a.prototype.insertBefore=Eden.AST.BaseScript.insertBefore,a.prototype.insertAfter=Eden.AST.BaseScript.insertAfter,a.prototype.replaceChild=Eden.AST.BaseScript.replaceChild,a.prototype.addIndex=Eden.AST.BaseScript.addIndex,a.prototype.removeIndex=Eden.AST.BaseScript.removeIndex,a.prototype.destroy=Eden.AST.BaseScript.destroy,a.prototype.buildID=Eden.AST.BaseScript.buildID},Eden.AST.registerContext=function(a){Eden.AST.registerScript(a)},Eden.AST.prototype.getBase=function(a,b){void 0===b&&console.error("Undefined context in getBase");for(var c=a;c&&c.parent&&c.parent!==b;)c=c.parent;return c},Eden.AST.prototype.getBlockLines=function(a,b){for(var c=a,d=this.getBase(this.lines[c],b);c>0&&this.lines[c-1]&&this.getBase(this.lines[c-1],b)==d;)c--;for(var e=c;c0},Eden.AST.prototype.prettyPrint=function(){var a="";if(this.script.errors.length>0)for(var b=0;b0);)this.token=this.stream.readToken(),"/*"==this.token?b++:"*/"==this.token&&b--;if("*/"!=this.token){var f=new Eden.SyntaxError(this,Eden.SyntaxError.BLOCKCOMMENT);f.line=e,this.errors.push(f)}if(c){var g=new Eden.AST.DoxyComment(this.stream.code.substring(d+3,this.stream.position-2).trim(),e,this.stream.line);this.lastDoxyComment.push(g),g.parent=this.parentDoxy,g.content.endsWith("@{")?this.parentDoxy=g:g.content.startsWith("@}")&&this.parentDoxy&&(this.parentDoxy=this.parentDoxy.parent)}this.token=this.stream.readToken()}else{if("${{"!=this.token)break;var d=this.stream.position,e=this.stream.line;for(this.data.line=e;this.stream.valid()&&"}}$"!=this.token;)this.token=this.stream.readToken();this.data.value=this.stream.code.substring(d,this.stream.position-3),this.token="JAVASCRIPT",this.stream.prevposition=d-3}this.stream.prevline=a},Eden.AST.prototype.peekNext=function(a){var b,c={value:""};for(this.stream.data=c,this.stream.pushPosition();a>0;)b=this.stream.readToken(),a--;return this.stream.popPosition(),this.stream.data=this.data,b},Eden.AST.BaseStatement=function(){this.start=0,this.end=0,this.parent=void 0,this.errors=[],this.warning=void 0,this.executed=0,this.numlines=-1,this.doxyComment=void 0,this.lock=0,this.source=void 0,this.id=0,this.stamp=0,this.nextSibling=void 0,this.previousSibling=void 0,this.tags=void 0},Eden.AST.BaseStatement.setDoxyComment=function(a){this.doxyComment=a,a&&(void 0===this.tags?this.tags=a.getHashTags():this.tags=this.tags.concat(a.getHashTags()))},Eden.AST.BaseStatement.buildID=function(){var a,b=0,c=this.source;this.doxyComment&&(c=this.doxyComment.content+c);for(var d=c.length,e=0;e0},Eden.AST.BaseStatement.getNumberOfLines=function(){return this.numlines},Eden.AST.BaseStatement.getStartLine=function(a){return this.parent?this.parent.getRelativeLine(this,a):-1},Eden.AST.BaseStatement.getEndLine=function(a){return this.getStartLine(a)+this.getNumberOfLines()},Eden.AST.BaseStatement.getRange=function(a){var b=this.getStartLine(a);return[b,b+this.getNumberOfLines()]},Eden.AST.BaseStatement.setSource=function(a,b,c){this.start=a,this.end=b,this.source=c},Eden.AST.BaseStatement.getSource=function(){return this.source},Eden.AST.BaseStatement.getOuterSource=function(){var a=this.getSource();void 0===this.parent&&(a="action "+this.name+"{"+a+"}"),this.doxyComment&&(a="/** "+this.doxyComment.content+" */\n"+a);for(var b=this.parent;b;)"script"==b.type?(a=b.name?"action "+b.name+" {\n"+a+"\n}":"{\n"+a+"\n}",b.doxyComment&&(a="/** "+b.doxyComment.content+" */\n"+a),b=b.parent):b=void 0;return a},Eden.AST.BaseStatement.getOrigin=function(){for(var a=this;a.parent;)a=a.parent;return a.base?a.base.origin:void 0},Eden.AST.BaseScript=function(){Eden.AST.BaseStatement.apply(this),this.statements=[],this.parameters=void 0,this.locals=void 0,this.indexed=!1},Eden.AST.BaseScript.appendChild=function(a){this.statements.push(a),this.statements.length>1&&(a.previousSibling=this.statements[this.statements.length-2],this.statements[this.statements.length-2].nextSibling=a),a.parent=this,this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this),"dummy"!=a.type&&this.indexed&&a.addIndex(),a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.BaseScript.append=Eden.AST.BaseScript.appendChild,Eden.AST.BaseScript.insertAfter=function(a,b){var c;for(c=0;c0&&this.errors.push.apply(this.errors,b.errors),this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this)},Eden.AST.BaseScript.insertBefore=function(a,b){var c;for(c=0;c0&&this.errors.push.apply(this.errors,b.errors),void(this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this))):void eden.emit("error",[new Eden.RuntimeError((void 0),Eden.RuntimeError.NOCHILD,this,"Statement is not a child when using insertBefore")])},Eden.AST.BaseScript.removeChild=function(a){var b;for(b=0;b=this.statements.length)return void eden.emit("error",[new Eden.RuntimeError((void 0),Eden.RuntimeError.NOCHILD,this,"Statement is not a child when using replaceChild")]);c=d}b.nextSibling=this.statements[c].nextSibling,b.nextSibling&&(b.nextSibling.previousSibling=b),b.previousSibling=this.statements[c].previousSibling,b.previousSibling&&(b.previousSibling.nextSibling=b),this.statements[c].destroy(),this.statements[c]=b,b.parent=this,"dummy"!=b.type&&this.indexed&&b.addIndex(),this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this)},Eden.AST.BaseScript.destroy=function(){this.executed<1&&Eden.Index.remove(this);for(var a=0;aa)&&void 0!==this.statements)for(var d=0;d=c&&a<=c+e&&"dummy"!=this.statements[d].type)return this.statements[d];c+=e}},Eden.AST.BaseScript.getRelativeLine=function(a,b){var c=0;b&&b!==this&&this.parent&&(c=this.parent.getRelativeLine(this,b));for(var d=0;d0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Append.prototype.setIndex=function(a){this.index=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Append.prototype.generate=function(a,b){var c=this.index.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),d=this.destination.generate(a,b);return this.destination.islocal?d+".push("+c+");\n":b+".mutate("+d+", function(s) { scope.lookup(s.name).value.push("+c+"); }, this);"},Eden.AST.Append.prototype.execute=function(a,b,c,d){this.executed=1;var e=this.index.execute(a,b,c);e instanceof BoundValue&&(e=e.value);var f=eden.root.lookup(this.destination.name),g=f.value(c);g.push(e),f.assign(g,c,this)},Eden.AST.registerStatement(Eden.AST.Append),Eden.AST.Assignment=function(a){this.type="assignment",Eden.AST.BaseContext.apply(this),this.errors=a?a.errors:[],a&&a.warning&&(this.warning=a.warning),this.expression=a,this.lvalue=void 0,this.compiled=void 0,this.dirty=!1,this.value=void 0,this.compiled=void 0},Eden.AST.Assignment.prototype.left=function(a){this.lvalue=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Assignment.prototype.generate=function(a,b){var c=this.lvalue.generate(a,b);return this.lvalue.islocal?(c+=" = ",c+=this.expression.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),c+=";\n"):this.lvalue.hasListIndices()?(c=b+".listAssign("+c+",",c+=this.expression.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),c+=", Symbol.localJSAgent, false, ",c+=this.lvalue.generateCompList(a,b),c+=");\n"):(c=b+".assign("+c+",",c+=this.expression.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),c+=", Symbol.localJSAgent);\n")},Eden.AST.Assignment.prototype.compile=function(ctx){if(!this.compiled||this.dirty){this.dirty=!1,ctx?ctx.scopes=this.scopes:ctx=this;var rhs="(function(context,scope,cache,ctx) { \n",express=this.expression.generate(ctx,"scope",{bound:!0});if(ctx&&ctx.dirty&&(ctx.dirty=!1,this.dirty=!0),this.scopes.length>0){rhs+="\tvar _scopes = [];\n";for(var i=0;i0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.After.prototype.setStatement=function(a){this.statement=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.After.prototype.generate=function(a,b){void 0===b&&(b="eden.root.scope");var c="(function() {"+this.statement.generate(a,b,{bound:!1})+"})",d=this.expression.generate(a,b,{bound:!1});return"setTimeout("+c+", "+d+");\n"},Eden.AST.After.prototype.execute=function(ctx,base,scope){var statement="(function() { var scope = eden.root.scope;\n"+this.statement.generate(ctx,"root.scope")+"})";setTimeout(eval(statement),this.expression.execute(ctx,base,scope))},Eden.AST.registerStatement(Eden.AST.After),Eden.AST.BinaryOp=function(a){this.type="binaryop",this.op=a,this.errors=[],this.l=void 0,this.r=void 0,this.warning=void 0,"&"==this.op||"and"==this.op?this.op="&&":"|"!=this.op&&"or"!=this.op||(this.op="||")},Eden.AST.BinaryOp.prototype.left=Eden.AST.fnEdenASTleft,Eden.AST.BinaryOp.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.BinaryOp.prototype.setRight=function(a){this.r=a,this.errors.push.apply(this.errors,a.errors),a&&a.warning&&(this.warning=a.warning)},Eden.AST.BinaryOp.prototype.generate=function(a,b,c){var d,e={bound:!1,usevar:c.usevar},f=this.l.generate(a,b,e),g=this.r.generate(a,b,e);switch(this.op){case"//":d="concat";break;case"+":d="add";break;case"-":d="subtract";break;case"/":d="divide";break;case"*":d="multiply";break;case"==":d="equal";break;case"%":d="mod";break;case"^":d="pow";break;default:d="RAW"}var h;return h="RAW"!=d?"rt."+d+"(("+f+"),("+g+"))":"("+f+") "+this.op+" ("+g+")",c.bound?"new BoundValue("+h+", "+b+")":h},Eden.AST.BinaryOp.prototype.execute=function(ctx,base,scope){var rhs="(function(context,scope) { return ";return rhs+=this.generate(ctx,"scope",{bound:!1}),rhs+=";})",eval(rhs)(eden.root,scope)},Eden.AST.Break=function(){this.type="break",Eden.AST.BaseStatement.apply(this)},Eden.AST.Break.prototype.generate=function(a,b){return"break; "},Eden.AST.Break.prototype.execute=function(a,b,c,d){var e=new Eden.RuntimeError(b,Eden.RuntimeError.NOTSUPPORTED,this,"Break not supported here");e.line=this.line,this.errors.push(e),Eden.Agent.emit("error",[d,e])},Eden.AST.registerStatement(Eden.AST.Break),Eden.AST.Case=function(){this.type="case",Eden.AST.BaseStatement.apply(this),this.datatype="",this.literal=void 0},Eden.AST.Case.prototype.setLiteral=function(a,b){this.datatype=a,this.literal=b},Eden.AST.Case.prototype.generate=function(a,b){return"string"==typeof this.literal?'case "'+this.literal+'": ':"case "+this.literal+": "},Eden.AST.Case.prototype.execute=function(a,b,c,d){var e=new Eden.RuntimeError(b,Eden.RuntimeError.NOTSUPPORTED,this,"Case not supported here");e.line=this.line,this.errors.push(e),Eden.Agent.emit("error",[d,e])},Eden.AST.registerStatement(Eden.AST.Case),Eden.AST.CodeBlock=function(){this.type="codeblock",Eden.AST.BaseContext.apply(this),this.params=void 0,this.locals=void 0,this.script=void 0},Eden.AST.CodeBlock.prototype.setLocals=function(a){this.locals=a,this.errors.push.apply(this.errors,a.errors)},Eden.AST.CodeBlock.prototype.setParams=function(a){this.params=a,this.errors.push.apply(this.errors,a.errors)},Eden.AST.CodeBlock.prototype.setScript=function(a){this.script=a,a&&(a.parent=this,this.errors.push.apply(this.errors,a.errors))},Eden.AST.CodeBlock.prototype.generate=function(a){var b="(function(context, scope) {\n";if(this.locals&&this.locals.list)for(var c=0;c5)return new Date(b).toDateString();var i="";if(g>0)i+=g,i+=g>1?" days ago":" day ago";else if(h.getUTCHours()>0){var j=h.getUTCHours();i+=j,i+=j>1?" hours ago":" hour ago"}else{var k=h.getUTCMinutes();if(k>0)i+=k,i+=k>1?" minutes ago":" minute ago";else{var l=h.getUTCSeconds();i+=l,i+=" seconds ago"}}return i}function generateTimeStamp(a){for(var b,c=/(\d*)(minutes|minute|min|hours|hour|days|day|weeks|week|months|month|mon|years|year|Quarters|Quarter|seconds|second|sec|s|m|h|d|M|y|Y|Q|ms|w)/g,d=0;null!==(b=c.exec(a));)switch(console.log("Reltime:",b),b[2]){case"second":case"seconds":case"s":d+=1e3*parseInt(b[1]);break;case"minute":case"minutes":case"m":d+=6e4*parseInt(b[1]);break;case"hour":case"hours":case"h":d+=36e5*parseInt(b[1]);break;case"days":case"d":d+=36e5*parseInt(b[1])*24}return d}function hashCode(a){var b=0;if(0==a.length)return b;for(i=0;i1?eden.root.lookup("jseden_url_"+x).assign(urlparams[x],eden.root.scope,Symbol.localJSAgent):eden.root.lookup("jseden_url_"+x).assign(urlparams[x][0],eden.root.scope,Symbol.localJSAgent);""==lang&&(lang="en");var plugins,defaultPlugins=["Canvas2D","DependencyMap","HTMLContent","PluginManager","ScriptInput","SymbolLookUpTable","SymbolViewer","Debugger","VersionViewer"];if(""==pluginsStr)plugins=defaultPlugins;else{var includeDefaultPlugins=" "==pluginsStr[0];includeDefaultPlugins&&(pluginsStr=pluginsStr.slice(1)),plugins=pluginsStr.split(","),includeDefaultPlugins&&(plugins=plugins.concat(defaultPlugins)),""!=views&&"default"!=views||(plugins.push("Canvas2D"),plugins.push("ScriptInput"))}$(document).ready(function(){function invalidVersion(a){$(".loadmessage").html(a)}var browser=$.browser,bversion=browser.version.split(".");bversion=parseInt(bversion[0]),browser.msie?bversion<13&&invalidVersion("Microsoft Internet Explorer is not supported, use Edge, Firefox or Chrome."):browser.mozilla?bversion<29&&invalidVersion("Please upgrade your version of Firefox/Mozilla."):browser.webkit&&!browser.chrome?invalidVersion("Your browser is not supported by JS-Eden, please use Edge, Firefox or Chrome."):browser.chrome?bversion<39&&invalidVersion("Please upgrade your version of Chrome"):invalidVersion(browser.opera?"Opera is not supported, use Chrome or Firefox.":"Your browser is not supported by JS-Eden, use Firefox or Chrome."),edenUI=new EdenUI(eden),edenUI.scrollBarSize2=window.innerHeight-$(window).height(),Eden.Project.init(),eden.ismobile=mobilecheck(),eden.root.lookup("jseden_mobile").assign(eden.ismobile,eden.root.scope,Symbol.defaultAgent),$.ajax({url:"version.json",dataType:"json",success:function(a){a.tag&&(document.title=document.title+" "+a.tag);var b=a.tag.slice(1).split("."),c=b[2].split("-");eden.root.lookup("jseden_version_major").assign(parseInt(b[0]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_minor").assign(parseInt(b[1]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_patch").assign(parseInt(c[0]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_commit").assign(parseInt(c[1]),eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_name").assign(a.tag,eden.root.scope,Symbol.defaultAgent),eden.root.lookup("jseden_version_sha").assign(a.sha,eden.root.scope,Symbol.defaultAgent)},cache:!1}),$(document).on("keydown",null,"ctrl+m",function(){edenUI.cycleNextView()}).on("keyup",null,"ctrl",function(){edenUI.stopViewCycling()}).on("keydown",null,"backspace",function(a){var b=a.target,c=b.tagName.toUpperCase();"INPUT"==c||"TEXTAREA"==c||b.isContentEditable||a.preventDefault()}),"false"!=edenUI.getOptionValue("optConfirmUnload")&&window.addEventListener("beforeunload",confirmUnload);var loadLanguage=function(lang,callback){$.getScript("js/language/"+lang+".js",function(data){Language.language=lang,eval(data),menuBar&&(edenUI.menu=new EdenUI.MenuBar),options&&options.noload||(edenUI.feedback=new EdenUI.Feedback,edenUI.explorer=new EdenUI.Explorer),callback()})},loadPlugins=function(a,b){var c=function(){if(a.length>0){var d=a.shift();edenUI.loadPlugin(d,c)}else b()};c()};doneLoading=function(a){window.scrollTo(0,0),edenUI.finishedLoading(),exec&&(";"!=exec.slice(-1)&&(exec+=";"),eden.execute2(exec)),""==myid&&""==master||(eden.peer=new Eden.Peer(""!=master?master:void 0,""!=myid?myid:void 0)),callback&&callback(a)},loadLanguage(lang,function(){options&&options.noload?Eden.DB.connect(Eden.DB.repositories[Eden.DB.repoindex],function(){console.log("DONE LOADING"),doneLoading(!0)}):loadPlugins(plugins,function(){$.getJSON("config.json",function(a){rt.config=a,Eden.DB.connect(Eden.DB.repositories[Eden.DB.repoindex],function(){""!=load?(null!==mode&&""!=mode&&eden.root.lookup("jseden_project_mode").assign(mode,eden.root.scope,Symbol.defaultAgent),Eden.Project.load(parseInt(load),null===vid||""==vid?void 0:parseInt(vid),null===readPassword||""==readPassword?void 0:readPassword,function(){doneLoading(!0)})):""!=restore?(null!==mode&&""!=mode&&eden.root.lookup("jseden_project_mode").assign(mode,eden.root.scope,Symbol.defaultAgent),Eden.project.restore(),doneLoading(!0)):doneLoading(!1)}),Eden.DB.repoindex=(Eden.DB.repoindex+1)%Eden.DB.repositories.length})})})})}function EdenSyntaxData(){this.value=void 0,this.error=!1,this.line=0}function EdenStream(a){this.code=a,this.position=0,this.position_stack=[0],this.prevposition=0,this.line=1,this.prevline=1,this.data=new EdenSyntaxData}function edenTokenTest(a){for(var b=new EdenStream(a),c=[],d={};b.valid();)c.push(b.readToken(d));return c}function sortByCount(a){var b=a.reduce(function(a,b){return a[b]=(a[b]||0)+1,a},{});return Object.keys(b).sort(function(a,c){return b[a]=b&&d.push(e);return d}function negativeFilter(a,b){for(var c=b.reduce(function(a,b){return a[b]=(a[b]||0)+1,a},{}),d=[],e=0;e0&&(e.insert[g+l].consecutive=!0),e.insert[g+l].partial=null===k,h+=lines[l].length,l0&&(e.remove[f+l].consecutive=!0),i+=lines[l].length,l0){for(var j=0;j0){for(var j=0;j=d+window.innerWidth||this.lastDialogLeft+this.lastDialogWidth=e+window.innerHeight||this.lastDialogTop+this.lastDialogHeightd+window.innerWidth?(d=this.lastDialogLeft+this.lastDialogWidth-window.innerWidth,f=!0):this.lastDialogLefte+window.innerHeight-edenUI.menuBarHeight?(e=this.lastDialogTop+this.lastDialogHeight-window.innerHeight-edenUI.menuBarHeight+edenUI.scrollBarSize2+edenUI.bottomBarHeight,f=!0):this.lastDialogTop=0;a--){var b=this.overrides[a];if(void 0!==b.end){if(b.isin){var c=isbound?b.start.value.length:b.start?b.start.length:0;return b.index=0;b--){var c=this.overrides[b];if(void 0!==c.end||c.isin){var d=c.start instanceof BoundValue,e=d?c.start.value.length:c.start?c.start.length:0;if(c.isin){if(c.index "+a)}},Symbol.prototype.logError=function(a){for(var b in this.loggers){var c=this.loggers[b];c.call(this,a)}},Symbol.prototype.getEdenCode=function(){return"&"+this.name},Symbol.prototype.trigger=function(){try{this.value().call(this,this.context,this.context.scope)}catch(a){var b=new Eden.RuntimeError((void 0),Eden.RuntimeError.PROCAGENT,(void 0),"Triggered proc failed: "+a);eden.emit("error",[this,b])}},Symbol.prototype.fireJSObservers=function(){for(var a in this.jsObservers)try{this.jsObservers[a](this,this.value())}catch(b){var c=new Eden.RuntimeError((void 0),Eden.RuntimeError.JSOBSERVER,(void 0),"JavaScript observer '"+a+"' failed: "+b);eden.emit("error",[this,c]);var d;if(this.context){var e=this.cache.value;d="object"==typeof e&&e.jsExceptions}else d=!1;throw b}},Symbol.prototype.expire=function(a,b,c,d){if(this.has_evaled||d&&this.needsGlobalNotify!=Symbol.EXPIRED){for(var e in this.observers)c[e]=this.observers[e];this.definition&&(this.cache.up_to_date=!1,this.has_evaled=!1,a[this.name]=b.value,b.value++,d&&(this.def_scope=void 0)),this.needsGlobalNotify=Symbol.EXPIRED;for(var f in this.subscribers){var g=this.subscribers[f];g&&g.expire(a,b,c,d)}}},Symbol.prototype.isDependentOn=function(a){if(a==this.name||this.dependencies[a])return!0;var b;for(var c in this.dependencies)if(b=this.dependencies[c],b.isDependentOn(a))return!0;for(var c in this.dynamicDependencies)if(b=this.dynamicDependencies[c],b.isDependentOn(a))return!0;return!1},Symbol.prototype.getDependencies=function(){var a=[];for(var b in this.dependencies)a.push(b);return console.log("Dependencies"),a},Symbol.prototype.assertNotDependentOn=function(a,b){if(void 0===b&&(b=[]),b.push(this.name),this.dependencies[a]){var c=b.join(" -> ")+" -> "+a+" -> "+b[0];throw new Error("Cyclic dependency detected: "+c)}var d;for(var e in this.dependencies)d=this.dependencies[e],d.assertNotDependentOn(a,b);for(var e in this.dynamicDependencies)d=this.dynamicDependencies[e],d.assertNotDependentOn(a,b);b.pop()},Symbol.prototype.addSubscriber=function(a,b){this.garbage=!1,this.subscribers[a]=b},Symbol.prototype.removeSubscriber=function(a){delete this.subscribers[a],void 0===this.origin&&this.canSafelyBeForgotten()&&this.forget()},Symbol.prototype.canSafelyBeForgotten=function(){for(var a in this.subscribers)return!1;for(var b in this.observers)return!1;return!0},Symbol.prototype.forget=function(){this.origin=void 0,this.clearEvalIDs(),this.evalResolved=!0,this.definition=void 0,this.cache.value=void 0,this.cache.up_to_date=!0,this.context&&this.context.expireSymbol(this),this.clearObservees(),this.clearDependencies(),this.garbage=!0;for(var a in this.jsObservers)this.jsObservers[a].call(this,this,void 0);this.jsObservers={},this.context.queueForGarbageCollection(this)},Symbol.prototype.addObserver=function(a,b){this.garbage=!1,this.observers[a]=b},Symbol.prototype.addJSObserver=function(a,b){if("function"!=typeof b)throw new Error("Failed adding JavaScript observer "+b);this.jsObservers[a]=b,0==this.cache.up_to_date&&this.value()},Symbol.prototype.removeObserver=function(a){delete this.observers[a],void 0===this.origin&&this.canSafelyBeForgotten()&&this.forget()},Symbol.prototype.removeJSObserver=function(a){delete this.jsObservers[a]},Symbol.prototype.addExtension=function(a,b,c,d,e){if(!this.definition)throw new Error(Eden.RuntimeError.EXTENDSTATIC);void 0===this.extend&&(this.extend={}),this.extend[a]={code:b,source:c,deps:e},this.subscribe(e),this.needsGlobalNotify=Symbol.REDEFINED,this.context&&this.context.expireSymbol(this)},Symbol.prototype.listAssign=function(a,b,c,d,e){if(this.definition)throw new Error(Eden.RuntimeError.ASSIGNTODEFINED);for(var f=this.value(b),g=0;g0){this.needsGlobalNotify=f;var h=this;setTimeout(function(){h.processGlobalNotifyQueue()},0)}}else{var i=this.needsGlobalNotify;i.push.apply(i,f),i.push.apply(i,d)}}},Folder.prototype.processGlobalNotifyQueue=function(){for(var a=this.needsGlobalNotify,b=0;b4)return eden.error(new Error("forgetAll: This function requires at most 4 arguments."),"error"),[[],void 0,[]];if(0==arguments.length)a="";else if("string"==typeof arguments[0])a=arguments[0];else{if(!Array.isArray(arguments[0]))return void 0===arguments[0]?[[],void 0,[]]:(eden.error(new Error("forgetAll: The first argument must be a string, not a "+typeof arguments[0]),"error"),[[],void 0,[]]);g=arguments[0]}if(arguments.length>1){if("boolean"!=typeof arguments[1])return eden.error(new Error("forgetAll: The second argument must be a boolean, not a "+typeof arguments[1]),"error"),[[],void 0,[]];b=arguments[1]}else b=!0;if(void 0!==g&&arguments.length>2)return eden.error(new Error("forgetAll: Cannot specify case sensitivity when selecting using a list."),"error"),[[],void 0,[]];if(arguments.length>=3){if("boolean"!=typeof arguments[2])return eden.error(new Error("forgetAll: The third argument must be a boolean, not a "+typeof arguments[2]),"error"),[[],void 0,[]];c=arguments[2]}else c=void 0===g||2!=arguments.length||arguments[1];if(arguments.length>3){if("boolean"!=typeof arguments[3])return eden.error(new Error("forgetAll: The forth argument must be a boolean, not a "+typeof arguments[3]),"error"),[[],void 0,[]];d=arguments[3]}else d=!1;var h,i={},j=[],k={};if(void 0!==g)for(var l=0;l0&&c)if(x.length<=50)v=confirm("You are about to delete the following "+x.length+" symbols. Is this correct?\n\n"+x.join("\n"));else{var y=x.length-50;v=confirm("You are about to delete "+x.length+" symbols. Is this correct?\n\n"+x.slice(0,50).join("\n")+"\n...\n("+y+" more)")}else v=!0;if(v){root.beginAutocalcOff();for(m in k);for(var l=0;l"),this.$uimsg.appendTo("body"),this.$uimsg.hide(),this.messagetimeout=void 0,this.messagedisplaytime=5e3,this.eden.listenTo("executeFileLoad",this,function(a){edenUI.updateStatus("Loading "+a)}),this.eden.listenTo("executeError",this,function(a,b){console.error("DEPRECATED ERROR REPORTING",a);var c,e=d.htmlEscape(a.message);'
## ERROR number '+b.errorNumber+":
"+(b.path?"## "+b.path+"
":"")+e+"
\n\n";c="string"==typeof a?a:a.message,edenUI.showMessage("error","Error: "+c)}),this.listeners={},this.windowHighlighter=new WindowHighlighter(this),this.currentView=void 0,this.viewCategories={},this.numberOfViewCategories=0,this.addViewCategory("comprehension","Comprehension"),this.addViewCategory("interpretation","Making Definitions"),this.addViewCategory("history","History & State"),this.addViewCategory("visualization","Visualization"),this.addViewCategory("extension","Extensions"),this.addViewCategory("environment","Management"),$(document).on("click",function(a){if(a.ctrlKey||a.metaKey)for(var b=[],c=a.target;"BODY"!=c.nodeName;){var d=c.getAttribute("data-observables");d&&""!=d&&b.push.apply(b,d.split(",")),c=c.parentNode}})}function d(a){this.root=a,a.base=this,this.dictionary={},this.errorNumber=0,this.listeners={},this.reportErrors=!0}"undefined"!=typeof require&&"undefined"!=typeof exports&&(Polyglot=require("./polyglot").Polyglot,rt=require("./runtime").rt),c.prototype.brieflyHighlightView=function(a){var b=$("#"+viewName+"-dialog").dialog.parent();b.addClass("window-activated"),setTimeout(function(){b.removeClass("window-activated")},600)},c.prototype.cycleNextView=function(){this.stopHighlightingView(this.currentView,!0,!1);var a=Object.keys(this.activeDialogs);if(void 0===this.currentView)this.currentView=a[0];else for(i=0;i"+b+""):"error"==a&&this.$uimsg.html("
"+b+"
"),this.$uimsg.show("fast"),clearTimeout(this.messagetimeout),this.messagetimeout=setTimeout(this.hideMessage,this.messagedisplaytime)},c.prototype.finishedLoading=function(){this.loaded=!0},c.prototype.listenTo=listenTo,c.prototype.emit=emit,c.showTooltip=function(a,b){var c=document.getElementById("tooltip"),d=a.clientX+2,e=a.clientY+20,f=window.pageXOffset+window.innerWidth-d-15;f<200&&(d-=200-f,f=200),c.style.left=d+"px",c.style.maxWidth=f+"px",c.style.top=e+"px",c.innerHTML=b,c.style.display="block"},c.closeTooltip=function(){document.getElementById("tooltip").style.display="none"},c.prototype.options={},c.prototype.getOptionValue=function(a){if(a in this.options)return this.options[a];try{if(window.localStorage)return window.localStorage.getItem(a)}catch(b){return null}},c.prototype.setOptionValue=function(a,b){this.options[a]=String(b),this.emit("optionChange",[a,String(b)]);try{if(window.localStorage)return window.localStorage.setItem(a,b),!0}catch(c){return!1}},c.prototype.setDefaultOptionValue=function(a,b){null===this.getOptionValue(a)&&(this.options[a]=String(b),this.emit("optionChange",[a,String(b)]))},c.prototype.unsetOptionValue=function(a){delete this.options[a],this.emit("optionChange",[a,null]);try{window.localStorage&&window.localStorage.removeItem(a)}catch(b){}},c.prototype.fullscreen=function(a,b){var c=eden.root.lookup(b),d=c.value();if(document.webkitExitFullscreen)if(d){document.onwebkitfullscreenchange=function(){document.webkitIsFullScreen||(c.assign(!1,eden.root.scope,Symbol.hciAgent),edenUI.menu.show())};var e=document.getElementById(a+"-canvascontent");e.webkitRequestFullscreen(),edenUI.menu.hide()}else document.webkitExitFullscreen(),edenUI.menu.show();else if(document.mozCancelFullScreen)if(d){document.onmozfullscreenchange=function(){document.mozFullScreen||(c.assign(!1,eden.root.scope,Symbol.hciAgent),edenUI.menu.show())};var e=document.getElementById(a+"-canvascontent");e.mozRequestFullScreen(),edenUI.menu.hide()}else document.mozCancelFullScreen(),edenUI.menu.show()},c.prototype.regExpFromStr=function(a,b,c,d){var e,f,g,h=!0,i=3;"object"==typeof a&&(g=a,a=g[0].value),void 0===b&&(b="");var j;if(void 0===d)j=!/[\\+^$|({[]|(\.\*[^\s*?])/.test(a)&&"false"!==this.getOptionValue("optSimpleWildcards");else if("simple"==d)j=!0;else{if("regexp"!=d)throw new Error("EdenUI.regExpFromStr: Unsupported search language "+d);j=!1}if(/[A-Z]/.test(a)||(b+="i"),j){a=a.replace(/([\\+^$.|(){[])/g,"\\$1").replace(/([*?])/g,".$1");for(var k=a.split(new RegExp("\\s+(?:"+Language.ui.search.disjunction+"|or)\\s+","i")),l=0;l=0?"<>";else{b.push(a),f="[";for(var g=0;g0&&(f+=d.edenCodeForValue(a[a.length-1],b,c)),f+="]",b.pop()}else if("object"==e){if("getEdenCode"in a?f=a.getEdenCode(c):"keys"in a&&Array.isArray(a.keys)&&a.keys.length>0&&"parent"in a&&a.parent instanceof Symbol?f="&"+a.parent.name.slice(1)+"["+a.keys[0]+"]":"object"==typeof window&&"object"==typeof document&&"function"==typeof Element&&(a==window?f="${{ window }}$":a==document?f="${{ document }}$":a==document.documentElement?f="${{ document.documentElement }}$":a==document.body?f="${{ document.body }}$":a instanceof Element&&a.id&&(f='${{ document.getElementById("'+a.id+'") }}$')),""==f)if(void 0===b&&(b=[]),b.indexOf(a)!=-1)f+="<>";else{b.push(a),f="Object(";for(var h in a)h in Object.prototype||(f=f+h+", "+d.edenCodeForValue(a[h],b,c)+", ");"Object("!=f&&(f=f.slice(0,-2)),f+=")",b.pop()}}else f="function"==e?"${{\n\t"+a.toString().replace(/\n/g,"\n\t")+"\n}}$":"number"==e&&c?a.toFixed(c):String(a);return f},d.edenCodeForValues=function(){for(var a="",b=0;bc+1&&(i=i.slice(0,c)+"...",j=!0);else if(Array.isArray(b))if(void 0===g&&(g=[]),g.indexOf(b)!=-1)i+="...";else{g.push(b),i="[";for(var k=0;k=c-1){"..."!=i.slice(-3)&&(i+="..."),j=!0;break}i+=" "}b.length>0&&!j&&(i=d.prettyPrintValue(i,b[b.length-1],c,e,f,g)),i+="]",g.pop()}else if("object"==h){if(b instanceof Symbol?i=b.getEdenCode():"keys"in b&&Array.isArray(b.keys)&&b.keys.length>0&&"parent"in b&&b.parent instanceof Symbol?i="&"+b.parent.name.slice(1)+"["+b.keys[0]+"]":"object"==typeof window&&"object"==typeof document&&"function"==typeof Element&&(b==window?i="${{ window }}$":b==document?i="${{ document }}$":b==document.documentElement?i="${{ document.documentElement }}$":b==document.body?i="${{ document.body }}$":b instanceof Element&&b.id&&(i='${{ document.getElementById("'+b.id+'") }}$')),""==i)if(b.toString!=Object.prototype.toString)i=b.toString(),void 0!==c&&i.length>c&&(i=i.slice(0,c)+"...",j=!0);else if(void 0===g&&(g=[]),g.indexOf(b)!=-1)i+="...";else{g.push(b),i="{";var l=!1;for(var m in b)if(!(m in Object.prototype)){if(l){i=i.slice(0,-1)+"...",j=!0;break}if(i=i+m+": ",i=d.prettyPrintValue(i,b[m],c,e,f,g),"..."==i.slice(-3)){j=!0;break}void 0!==c&&i.length>=c&&(l=!0),i+=", "}"{"==i||j||(i=i.slice(0,-2)),i+="}",g.pop()}}else"function"==h?e?(i="${{\n\t"+b.toString().replace(/\n/g,"\n\t")+"\n}}$",void 0!==c&&i.length>c&&(i=i.slice(0,c)+"...",j=!0)):i="func":i=String(b);if(a)return a+i;var n=d.htmlEscape(i,!f);return n=n.replace(/\.\.\./g,"…"),f||(n=n.replace(/\n/g,"\\n")),n},d.htmlEscape=function(a,b,c){return void 0===a?"":(a=String(a),a=a.replace(/&/g,"&"),a=a.replace(//g,">"),a=a.replace(/"/g,"""),a=a.replace(/'/g,"'"),c?a=b?a.replace(/\n/g," "):a.replace(/\n/g,"
"):b||(a=a.replace(/\n/g,"
\n")),a)},d.prototype.nextEvalID=0,d.prototype.initialDefinition=function(){console.error("INIT DEF DEP")},d.prototype.getDefinition=function(a,b){return b.eden_definition?b.eden_definition+";":a+" = "+b.context.scope.lookup(b.name).value+";"},a.EdenUI=c,a.Eden=d,"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.Eden=d)}("undefined"!=typeof window?window:global),Eden.DB={directory:{},meta:{},remoteMeta:{},remoteURL:void 0,username:void 0,userid:void 0,repositories:["http://jseden.dcs.warwick.ac.uk/construalmanager","http://localhost:18882"],repoindex:0,retrycount:0,connected:!1,searchServer:"http://jseden.dcs.warwick.ac.uk"},Eden.DB.listeners={},Eden.DB.emit=emit,Eden.DB.listenTo=listenTo,Eden.DB.isConnecting=function(){return void 0!==Eden.DB.remoteURL},Eden.DB.isConnected=function(){return Eden.DB.connected},Eden.DB.isLoggedIn=function(){return void 0!==Eden.DB.username},Eden.DB.logOut=function(a){Eden.DB.isLoggedIn()&&$.ajax({url:Eden.DB.remoteURL+"/logout",type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(b){function c(){Eden.DB.isConnected()&&void 0===Eden.DB.username&&setTimeout(function(){Eden.DB.getLoginName(function(a){a?(Eden.DB.emit("login",[a]),eden.root.lookup("jseden_pm_user").assign(a,eden.root.scope,Symbol.localJSAgent)):c()})},5e3)}Eden.DB.username=void 0,a&&a(),c()},error:function(a){Eden.DB.disconnect(!0)}})},Eden.DB.connect=function(a,b){function c(a){for(var b in a)a[b].missing=!0,a[b].children&&c(a[b].children)}function d(){Eden.DB.isConnected()&&setTimeout(function(){Eden.DB.getLoginName(function(a){a?d():Eden.DB.disconnect()})},3e5)}function e(){Eden.DB.isConnected()&&void 0===Eden.DB.username&&setTimeout(function(){Eden.DB.getLoginName(function(a){a?(Eden.DB.emit("login",[a]),eden.root.lookup("jseden_pm_user").assign(a,eden.root.scope,Symbol.localJSAgent),d()):e()})},5e3)}Eden.DB.remoteURL=a,c(Eden.DB.directory),Eden.DB.refreshint=setInterval(function(){for(var a in Eden.DB.directory)Eden.DB.directory[a].missing=!0},2e4),Eden.DB.getLoginName(function(c){Eden.DB.isConnected()?(Eden.DB.retrycount=0,b&&b(Eden.DB.isConnected()),Eden.DB.emit("connected",[a]),eden.root.lookup("jseden_pm_connected").assign(!0,eden.root.scope,Symbol.localJSAgent),c?(Eden.DB.emit("login",[c]),eden.root.lookup("jseden_pm_user").assign(c,eden.root.scope,Symbol.localJSAgent)):e()):b&&b(Eden.DB.isConnected())})},Eden.DB.disconnect=function(a){Eden.DB.remoteURL=void 0,Eden.DB.connected&&(Eden.DB.emit("disconnected",[]),eden.root.lookup("jseden_pm_connected").assign(!1,eden.root.scope,Symbol.localJSAgent)),Eden.DB.connected=!1,Eden.DB.refreshint&&(clearInterval(Eden.DB.refreshint),Eden.DB.refreshint=void 0),a&&(Eden.DB.retrycount<12&&Eden.DB.retrycount++,setTimeout(function(){Eden.DB.repoindex>=Eden.DB.repositories.length&&(Eden.DB.repoindex=Eden.DB.repositories.length-1),Eden.DB.connect(Eden.DB.repositories[Eden.DB.repoindex]),Eden.DB.repoindex=(Eden.DB.repoindex+1)%Eden.DB.repositories.length},200*Math.pow(2,Math.ceil(Eden.DB.retrycount/Eden.DB.repositories.length))))},Eden.DB.getLoginName=function(a){Eden.DB.isConnecting()?$.ajax({url:Eden.DB.remoteURL+"/user/details",type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(b){Eden.DB.connected=!0,null==b||b.error?(Eden.DB.username=void 0,a()):(Eden.DB.username=b.name,Eden.DB.userid=b.id,!b.id||""!=b.name&&b.name||(Eden.DB.username="NoName"),a(Eden.DB.username))},error:function(b,c,d){Eden.DB.disconnect(!0),a(void 0)}}):a()},Eden.DB.save=function(a,b,c){Eden.DB.isConnected()?$.ajax({url:this.remoteURL+"/project/add",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:a.id,title:a.title,source:a.generate(),tags:a.tags.join(" "),minimisedTitle:a.name,from:a.vid,image:a.thumb,listed:b,metadata:JSON.stringify({description:a.desc}),parentProject:a.parentid},success:function(b){null===b||b.error?(console.error(b),Eden.DB.emit("error",[b?b.description:"No response from server"]),c&&c(!1)):(console.log("Saved",b),a.id=b.projectID,a.vid=b.saveID,a.readPassword=b.readPassword,c&&c(!0))},error:function(a,b,d){Eden.DB.handleError(a,b,d),c&&c(!1)}}):(console.error("Cannot upload, not connected to server"),c&&c(!1),eden.error("Cannot upload "+path+", not connected to server"))},Eden.DB.getVersions=function(a,b){Eden.DB.isConnected()?$.ajax({url:Eden.DB.remoteURL+"/project/versions?projectID="+a,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){b(a)},error:function(a){Eden.DB.disconnect(!0)}}):b(void 0)},Eden.DB.load=function(a,b,c,d){3==arguments.length&&(d=c,c=void 0),Eden.DB.isConnected()?$.ajax({url:Eden.DB.remoteURL+"/project/get?projectID="+a+(b?"&to="+b:"")+(c?"&readPassword="+c:""),type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(c){null==c||c.error?(d(void 0,"No such version"),console.error("No such version "+b+" for "+a),console.log(c),Eden.DB.emit("error",[c?c.description:"No response from server"])):d(c)},error:function(a,b,c){Eden.DB.handleError(a,b,c),d(void 0,"Disconnected")}}):d&&d(void 0,"Disconnected")},Eden.DB.search=function(a,b,c,d,e){var f=this.remoteURL+"/project/";f+=""==a?"search?limit="+c+"&offset="+(b-1)*c:"search?limit="+c+"&offset="+(b-1)*c+"&query="+encodeURIComponent(a),d&&(f+="&by="+d),$.ajax({url:f,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return a&&a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),void e(void 0)):a?void e(a):void e(void 0)},error:function(a,b,c){Eden.DB.handleError(a,b,c),e(void 0)}})},Eden.DB.getMeta=function(a,b){var c=this.remoteURL+"/project/";c+="search?limit=20&query=.id("+a+")",$.ajax({url:c,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return a&&a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),void b(void 0)):a?void b(a):void b(void 0)},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.remove=function(a,b){$.ajax({url:this.remoteURL+"/project/remove",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:a},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),b&&b(!1)):(console.log("Removed",a),b&&b(!0))},error:function(a,c,d){Eden.DB.handleError(a,c,d),b&&b(!1)}})},Eden.DB.rate=function(a,b){$.ajax({url:this.remoteURL+"/project/rate",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:a,stars:b},success:function(a){(null===a||a.error)&&(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]))},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.searchSelector=function(a,b,c){$.ajax({url:this.remoteURL+"/code/search?selector="+a.replace("#","%23")+"&outtype="+b,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return(null===a||a.error)&&(Eden.DB.emit("error",[a?a.description:"No response from server"]),c([])),a?void c(a):void c([])},error:function(a,b,d){c([]),Eden.DB.handleError(a,b,d)}})},Eden.DB.postComment=function(a,b,c){var d=a?a.id:-1,e=a?a.vid:-1;Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/comment/post",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{projectID:d,versionID:e,publiclyVisible:c?0:1,comment:b},success:function(a){(null===a||a.error)&&(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]))},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.searchComments=function(a,b,c,d,e,f){var g=a?a.id:-1;Eden.DB.isConnected()&&$.ajax({url:this.remoteURL+"/comment/search?projectID="+g+(e?"&newerThan="+e:"")+"&offset="+(c-1)*d+"&limit="+d,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){return a?void f(a):void f([])},error:function(a,b,c){f([]),Eden.DB.handleError(a,b,c)}})},Eden.DB.removeComment=function(a){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/comment/delete",type:"post",crossDomain:!0,xhrFields:{withCredentials:!0},data:{commentID:a},success:function(a){(null===a||a.error)&&(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"])); +},error:function(a,b,c){Eden.DB.handleError(a,b,c)}})},Eden.DB.follow=function(a,b){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/social/followproject?projectID="+a,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),b&&b(!1)):b&&b(!0)},error:function(a,c,d){Eden.DB.handleError(a,c,d),b&&b(!1)}})},Eden.DB.adminCommentActivity=function(a,b,c){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/comment/activity?limit=10&offset="+b+(a?"&newerThan="+a:""),type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),c&&c(!1)):c&&c(a)},error:function(a,b,d){Eden.DB.handleError(a,b,d),c&&c(!1)}})},Eden.DB.handleError=function(a,b,c){console.log("DB ERROR",b,c),"error"!=b||c?"error"==b?Eden.DB.emit("error",[c]):"timeout"==b?(Eden.DB.emit("error",["Network timeout"]),Eden.disconnect(!0)):(Eden.DB.emit("error","Unknown network error"),Eden.disconnect(!0)):(Eden.DB.disconnect(!0),Eden.DB.emit("error",["Not connected to construal cloud"]))},Eden.DB.adminProjectActivity=function(a,b,c){Eden.DB.isLoggedIn()&&$.ajax({url:this.remoteURL+"/project/activity?limit=15&offset="+b+(a?"&newerThan="+a:""),type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),c&&c(!1)):c&&c(a)},error:function(a,b,d){Eden.DB.handleError(a,b,d),c&&c(!1)}})},Eden.DB.getPopularTags=function(a,b){$.ajax({url:this.remoteURL+"/project/tags?tag="+a,type:"get",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(a){null===a||a.error?(console.error(a),Eden.DB.emit("error",[a?a.description:"No response from server"]),b&&b(!1)):b&&b(a)},error:function(a,c,d){Eden.DB.handleError(a,c,d),b&&b(!1)}})},function(){function a(a,b){return root.lookup("view_"+a+"_"+b)}function b(a){return $("#"+a+"-dialog")}EdenUI.prototype.menuBarHeight=45,EdenUI.prototype.dialogBorderWidth=1,EdenUI.prototype.titleBarHeight=0,EdenUI.prototype.largeTitleBar=41.22+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.scrollBarSize=14+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.scrollBarSize2=window.innerHeight-$(window).height(),EdenUI.prototype.dialogFrameWidth=2*EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.dialogFrameHeight=EdenUI.prototype.titleBarHeight+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.bottomBarHeight=34.906,EdenUI.prototype.gridSizeX=Math.floor(30*window.innerWidth/1920),EdenUI.prototype.gridSizeY=Math.floor(30*window.innerHeight/1920),EdenUI.prototype.minimumWindowWidthShowing=72+EdenUI.prototype.dialogBorderWidth,EdenUI.prototype.createEmbedded=function(a,b){if(this.embeddedInstances[a])return this.embeddedInstances[a];var c;return edenUI.views[b].embed?c=edenUI.views[b].embed(a,a,""):edenUI.views[b].embedded&&(c=edenUI.views[b].embedded(a,a,"")),c?(this.embeddedInstances[a]=c,c):void 0},EdenUI.prototype.createView=function(c,d,e){function f(a){return"view_"+c+"_"+a}function g(a,b){n.resizeView(c)}function h(a,b){n.moveView(c)}function i(a,b){var d=z.dialogExtend("state");"hidden"==b?"minimized"!=d&&n.minimizeView(c):"maximized"==b||z.dialog("isOpen")&&"minimized"!=d&&"collapsed"!=d||n.showView(c)}function j(a,b){var c=b;void 0!==w.titleBarInfo&&(c=c+" ("+w.titleBarInfo+")"),z.dialog("option","title",c),edenUI.menu.updateViewsMenu()}function k(a,b){lockVal=b,b?(z.siblings(".ui-dialog-titlebar").css("display","none"),z.dialog("option","resizable",!1),n.resizeView(c)):(z.siblings(".ui-dialog-titlebar").css("display","block"),z.dialog("option","resizable",!0),n.resizeView(c))}function l(a,b){var c=z.get(0).parentNode.style;b?(c.border="none",c.boxShadow="none"):(c.border="1px solid #777",c.boxShadow="0 0 15px #4a6887")}function m(a,b){b?n.pinView(c):n.unpinView(c)}if(!(d in this.views))return void this.eden.error(new Error("View type "+d+" is unavailable. Check that the associated plug-in is loaded."));"name"in this.views[d]&&(c=this.views[d].name);var n=this,o=Symbol.defaultAgent,p=this.activeDialogs[c],q=a(c,"visibility"),r=q.value(),s=a(c,"title"),t=s.value();if(p==d)return"visible"!=r&&q.assign("visible",root.scope,o),this.brieflyHighlightView(c),this.viewInstances[c];this.eden.root.beginAutocalcOff(),void 0!==p&&(t==this.views[p].title&&(t=void 0),this.destroyView(c,!1)),this.titleBarHeight="ScriptView"==p?this.largeTitleBar:this.titleBarHeight;var u=this.menuBarHeight,v=this.views[d].title,w=this.views[d].dialog(c+"-dialog",v);void 0===w&&(w={}),this.viewInstances[c]=w;var x,y=(w.position,edenUI.getOptionValue("optCollapseToTitleBar"));x="true"==y?"collapse":"maximize";var z=b(c);z.dialog({closeOnEscape:!1,position:{using:function(){}},beforeClose:function(){return w.closing?(w.closing=!1,!0):n.closeView(c)},focus:function(){}});var A=[f("type"),f("x"),f("y"),f("width"),f("height"),f("lock"),f("noborder"),f("title"),f("visibility")];z.get(0).setAttribute("data-observables",A.join(","));var B=this.getDialogWindow(c);z.dialogExtend({dblclick:x,minimizable:!0,maximizable:!0,beforeMinimize:function(a){return $(a.target).parent().removeClass("window-activated"),n.hideView(c),!1},minimize:function(){var a=b(c).data("dialog-extend-minimize-controls");a.css("position","relative"),a.css("top",""),a.css("left","")},maximize:function(a){var b=B[0],c=z[0];b.style.top=u+"px";var d=window.innerHeight-u-n.scrollBarSize2-2*n.dialogBorderWidth;"true"!=edenUI.getOptionValue("optHideOnMinimize")&&(d-=n.bottomBarHeight),b.style.height=d+"px",c.style.height=d-n.titleBarHeight+"px"},restore:function(a){z.dialog("moveToTop"),n.brieflyHighlightView(a.target.id.slice(0,-7)),z.dialog("widget").draggable("option","containment",[-Number.MAX_VALUE,u,Number.MAX_VALUE,Number.MAX_VALUE])}}),this.activeDialogs[c]=d;var C=a(c,"type");C.value()!=d&&(C.removeJSObserver("changeType"),C.assign(d,root.scope,Symbol.localJSAgent),C.addJSObserver("changeType",function(a,b){void 0!==b&&root.lookup("views_list").value().indexOf(c)!==-1&&n.createView(c,b)}));var D=root.lookup("views_list"),E=D.value();Array.isArray(E)?E.indexOf(c)===-1&&(E=E.slice(),E.push(c),D.assign(E,root.scope,Symbol.localJSAgent)):D.assign([c],root.scope,Symbol.localJSAgent);var F=a(c,"lock"),G=F.value();widthSym=a(c,"width"),widthSym.addJSObserver("plugins",g),widthSym.definition||void 0!==widthSym.value()||widthSym.assign(z.dialog("option","width"),root.scope,o);var H=a(c,"height");H.addJSObserver("plugins",g),H.definition||void 0!==H.value()||H.assign(z.dialog("option","height")-(G?0:this.titleBarHeight),root.scope,o),g();var I=z.closest(".ui-dialog").position(),J=a(c,"x");J.addJSObserver("plugins",h),J.definition||void 0!==J.value()||J.assign(I.left,root.scope,o);var K=a(c,"y");K.addJSObserver("plugins",h),K.definition||void 0!==K.value()||K.assign(I.top,root.scope,o),h(),"visible"!=r&&(void 0===r?q.assign("visible",root.scope,o):i(q,r)),q.addJSObserver("changeState",i);var L=w.titleBarInfo;delete w.titleBarInfo,Object.defineProperty(w,"titleBarInfo",{get:function(){return L},set:function(a){L=a;var b=s.value();void 0!==a&&(b=b+" ("+a+")"),z.dialog("option","title",b)},enumerable:!0}),s.addJSObserver("updateTitleBar",j),void 0===t?s.assign(v,root.scope,o):j(s,t),F.addJSObserver("changeState",k),void 0!==G&&k(F,G);var M=a(c,"noborder");M.addJSObserver("changeState",l);var N=M.value();void 0!==N&&l(M,N);var O=a(c,"pin");O.addJSObserver("changeState",m);var P=O.value();void 0!==P?m(O,P):this.unpinView(c),z.dialog("widget").draggable("option","containment",[-Number.MAX_VALUE,u,Number.MAX_VALUE,Number.MAX_VALUE]),z.resizeExtend=0,z.on("dialogresizestop",function(b,d){z.previousWidth=void 0,z.momentum=0,z.resizeExtend=0;var e=a(c,"width"),f=a(c,"height"),g=n.eden.root;g.beginAutocalcOff(),e.assign(d.size.width,g.scope,Symbol.hciAgent),f.assign(d.size.height-n.titleBarHeight,g.scope,Symbol.hciAgent),g.endAutocalcOff()}),z.on("dialogdragstop",function(b,d){var e=n.eden.root;e.beginAutocalcOff(),console.log(d),a(c,"x").assign(d.position.left,eden.root.scope,Symbol.hciAgent),a(c,"y").assign(d.position.top,eden.root.scope,Symbol.hciAgent),e.endAutocalcOff()}),z.on("dialogdragstart",function(){if(a(c,"x").definition||a(c,"y").definition)return!1}),z.on("dialogresizestart",function(){if(a(c,"width").definition||a(c,"height").definition)return!1}),this.eden.root.endAutocalcOff(),this.emit("createView",[c,d]);var Q=a(c,"nostack");return Q.value()?z.get(0).parentNode.className+=" ui-back":z.get(0).parentNode.className+=" ui-front",w},EdenUI.prototype.closeView=function(a){return this.hideView(a),edenUI.eden.root.collectGarbage(),!0},EdenUI.prototype.destroyAllViews=function(){for(var a in this.viewInstances)this.destroyView(a,!0)},EdenUI.prototype.destroyView=function(a,c){if(a in this.viewInstances&&!this.viewInstances[a].closing){this.viewInstances[a].closing=!0,this.viewInstances[a].destroy&&this.viewInstances[a].destroy(),root.forgetAll("^View_"+a+"_",!0,!1,!0),c?root.forgetAll("^view_"+a+"_",!0,!1,!0):root.lookup("view_"+a+"_title").removeJSObserver("updateTitleBar");var d=b(a);if(d.dialog("destroy"),d.remove(),d.html(""),delete this.activeDialogs[a],delete this.viewInstances[a],c){var e=root.lookup("views_list"),f=e.value();if(Array.isArray(f)){var g=f.indexOf(a);if(g!==-1){var h;0==g?h=f.slice(1):(f.splice(g,1),h=f),e.assign(h,root.scope,Symbol.hciAgent)}}}this.emit("destroyView",[a])}},EdenUI.prototype.getDialogContent=function(a){return b(a)},EdenUI.prototype.getDialogWindow=function(a){return b(a).parent()},EdenUI.prototype.showView=function(a){var c=b(a);c.dialog("open").dialog("moveToTop");var d=c.dialogExtend("state");return"normal"!=d&&"maximized"!=d&&c.dialogExtend("restore"),this.activeDialogs[a]},EdenUI.prototype.updateView=function(a,b){var c=this.viewInstances[a];c&&c.update&&c.update(b)},EdenUI.prototype.highlightView=function(a,b){if(b)this.windowHighlighter.highlight(a);else{var c=this.getDialogContent(a).data("dialog-extend-minimize-controls")||this.getDialogWindow(a);c.addClass("window-highlighted")}},EdenUI.prototype.stopHighlightingView=function(a,b,c){if(b)this.windowHighlighter.stopHighlight(a,c),c&&this.getDialogContent(a).dialog("moveToTop");else{var d=this.getDialogContent(a).data("dialog-extend-minimize-controls")||this.getDialogWindow(a);d.removeClass("window-highlighted")}},EdenUI.prototype.brieflyHighlightView=function(a){var b=this.getDialogWindow(a);b.addClass("window-activated"),setTimeout(function(){b.removeClass("window-activated")},600)},EdenUI.prototype.hideView=function(a){a in this.viewInstances&&(this.viewInstances[a].closing=!0,b(a).dialog("close"))},EdenUI.prototype.minimizeView=function(a){var c=edenUI.getOptionValue("optHideOnMinimize");if("true"==c)this.hideView(a);else{if(!(a in this.viewInstances))return;b(a).dialogExtend("minimize")}},EdenUI.prototype.minimizeObscuredViews=function(a){if("true"!=edenUI.getOptionValue("optHideOnMinimize")){var c=b(a),d=c.closest(".ui-dialog");if(!d.is(this.windowHighlighter.lastDialog)&&"normal"==c.dialogExtend("state"))for(var e=c.get(0),f=0,g=d.position(),h=g.left,i=g.top,j=c.dialog("option","width")+2*EdenUI.prototype.dialogBorderWidth,k=c.dialog("option","height")+2*EdenUI.prototype.dialogBorderWidth,l=d.hasClass("ui-top"),m=$(".ui-dialog-content"),n=0;n=h-f&&r+t<=h+j+f&&s>=i-f&&s+u<=i+k+f&&o.dialogExtend("minimize")}}}}},EdenUI.prototype.moveView=function(c){var d,e,f=b(c),g=a(c,"x"),h=a(c,"y"),i=g.value(),j=h.value(),k=this.minimumWindowWidthShowing-f.dialog("option","width");d=i'),g=function(a){return function(b){f.dialog("destroy"),f.remove(),e(a)}},h=$("
"+b+"
");f.append(h);for(var i=[],j=0;j1&&d[f[0]].push(decodeURIComponent(f[1]))}return d},URLUtil.getArrayParameterByName=function(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");for(var b="[\\?&]"+a+"=([^&#]*)",c=new RegExp(b,"g"),d=window.location.href,e=c.exec(d),f=[];null!==e;){var g=decodeURIComponent(e[1].replace(/\+/g," "));f.push(g),e=c.exec(d)}return f},URLUtil.isCrossDomain=function(a){var b=a.match(/^([a-zA-Z][a-zA-Z\d+.\-]*:)(\/\/)?([^\/@]*@)?([^\/:]+)(:\d+)?(\/|$)/);return null!==b&&(b[1]!=window.location.protocol||b[4]!=document.domain||b[5].slice(1)!=window.location.port)},URLUtil.downloadFile=function(a){var b=a.url,c=a.dataType,d=a.sync,e=a.success,f=a.error;if(void 0===c&&(c="text"),"function"!=typeof f)throw new Error("An error handling function must be specified.");if("function"!=typeof e)return void f(null,"error","A success callback function must be specified.");if(void 0===b)return void f(null,"error","A URL must be specified.");b=String(b);var g=rt.config.proxyBaseURL,h=this.isCrossDomain(b);if(d===!0&&h&&this.isCrossDomain(g))return void f(null,"error","Synchronous downloading not possible");if("boolean"!=typeof d)return void f(null,"error","The sync option must be a boolean, not a "+typeof d);if(h){var i="crossDomainCallback"+Math.floor(9007199254740991*Math.random());return window[i]=function(a){try{if(a.success){var b,d=a.success,g=!1;switch(c){case"text":b=d;break;case"json":try{b=JSON.parse(d)}catch(h){f(null,"parserror",h),g=!0}break;default:f(null,"error","No cross-domain interpretation available for data type "+c),g=!0}g||e(b,"success",null)}else f(null,"error",a.error)}finally{delete window[i]}},$.ajax({url:g+"?url="+encodeURI(b)+"&callback="+i,dataType:"script",async:!d,error:f})}return a.async=!d,$.ajax(a)};var root,eden,edenUI,doneLoading;"isInteger"in Number||(Number.isInteger=function(a){return parseInt(a)===a});var doingNavigateAway=!1,confirmUnload=function(a){if(!doingNavigateAway){eden.project.localSave();var b="Leaving this page will discard the current script. Your work will not be saved.";return a.returnValue=b,b}};EdenStream.prototype.pushPosition=function(){this.position_stack.push(this.position)},EdenStream.prototype.popPosition=function(){this.position=this.position_stack.pop()},EdenStream.prototype.discardPosition=function(){this.position_stack.pop()},EdenStream.prototype.get=function(){return this.position=this.code.length?0:this.code.charCodeAt(this.position+1)},EdenStream.prototype.peek3=function(){return this.position+2>=this.code.length?0:this.code.charCodeAt(this.position+2)},EdenStream.prototype.readLine=function(){var a=this.code.indexOf("\n",this.position);if(a==-1){var b=this.code.substring(this.position);return this.position=this.code.length,b}var b=this.code.substring(this.position,a+1);return this.position=a+1,this.line++,b},EdenStream.prototype.peekLine=function(){var a=this.code.indexOf("\n",this.position);if(a==-1){var b=this.code.substring(this.position);return b}var b=this.code.substring(this.position,a+1);return b},EdenStream.prototype.move=function(a){this.position=a},EdenStream.prototype.reset=function(){this.position=0,this.position_stack=[0],this.prevposition=0,this.line=1},EdenStream.prototype.tokenText=function(){return this.code.substr(this.prevposition,this.position-this.prevposition)},EdenStream.prototype.isBEOL=function(){if(10==this.peek2())return!0;for(var a=this.prevposition-1,b=this.code.charCodeAt(a);9==b||32==b;)a--,b=this.code.charCodeAt(a);return 10==b},EdenStream.prototype.skip=function(){this.position++},EdenStream.prototype.eof=function(){return this.position>=this.code.length},EdenStream.prototype.valid=function(){return this.position=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||95==a||a>=128||36==a},EdenStream.prototype.isNumeric=function(a){return a>=48&&a<=57},EdenStream.prototype.tokenType=function(a){return"OBSERVABLE"==a?"identifier":"JAVASCRIPT"==a?"javascript":"NUMBER"==a?"number":"STRING"==a?"string":"CHARACTER"==a?"character":"BOOLEAN"==a?"boolean":"string"!=typeof a?(console.error(a),"INVALID"):this.isAlphaNumeric(a.charCodeAt(0))?"keyword":"("==a||"["==a||"{"==a?"openbracket":")"==a||"]"==a||"}"==a?"closebracket":","==a||"."==a||";"==a||":"==a?"separator":"operator"},EdenStream.prototype.parseAlphaNumeric=function(a){var b="";if(0==this.isAlphaNumeric(this.peek()))return!1;for(;this.valid()&&this.isAlphaNumeric(this.peek());)b+=String.fromCharCode(this.get());return a.value=b,!0},EdenStream.prototype.parseString=function(a,b){for(var c="";this.valid()&&this.peek()!=b;){var d=String.fromCharCode(this.get());if("\n"==d)return this.unget(),a.error=!0,void(a.value="LINEBREAK");"\\"==d?(d=String.fromCharCode(this.get()),c+="\\"+d):c+=d}this.valid()&&this.peek()==b?(this.skip(),a.error=!1):a.error=!0,a.value=c},EdenStream.prototype.parseCharacter=function(a){var b=String.fromCharCode(this.get());return"'"==b?(a.value="",void(a.error=!0)):("\\"==b&&(b=String.fromCharCode(this.get())),a.value=b,void(this.valid()&&39==this.peek()?this.skip():a.error=!0))},EdenStream.prototype.parseNumber=function(a){for(var b="";this.valid()&&this.isNumeric(this.peek());)b+=String.fromCharCode(this.get());if(46==this.peek()&&this.isNumeric(this.peek2()))for(this.skip(),b+=".";this.valid()&&this.isNumeric(this.peek());)b+=String.fromCharCode(this.get());a.value=parseFloat(b)},EdenStream.prototype.readToken=function(a){if(this.prevline=this.line,this.skipWhiteSpace(),this.prevposition=this.position,this.eof())return"EOF";var b=this.code.charCodeAt(this.position);switch(this.position++,b){case 33:return 61==this.peek()?(this.skip(),"!="):126==this.peek()?(this.skip(),"!~"):"!";case 34:return a?'"':(this.parseString(this.data,34),"STRING");case 35:return 35==this.peek()?(this.skip(),"##"):"#";case 36:if(123==this.peek()&&123==this.peek2())return this.skip(),this.skip(),"${{";break;case 37:return"%";case 38:return 38==this.peek()?(this.skip(),"&&"):61==this.peek()?(this.skip(),"&="):"&";case 39:return a?"'":(this.parseString(this.data,39),"STRING");case 40:return"(";case 41:return")";case 42:return 61==this.peek()?(this.skip(),"*="):47==this.peek()?(this.skip(),"*/"):"*";case 43:return 43==this.peek()?(this.skip(),"++"):61==this.peek()?(this.skip(),"+="):"+";case 44:return",";case 45:return 45==this.peek()?(this.skip(),"--"):61==this.peek()?(this.skip(),"-="):"-";case 46:return 46==this.peek()?(this.skip(),".."):".";case 47:return 47==this.peek()&&61==this.peek2()?(this.skip(),"//="):47==this.peek()?(this.skip(),"//"):61==this.peek()?(this.skip(),"/="):42==this.peek()?(this.skip(),"/*"):"/";case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.unget(),this.parseNumber(this.data),"NUMBER";case 58:return 58==this.peek()?(this.skip(),"::"):":";case 59:return";";case 60:return 60==this.peek()?(this.skip(),"<<"):61==this.peek()?(this.skip(),"<="):"<";case 61:return 61==this.peek()?(this.skip(),"=="):126==this.peek()?(this.skip(),"=~"):"=";case 62:return 62==this.peek()?(this.skip(),">>"):61==this.peek()?(this.skip(),">="):">";case 63:return"?";case 64:return"@";case 91:return"[";case 92:return'"';case 93:return"]";case 94:return"^";case 96:return"`";case 123:return"{";case 124:return 124==this.peek()?(this.skip(),"||"):61==this.peek()?(this.skip(),"|="):"|";case 125:return 125==this.peek()&&36==this.peek2()?(this.skip(),this.skip(),"}}$"):"}";case 126:return 62==this.peek()?(this.skip(),"~>"):"~"}if(this.unget(),this.parseAlphaNumeric(this.data))return Language.keywords.hasOwnProperty(this.data.value)?Language.keywords[this.data.value]:Language.values.hasOwnProperty(this.data.value)?(this.data.value=Language.values[this.data.value],"BOOLEAN"):"OBSERVABLE";throw this.skip(),new Error("Invalid Token: "+b)},"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.EdenStream=EdenStream,exports.EdenSyntaxData=EdenSyntaxData),Eden.SyntaxError=function(a,b,c){this.type="syntax",this.context=a,this.errno=b,this.extra=c,this.token=a.token,this.prevtoken=a.previous,this.line=a.stream.prevline,this.position=a.stream.position,this.prevposition=a.stream.prevposition},Eden.SyntaxError.UNKNOWN=0,Eden.SyntaxError.EXPCLOSEBRACKET=1,Eden.SyntaxError.BADFACTOR=2,Eden.SyntaxError.ACTIONCOLON=3,Eden.SyntaxError.ACTIONNOWATCH=4,Eden.SyntaxError.ACTIONCOMMAS=5,Eden.SyntaxError.ACTIONOPEN=6,Eden.SyntaxError.ACTIONCLOSE=7,Eden.SyntaxError.LOCALNAME=8,Eden.SyntaxError.LOCALSEMICOLON=9,Eden.SyntaxError.WHENTYPE=10,Eden.SyntaxError.LISTINDEXEXP=11,Eden.SyntaxError.LISTINDEXCLOSE=12,Eden.SyntaxError.LVALUE=13,Eden.SyntaxError.SEMICOLON=14,Eden.SyntaxError.STATEMENT=15,Eden.SyntaxError.DEFINITION=16,Eden.SyntaxError.FUNCCALLEND=17,Eden.SyntaxError.LISTLITCLOSE=18,Eden.SyntaxError.TERNIFCOLON=19,Eden.SyntaxError.IFCONDOPEN=20,Eden.SyntaxError.IFCONDCLOSE=21,Eden.SyntaxError.PARAMNAME=22,Eden.SyntaxError.PARAMSEMICOLON=23,Eden.SyntaxError.FUNCOPEN=24,Eden.SyntaxError.FUNCCLOSE=25,Eden.SyntaxError.FUNCNAME=26,Eden.SyntaxError.FOROPEN=27,Eden.SyntaxError.FORCLOSE=28,Eden.SyntaxError.FORSTART=29,Eden.SyntaxError.FORCOND=30,Eden.SyntaxError.SUBSCRIBEOPEN=31,Eden.SyntaxError.SUBSCRIBECLOSE=32,Eden.SyntaxError.SWITCHOPEN=33,Eden.SyntaxError.SWITCHCLOSE=34,Eden.SyntaxError.DEFAULTCOLON=35,Eden.SyntaxError.CASELITERAL=36,Eden.SyntaxError.CASECOLON=37,Eden.SyntaxError.INSERTCOMMA=38,Eden.SyntaxError.DELETECOMMA=39,Eden.SyntaxError.APPENDCOMMA=40,Eden.SyntaxError.SCOPENAME=41,Eden.SyntaxError.SCOPEEQUALS=42,Eden.SyntaxError.SCOPECLOSE=43,Eden.SyntaxError.BACKTICK=44,Eden.SyntaxError.WHILEOPEN=45,Eden.SyntaxError.WHILECLOSE=46,Eden.SyntaxError.WHILENOSTATEMENT=47,Eden.SyntaxError.NEGNUMBER=48,Eden.SyntaxError.DEFINELISTIX=49,Eden.SyntaxError.OUTOFBOUNDS=50,Eden.SyntaxError.PROPERTYNAME=51,Eden.SyntaxError.WHILEOFDO=52,Eden.SyntaxError.PARAMNUMBER=53,Eden.SyntaxError.AFTEROPEN=55,Eden.SyntaxError.AFTERCLOSE=56,Eden.SyntaxError.ACTIONNAME=57,Eden.SyntaxError.WHENOPEN=58,Eden.SyntaxError.WHENCLOSE=59,Eden.SyntaxError.DONAME=60,Eden.SyntaxError.PROCNAME=61,Eden.SyntaxError.IMPORTPATH=62,Eden.SyntaxError.IMPORTOPTION=63,Eden.SyntaxError.IMPORTCOMB=64,Eden.SyntaxError.IFNOSTATEMENT=65,Eden.SyntaxError.AFTERNOSTATEMENT=66,Eden.SyntaxError.WHENNOSTATEMENT=67,Eden.SyntaxError.LITCHAREMPTY=68,Eden.SyntaxError.LITCHARCLOSE=69,Eden.SyntaxError.LITSTRLINE=70,Eden.SyntaxError.LITSTRCLOSE=71,Eden.SyntaxError.IMPORTTAG=72,Eden.SyntaxError.SWITCHSCRIPT=73,Eden.SyntaxError.RANGEBANNED=74,Eden.SyntaxError.HEREDOCTOKEN=75,Eden.SyntaxError.SELECTORACTION=76,Eden.SyntaxError.SELECTORATTRIB=77,Eden.SyntaxError.SELECTORTAG=78,Eden.SyntaxError.SELECTORBTICK=79,Eden.SyntaxError.SELECTOROPTION=80,Eden.SyntaxError.QUERYOPEN=81,Eden.SyntaxError.QUERYCLOSE=82,Eden.SyntaxError.QUERYSELECTOPEN=83,Eden.SyntaxError.QUERYSELECTCLOSE=84,Eden.SyntaxError.QUERYSELECTCOMMA=85,Eden.SyntaxError.BLOCKCOMMENT=86,Eden.SyntaxError.NEWLINE=87,Eden.SyntaxError.db=[{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return"}"==this.token||"]"==this.token?0:";"==this.token?1:2},suggestion:{expected:[")"],next:[";","+","-","==","<=",">=","!=","/","*","%","^"]}},{message:function(){if("{"==this.token)return 0;if(")"==this.token){var a=this.context.stream.tokenType(this.prevtoken);return"operator"==a?3:1}var b=this.context.stream.tokenType(this.token);return"keyword"==b?4:"operator"==b?3:2},suggestion:{expected:["NUMBER","STRING","OBSERVABLE","&","!","("],next:["NUMBER","STRING","OBSERVABLE","&","!","(",";","+","-","==","<=",">=","!=","/","*","%","^"]}},{message:function(){if("{"==this.token)return 1;if("OBSERVABLE"==this.token)return 0;var a=this.context.stream.tokenType(this.token);return"keyword"==a?3:2},suggestion:{expected:[":"],next:["OBSERVABLE"]}},{message:function(){if("{"==this.token)return 2;if("("==this.token)return 3;if("["==this.token&&(":"==this.prevtoken||","==this.prevtoken))return 6;if("NUMBER"==this.token||"STRING"==this.token)return 4;if(","==this.token)return 5;var a=this.context.stream.tokenType(this.token);return"keyword"==a?0:1},suggestion:{expected:["OBSERVABLE"],next:[",","{"]}},{message:function(){if("{"==this.token)return 0;if("("==this.token&&!this.context.stream.isBEOL())return 1;var a=this.context.stream.tokenType(this.token);return"keyword"==a?2:3},suggestion:{expected:["OBSERVABLE"],next:[",","{"]}},{message:function(){if(("("==this.token||"["==this.token)&&this.context.stream.isBEOL())return 6;if("("==this.token)return 0;if("["==this.token)return 1;if(";"==this.token)return 2;var a=this.context.stream.tokenType(this.token);return"keyword"==a||"identifier"==a?3:"separator"==a?4:5},suggestion:{expected:["{"],next:["local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){return(")"==this.token||"]"==this.token)&&this.context.stream.isBEOL()?0:1},suggestion:{expected:["}"],next:["proc","func","if","for","OBSERVABLE","switch","while","return","continue","break"]}},{message:function(){var a=this.context.stream.tokenType(this.token);return"keyword"==a?0:";"==this.token?1:2},suggestion:{expected:["OBSERVABLE"],next:[";"]}},{message:function(){return"is"==this.token||"="==this.token?1:0},suggestion:{expected:[";"],next:["local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){return 0},suggestion:{expected:["touch","change","("],next:["OBSERVABLE",":","NUMBER","STRING","!","&"]}},{message:function(){return 0},suggestion:{expected:["(","OBSERVABLE","NUMBER"],next:["]","OBSERVABLE","NUMBER","+","-","/","*","%","^"]}},{message:function(){return 1},suggestion:{expected:["]"],next:["[",".","=","+=","-=","==","+","-","/","*",";","/=","*=","%","^","is"]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:[".","[","is","=","+=","-=","++","--","*=","/="]}},{message:function(){if("."==this.token){var a=this.position>=2?this.context.stream.code.charCodeAt(this.position-2):0;return"NUMBER"==this.prevtoken&&32!=a&&160!=a?1:2}return"OBSERVABLE"==this.token?this.context.stream.isBEOL()?3:4:0},suggestion:{expected:[";"],next:["proc","when","OBSERVABLE","if","for","while","EOF","switch","func"]}},{message:function(){return 0},suggestion:{expected:["proc","func","when","if","for","while","switch","OBSERVABLE","{"],next:["OBSERVABLE","(","change","touch","is","=","+=","-=","*=","proc","func","when","if","for","while","switch"]}},{message:function(){return 0},suggestion:{expected:["=","is","+=","-=","/=","*="],next:["(","OBSERVABLE","NUMBER","STRING","!"]}},{message:function(){return 0},suggestion:{expected:[")"],next:[";","(","[","+","-","/","*","%","^"]}},{message:function(){return 0},suggestion:{expected:["]"],next:[]}},{message:function(){return 0},suggestion:{expected:[":"],next:[]}},{message:function(){return 0},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:[")"],next:[]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:[";"]}},{message:function(){return 0},suggestion:{expected:[";"],next:["para","local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){if(("("==this.token||"["==this.token)&&this.context.stream.isBEOL())return 6;if("("==this.token)return 0;if("["==this.token)return 1;if(";"==this.token)return 2;var a=this.context.stream.tokenType(this.token);return"keyword"==a||"identifier"==a?3:"separator"==a?4:5},suggestion:{expected:["{"],next:["local","OBSERVABLE","if","for","switch","while","return"]}},{message:function(){return 0},suggestion:{expected:["}"],next:[";"]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:["{"]}},{message:function(){return 0},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:[")"],next:[]}},{message:function(){return 0},suggestion:{expected:[";"],next:[]}},{message:function(){return 0},suggestion:{expected:[";"],next:[]}},{message:function(){return 0},suggestion:{expected:["["],next:[]}},{message:function(){return 0},suggestion:{expected:["]"],next:[]}},{message:function(){return 0},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:["]"],next:[]}},{message:function(){return 0},suggestion:{expected:[":"],next:[]}},{message:function(){return 0},suggestion:{expected:["NUMBER","STRING"],next:[]}},{message:function(){return 0},suggestion:{expected:[":"],next:[]}},{message:function(){return 0},suggestion:{expected:[","],next:[]}},{message:function(){return 0},suggestion:{expected:[","],next:[]}},{message:function(){return 0},suggestion:{expected:[","],next:[]}},{message:function(){return 0},suggestion:{expected:["OBSERVABLE"],next:[]}},{message:function(){return 0},suggestion:{expected:["="],next:[]}},{message:function(){return 0},suggestion:{expected:["}"],next:[]}},{message:function(){return 0},suggestion:{expected:["`"],next:[]}},{message:function(){return 0},suggestion:{expected:["("],next:[]}},{message:function(){return 0},suggestion:{expected:[")"],next:[]}},{message:function(){ +return 0},suggestion:{expected:[")"],next:[]}},{message:function(){return 0},suggestion:{expected:["NUMBER"],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){var a=this.context.stream.tokenType(this.token);return"keyword"==a?0:"boolean"==a||"character"==a||"string"==a||"number"==a?1:":"==this.token?4:"{"==this.token?5:"closebracket"==this.token?3:2},suggestion:{expected:["OBSERVABLE"],next:[":"]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}},{message:function(){return 0},suggestion:{expected:[],next:[]}}],Eden.SyntaxError.prototype.extractBefore=function(a){for(var b=this.prevposition;b>0&&a>0&&10!=this.context.stream.code.charCodeAt(b);)b--,a--;return 10==this.context.stream.code.charCodeAt(b)&&b++,this.context.stream.code.substr(b,this.prevposition-b)},Eden.SyntaxError.prototype.extractToken=function(){return this.context.stream.code.substr(this.prevposition,this.position-this.prevposition)},Eden.SyntaxError.prototype.extractAfter=function(a){for(var b=this.position;b0&&10!=this.context.stream.code.charCodeAt(b);)b++,a--;return this.context.stream.code.substr(this.position,b-this.position)},Eden.SyntaxError.prototype.buildSuggestion=function(){var a=Eden.SyntaxError.db[this.errno].suggestion;return a.next.indexOf(this.token)!=-1?this.extractBefore(10)+a.expected[0]+" "+this.extractToken()+this.extractAfter(10):this.extractBefore(10)+a.expected[0]+" "+this.extractAfter(10)},Eden.SyntaxError.prototype.messageText=function(){var a=Eden.SyntaxError.db[this.errno],b=Language.errors[this.errno][a.message.call(this)];return void 0===this.extra?b:b+": "+this.extra},Eden.SyntaxError.prototype.prettyPrint=function(){this.context.stream.pushPosition(),this.context.stream.move(this.position);var a=Eden.SyntaxError.db[this.errno],b=Language.errors[this.errno][a.message.call(this)],c="Error:\n "+b+"\n Source : "+this.context.src+", line "+this.line+"\n Code : "+this.errno;return c+="\n Here : "+this.extractBefore(10)+">>> "+this.extractToken()+" <<<"+this.extractAfter(10),a.suggestion&&(c+="\n Suggestion : "+this.buildSuggestion()),this.context.stream.popPosition(),c},Eden.SyntaxError.prototype.toString=function(){return this.prettyPrint()},Eden.RuntimeError=function(a,b,c,d){this.type="runtime",this.line=-1,this.statement=c,this.extra=d,this.errno=b,this.context=a,this.lastsymbol=eden.root.lastlookup,console.error(d)},Eden.RuntimeError.UNKNOWN=0,Eden.RuntimeError.ASSIGNEXEC=1,Eden.RuntimeError.FUNCCALL=2,Eden.RuntimeError.ACTIONNAME=3,Eden.RuntimeError.NOAGENT=4,Eden.RuntimeError.NOTSUPPORTED=5,Eden.RuntimeError.ASSIGNTODEFINED=6,Eden.RuntimeError.ASSIGNDIMENSION=7,Eden.RuntimeError.EXTENDSTATIC=8,Eden.RuntimeError.INFINITERANGE=9,Eden.RuntimeError.NOLISTRANGE=10,Eden.RuntimeError.LEFTCONCAT=11,Eden.RuntimeError.RIGHTCONCAT=12,Eden.RuntimeError.AGENTSOURCE=13,Eden.RuntimeError.JSOBSERVER=14,Eden.RuntimeError.PROCAGENT=15,Eden.RuntimeError.ARGUMENTS=16,Eden.RuntimeError.NOTCHILD=17,Eden.RuntimeError.prototype.messageText=function(){var a=!this.statement||"functioncall"!=this.statement.type&&"definition"!=this.statement.type&&"assignment"!=this.statement.type?"":"'"+this.statement.lvalue.name+"': ";switch(this.errno){case Eden.RuntimeError.ACTIONNAME:case Eden.RuntimeError.NOAGENT:case Eden.RuntimeError.NOTSUPPORTED:case Eden.RuntimeError.AGENTSOURCE:case Eden.RuntimeError.JSOBSERVER:case Eden.RuntimeError.PROCAGENT:case Eden.RuntimeError.ARGUMENTS:case Eden.RuntimeError.EXTENDSTATIC:return a+this.extra;case Eden.RuntimeError.ASSIGNTODEFINED:return a+"cannot assign to a defined list, use 'is'";case Eden.RuntimeError.ASSIGNDIMENSION:return a+"list does not have this many dimensions";case Eden.RuntimeError.RIGHTCONCAT:return a+"Concatenation: When the right hand side is a list then the left hand side must also be a list";case Eden.RuntimeError.LEFTCONCAT:return a+"Concatenation: When the left hand side is a list then the right hand side must also be a list";case Eden.RuntimeError.INFINITERANGE:return a+"range scope is infinite";case Eden.RuntimeError.NOLISTRANGE:return a+"range 'in' is not a list"}return String(this.extra).search("is not a function")>=0?a+"function used does not exist":this.errno==Eden.RuntimeError.FUNCCALL&&String(this.extra).search("Cannot read property 'call'")>=0?a+"procedure does not exist":String(this.extra).match(/Cannot read property .* of undefined/)?a+"uses an undefined list":this.extra},Eden.RuntimeError.prototype.edenSource=function(){if(this.statement)if("definition"==this.statement.type){var a=eden.root.symbols[this.statement.lvalue.name];if(a&&a.definition)return a.getSource()}else if(this.context)return this.context.getSource(this.statement)},Eden.RuntimeError.prototype.javascriptSource=function(){return this.statement.generate({scopes:[],dependencies:{}},"scope")},Eden.RuntimeError.prototype.details=function(){var a="";return"definition"!=this.statement.type&&"assignment"!=this.statement.type||(a+="Symbol: "+this.statement.lvalue.name+"\n"),a+=String(this.extra).search("SyntaxError")>=0?"JavaScript: "+this.javascriptSource()+"\n":"Source: "+this.edenSource()+"\n",this.extra.message&&(a+="Original: "+this.extra.message+"\n"),a},Eden.RuntimeError.prototype.prettyPrint=function(){return this.extra&&this.extra.stack?"Run-time Error:\n"+this.extra.stack:"Run-time Error:\n"},Eden.Selectors={cache:{}},Eden.Selectors.getScriptBase=function(a){for(var b=a;b.parent;)b=b.parent;return b.base.origin.name},Eden.Selectors.buildScriptTree=function(a){for(var b={},c=0;c ")},Eden.Selectors.getPath=function(a){},Eden.Selectors.testType=function(a){if("binaryop"==a.type)switch(a.op){case"+":case"-":case"/":case"*":case"^":case"%":return"number";case"//":return"list";case"==":case"<":case">":case"<=":case">=":case"||":case"&&":case"!=":return"boolean";default:return"unknown"}else if("literal"==a.type)switch(a.datatype){case"NUMBER":return"number";case"BOOLEAN":return"boolean";case"STRING":return"string";case"LIST":return"list";default:return"unknown"}return"unknown"},Eden.Selectors.getChildren=function(a,b){var c=[];if(void 0===a)return c;for(var d=0;da[d].depth);)"dummy"!=e.type&&(c.push(e),f.push(e)),e=e.nextSibling;b&&c.push.apply(c,Eden.Selectors.getChildren(f,b))}return c=c.filter(function(a){return"dummy"!=a.type})},Eden.Selectors.allowedOptions={external:!0,history:!0,all:!0,indexed:!0,index:!0,nosort:!0,remote:!0},Eden.Selectors.resultTypes={brief:!0,comment:!0,source:!0,innersource:!0,title:!0,path:!0,name:!0,symbol:!0,line:!0,depends:!0,value:!0,tags:!0,rawcomment:!0,id:!0,remote:!0,root:!0,enabled:!0,executed:!0,exprtree:!0},Eden.Selectors.expressionToLists=function(a){switch(a.type){case"binaryop":return[Eden.Selectors.expressionToLists(a.l),a.op,Eden.Selectors.expressionToLists(a.r)];case"ternaryop":return[Eden.Selectors.expressionToLists(a.first),"if",Eden.Selectors.expressionToLists(a.condition),"else",Eden.Selectors.expressionToLists(a.second)];case"unaryop":return[a.op,Eden.Selectors.expressionToLists(a.r)];case"length":return[Eden.Selectors.expressionToLists(a.l),"#"];case"index":return Eden.Selectors.expressionToLists(a.expression)}if(console.log(a),"functioncall"==a.type){console.log("FUNCCALL");for(var b=[],c=0;c0;break;case"historic":i=f.executed==-1;break;case"tags":f.doxyComment&&(i=f.doxyComment.getHashTags());break;case"rawcomment":f.doxyComment&&(i=f.doxyComment.content);break;case"controls":case"id":i=f.id;break;case"path":i=Eden.Selectors.getID(f);break;case"remote":for(var l=f;l.parent;)l=l.parent;if(!l.base||!l.base.origin){i=!1;break}i=l.base.origin.remote;break;case"root":i=void 0===f.parent}g.push(i)}c.length>1?d.push(g):1==c.length&&g.length>0&&d.push(g[0])}return d}return a},Eden.Selectors.outerBracket=function(a){for(var b=0,c=0;c0&&"@"==a.charAt(0);){c||(c={}),a=a.substring(1);var d=a.search(/[^a-z]+/);d==-1&&(d=a.length);var e=a.substring(0,d);a=a.substring(d).trim(),c[e]=!0}return Eden.Selectors._parse(a,c)}},Eden.Selectors._parse=function(a,b){var c;if(a&&""!=a){if(">"==a.charAt(0))">"==a.charAt(1)?(c=new Eden.Selectors.NavigateNode(">",(!0)),a=a.substring(2).trim()):(c=new Eden.Selectors.NavigateNode(">",(!1)),a=a.substring(1).trim());else if("<"==a.charAt(0))"<"==a.charAt(1)?(c=new Eden.Selectors.NavigateNode("<",(!0)),a=a.substring(2).trim()):(c=new Eden.Selectors.NavigateNode("<",(!1)),a=a.substring(1).trim());else if(","==a.charAt(0))c=new Eden.Selectors.UnionNode,a=a.substring(1).trim();else if(":"==a.charAt(0)||"."==a.charAt(0)){var d=a.substring(1),e=d.search(/[^a-zA-Z0-9\-]/);e==-1?e=a.length:e++;var f=a.substring(0,e),g=void 0;if(e]/);j==-1&&(j=a.length);var k=a.substring(0,j).trim();if(k.startsWith("plugins")){for(var l=a.split(">"),m="",n=0;n0){for(var c=0;c0?c(0):b&&b()})},Eden.Selectors.goto=function(a){Eden.Selectors.query(a,void 0,{minimum:1,noindex:!0},function(b){if(0==b.length)return!1;for(var c=[b[0]],d=b[0];d.parent;)c.push(d.parent),d=d.parent;for(var e=!1,f=0;f":this.compare="="==b.charAt(1)?">=":">";break;case"=":this.compare="=";break;case"!":this.compare="!="}if(this.compare)switch(this.compare){case"!":case"=":case">":case"<":this.value=b.substring(1);break;case">=":case"<=":this.value=b.substring(2)}if(this.isreg?this.value=Eden.Selectors.makeRegex(this.value):null!==b.match(/^[0-9]+\-[0-9]+$/)?this.range=!0:null!==b.match(/^[0-9]+$/)&&(this.value=parseInt(b)),".type"==this.name)switch(this.param){case"is":this.param="definition";break;case"assign":case"=":this.param="assignment";break;case"call":this.param="functioncall";break;case"proc":this.param="action";break;case"action":this.param="script";break;case"+=":case"-=":case"*=":case"/=":case"++":case"--":this.param="modify"}}},Eden.Selectors.PropertyNode.attributes={name:{local:!1,indexed:!0,rank:1},type:{local:!1,indexed:!1,rank:3},datatype:{local:!1,indexed:!1,rank:30},id:{local:!1,indexed:!0,rank:2},lines:{local:!1,indexed:!1,rank:3},depends:{local:!1,indexed:!1,rank:4},time:{local:!0,indexed:!1,rank:3},date:{local:!1,indexed:!1,rank:3},title:{local:!1,indexed:!1,rank:10},author:{local:!1,indexed:!1,rank:10},v:{local:!1,indexed:!1,rank:20},version:{local:!1,indexed:!1,rank:20},source:{local:!0,indexed:!1,rank:50},comment:{local:!0,indexed:!1,rank:50}},Eden.Selectors.PropertyNode.pseudo={line:{local:!1,indexed:!1,rank:50},determines:{local:!0,indexed:!0,rank:10},first:{local:!1,indexed:!0,rank:5},last:{local:!1,indexed:!0,rank:5},unexecuted:{local:!0,indexed:!1,rank:3},executed:{local:!0,indexed:!1,rank:3},root:{local:!1,indexed:!0,rank:3},project:{local:!0,indexed:!0,rank:3},nth:{local:!1,indexed:!0,rank:5},value:{local:!0,indexed:!1,rank:50},matches:{local:!1,indexed:!1,rank:100},age:{local:!1,indexed:!1,rank:6},remote:{local:!0,indexed:!0,rank:20},not:{local:!1,indexed:!1,rank:100},active:{local:!0,indexed:!1,rank:10},me:{local:!1,indexed:!1,rank:20},listed:{local:!1,indexed:!1,rank:20}},Eden.Selectors.PropertyNode.prototype.append=function(a){if(!a)return this;switch(a.type){case"property":case"tag":case"name":var b=new Eden.Selectors.IntersectionNode(this,a);return b.options=this.options,b;case"union":case"intersection":return a.prepend(this),a;case"navigate":return a.prepend(this),a}return this},Eden.Selectors.PropertyNode.prototype.prepend=function(a){if(!a)return this;switch(a.type){case"property":case"tag":case"name":var b=new Eden.Selectors.IntersectionNode(a,this);return b.options=this.options,b;case"union":case"intersection":return a.append(this),a;case"navigate":return a.append(this),a}return this},Eden.Selectors.PropertyNode.prototype.filter=function(a){a||(a=this.construct());var b=this,c=this.value,d=this.name;if("number"==typeof this.name)return a&&a.length>=this.name?[a[this.name-1]]:[];switch(d){case".name":if(!c)return a.filter(function(a){return void 0!==a.lvalue||void 0!==a.name});var e=edenUI.regExpFromStr(c);return a.filter(function(a){return a.lvalue&&e.test(a.lvalue.name)||a.name&&e.test(a.name)});case".id":return a.filter(function(a){return 0==a.id&&a.buildID(),a.id==c});case".type":if(!c)break;return a.filter(function(a){return a.type==c});case".datatype":return a.filter(function(a){return a.expression&&Eden.Selectors.testType(a.expression)==c||a.expression&&"scope"==a.expression.type&&a.expression.range&&"list"==c});case".lines":return a;case":line":return a;case".op":case".operator":return a;case":pattern":return a;case":determines":return a;case".depends":return a.filter(function(a){return("definition"==a.type||"when"==a.type)&&a.dependencies[c]});case":active":return a.filter(function(a){if("definition"==a.type||"assignment"==a.type){var b=eden.root.symbols[a.lvalue.name];return b&&(b.origin===a||b.origin&&b.origin.id==a.id)}return"when"==a.type&&a.enabled});case":first":return a.length>0?[a[0]]:[];case":last":return a.length>0?[a[a.length-1]]:[];case":unexecuted":return a.filter(function(a){return 0==a.executed});case":executed":return a.filter(function(a){return 1==a.executed});case":root":return a.filter(function(a){return void 0===a.parent});case":project":return[eden.project.ast.script];case":nth":return a.filter(function(a){return a.parent&&Eden.Selectors.getChildren([a.parent],!1)[b.value-1]===a});case":value":return a;case":":case":matches":var f=Eden.Selectors.parse(this.param);return f?f.filter(a):[];case".title":return this.isreg?a.filter(function(a){if(!a.doxyComment)return!1;var c=a.doxyComment.getProperty("title");return c&&b.value.test(c)}):a.filter(function(a){if(!a.doxyComment)return!1;var c=a.doxyComment.getProperty("title");return c&&c==b.value});case".author":return a;case".version":return a;case".source":return this.isreg?a.filter(function(a){return b.value.test(a.getSource())}):a.filter(function(a){return a.getSource()==b.value});case".comment":return this.isreg?a.filter(function(a){return a.doxyComment&&b.value.test(a.doxyComment.stripped())}):a.filter(function(a){return a.doxyComment&&a.doxyComment.stripped()==b.value});case":age":var g=generateTimeStamp(this.value),h=Date.now(),i=h-g;return console.log("AGE",g,h,i),void 0===this.compare||"<"==this.compare?a.filter(function(a){return a.stamp>i}):a.filter(function(a){return a.stamp=0})},Eden.Selectors.NameNode=function(a){this.type="name",this.name=a,this.options=void 0,this.isreg="/"==a.charAt(0)||a.indexOf("*")!=-1,this.local=!1},Eden.Selectors.NameNode.prototype.filter=function(a){if(!a)return this.construct();var b=this.name;if(this.isreg){var c=Eden.Selectors.makeRegex(this.name);return a.filter(function(a){return a.lvalue&&c.test(a.lvalue.name)||a.name&&c.test(a.name)})}return a.filter(function(a){return a.lvalue&&a.lvalue.name==b||a.name&&a.name==b})},Eden.Selectors.NameNode.prototype.construct=function(){if(this.isreg){var a=Eden.Selectors.makeRegex(this.name);stats=Eden.Index.getByNameRegex(a)}else{stats=Eden.Index.getByName(this.name);for(var b=this.name.toLowerCase().split(" "),c=Eden.Index.getByTag("#"+b[0]),d=1;d=0})},Eden.Selectors.NameNode.prototype.append=Eden.Selectors.PropertyNode.prototype.append,Eden.Selectors.NameNode.prototype.prepend=Eden.Selectors.PropertyNode.prototype.prepend,Eden.Selectors.TagNode=function(a){this.type="tag",this.tag=a,this.options=void 0,this.isreg=a.indexOf("*")!=-1,this.local=!1},Eden.Selectors.TagNode.prototype.filter=function(a){if(!a)return this.construct();var b=this;return a.filter(function(a){return a.doxyComment&&a.doxyComment.hasTag(b.tag)})},Eden.Selectors.TagNode.prototype.construct=function(){if(this.isreg){var a=Eden.Selectors.makeRegex(this.tag);stats=Eden.Index.getByTagRegex(a)}else stats=Eden.Index.getByTag(this.tag);return this.options&&this.options.history?stats:stats.filter(function(a){return a.executed>=0})},Eden.Selectors.TagNode.prototype.append=Eden.Selectors.PropertyNode.prototype.append,Eden.Selectors.TagNode.prototype.prepend=Eden.Selectors.PropertyNode.prototype.prepend, +Eden.Selectors.IntersectionNode=function(a,b){this.type="intersection",this.children=[a,b],this.local=!1},Eden.Selectors.IntersectionNode.prototype.append=function(a){if(!a)return this;switch(a.local&&(this.local=!0),a.type){case"navigate":return a.prepend(this),a}return this.children.push(a),this},Eden.Selectors.IntersectionNode.prototype.prepend=function(a){return a?(a.local&&(this.local=!0),this.children.splice(0,0,a),this):this},Eden.Selectors.IntersectionNode.prototype.filter=function(a,b){for(var c=0;c"==this.direction){if(!a&&void 0===this.left)return this.right?this.right.filter(a,b).filter(function(a){return void 0!==a.parent}):Eden.Index.getAll().filter(function(a){return void 0!==a.parent});var c;return c=void 0===this.left?Eden.Selectors.getChildren(a,this.deep):Eden.Selectors.getChildren(this.left.filter(a,b),this.deep),this.right?this.right.filter(c,b):c}if("<"==this.direction){if(!a&&void 0===this.left)return this.right?this.right.filter(a,b).filter(function(a){return"script"==a.type||"when"==a.type||"if"==a.type||"for"==a.type}):Eden.Index.getAll().filter(function(a){return"script"==a.type||"when"==a.type||"if"==a.type||"for"==a.type});var c;if(c=void 0===this.left?a.filter(function(a){return"script"==a.type||"when"==a.type||"if"==a.type||"for"==a.type}):this.left.filter(a,b),this.deep){for(var d=[],e=0;e=0&&Eden.Index.name_index[d].splice(e,1)}if(a.tags)for(var f=a.tags,c=0;c=0&&Eden.Index.tag_index[f[c]].splice(e,1)}}}},Eden.Index.update=function(a){if(void 0===Eden.Index.id_index[a.id]&&(Eden.Index.id_index[a.id]=[]),Eden.Index.id_index[a.id].push(a),1==Eden.Index.id_index[a.id].length){if(void 0===Eden.Index.type_index[a.type]&&(Eden.Index.type_index[a.type]={}),Eden.Index.type_index[a.type][a.id]=!0,a.name&&"do"!=a.type||a.lvalue){var b=a.name?a.name:a.lvalue.name;void 0===Eden.Index.name_index[b]&&(Eden.Index.name_index[b]=[]),Eden.Index.name_index[b].indexOf(a.id)==-1&&Eden.Index.name_index[b].push(a.id)}if(a.tags)for(var c=a.tags,d=0;d0&&this.errors.push.apply(this.errors,a.errors),a&&a.warning&&(this.warning=a.warning)},Eden.AST.debug=!1,Eden.AST.debugstep=!1,Eden.AST.debugstep_cb=void 0,Eden.AST.debugspeed=500,Eden.AST.debugbreakpoint=void 0,Eden.AST.debugbreakpoint_cb=void 0,Eden.AST.debug_begin_cb=void 0,Eden.AST.debug_end_cb=void 0,Eden.AST.fromNode=function(a,b){var c=new Eden.AST(a.getInnerSource(),(void 0),b,{noindex:!0,noparse:!0});return c.script=a,c.whens=Eden.Selectors.queryWithin([a],">>.type(when)"),c.errors=a.errors,c},Eden.AST.prototype.doxyFromOrigin=function(){var a=this.origin.name;if(this.origin.title&&(a+="\n * @title "+this.origin.title),this.origin.author&&(a+="\n * @author "+this.origin.author),this.origin.id&&(a+="\n * @id "+this.origin.id),this.origin.saveID&&(a+="\n * @version "+this.origin.vid),this.origin.tags&&this.origin.tags.length>0){a+="\n *";for(var b=0;b>"),b=0;b0&&(this.lines[a].executed=0)},Eden.AST.prototype.executeLine=function(a,b,c){var d,e=a;d=a==-1?this.script:this.lines[e],void 0!==d&&(d=this.getBase(d),this.executeStatement(d,e,b,c))},Eden.AST.parseStatement=function(a,b){var c=new Eden.AST(a,(void 0),b?b:{},{noparse:!0,noindex:!0});c.next();var d=c.pSTATEMENT();d.base=c,d.setSource(0,a.length,a),d.stamp=c.stamp;var e=a.match("\n");return null===e?d.numlines=0:d.numlines=e.length,d},Eden.AST.parseScript=function(a,b){var c=new Eden.AST(a,(void 0),b?b:{},{noparse:!0,noindex:!0});c.next();var d=c.pSCRIPT();d.base=c,d.setSource(0,a.length,a),d.stamp=c.stamp;var e=a.match("\n");return null===e?d.numlines=0:d.numlines=e.length,d},Eden.AST.parseExpression=function(a){var b=new Eden.AST(a,(void 0),{},{noparse:!0,noindex:!0});b.next();var c=b.pEXPRESSION();return c},Eden.AST.registerStatement=function(a){a.prototype.getOrigin=Eden.AST.BaseStatement.getOrigin,a.prototype.hasErrors=Eden.AST.BaseStatement.hasErrors,a.prototype.setSource=Eden.AST.BaseStatement.setSource,a.prototype.getSource=Eden.AST.BaseStatement.getSource,a.prototype.getOuterSource=Eden.AST.BaseStatement.getOuterSource,a.prototype.getNumberOfLines=Eden.AST.BaseStatement.getNumberOfLines,a.prototype.getStartLine=Eden.AST.BaseStatement.getStartLine,a.prototype.getEndLine=Eden.AST.BaseStatement.getEndLine,a.prototype.getRange=Eden.AST.BaseStatement.getRange,a.prototype.error=Eden.AST.fnEdenASTerror,a.prototype.addIndex=Eden.AST.BaseStatement.addIndex,a.prototype.removeIndex=Eden.AST.BaseStatement.removeIndex,a.prototype.destroy=Eden.AST.BaseStatement.destroy,a.prototype.buildID=Eden.AST.BaseStatement.buildID,a.prototype.setDoxyComment=Eden.AST.BaseStatement.setDoxyComment},Eden.AST.registerScript=function(a){Eden.AST.registerStatement(a),a.prototype.getStatementByLine=Eden.AST.BaseScript.getStatementByLine,a.prototype.getRelativeLine=Eden.AST.BaseScript.getRelativeLine,a.prototype.getNumberOfLines=Eden.AST.BaseScript.getNumberOfLines,a.prototype.append=Eden.AST.BaseScript.append,a.prototype.appendChild=Eden.AST.BaseScript.appendChild,a.prototype.removeChild=Eden.AST.BaseScript.removeChild,a.prototype.insertBefore=Eden.AST.BaseScript.insertBefore,a.prototype.insertAfter=Eden.AST.BaseScript.insertAfter,a.prototype.replaceChild=Eden.AST.BaseScript.replaceChild,a.prototype.addIndex=Eden.AST.BaseScript.addIndex,a.prototype.removeIndex=Eden.AST.BaseScript.removeIndex,a.prototype.destroy=Eden.AST.BaseScript.destroy,a.prototype.buildID=Eden.AST.BaseScript.buildID},Eden.AST.registerContext=function(a){Eden.AST.registerScript(a)},Eden.AST.prototype.getBase=function(a,b){void 0===b&&console.error("Undefined context in getBase");for(var c=a;c&&c.parent&&c.parent!==b;)c=c.parent;return c},Eden.AST.prototype.getBlockLines=function(a,b){for(var c=a,d=this.getBase(this.lines[c],b);c>0&&this.lines[c-1]&&this.getBase(this.lines[c-1],b)==d;)c--;for(var e=c;c0},Eden.AST.prototype.prettyPrint=function(){var a="";if(this.script.errors.length>0)for(var b=0;b0);)this.token=this.stream.readToken(),"/*"==this.token?b++:"*/"==this.token&&b--;if("*/"!=this.token){var f=new Eden.SyntaxError(this,Eden.SyntaxError.BLOCKCOMMENT);f.line=e,this.errors.push(f)}if(c){var g=new Eden.AST.DoxyComment(this.stream.code.substring(d+3,this.stream.position-2).trim(),e,this.stream.line);this.lastDoxyComment.push(g),g.parent=this.parentDoxy,g.content.endsWith("@{")?this.parentDoxy=g:g.content.startsWith("@}")&&this.parentDoxy&&(this.parentDoxy=this.parentDoxy.parent)}this.token=this.stream.readToken()}else{if("${{"!=this.token)break;var d=this.stream.position,e=this.stream.line;for(this.data.line=e;this.stream.valid()&&"}}$"!=this.token;)this.token=this.stream.readToken();this.data.value=this.stream.code.substring(d,this.stream.position-3),this.token="JAVASCRIPT",this.stream.prevposition=d-3}this.stream.prevline=a},Eden.AST.prototype.peekNext=function(a){var b,c={value:""};for(this.stream.data=c,this.stream.pushPosition();a>0;)b=this.stream.readToken(),a--;return this.stream.popPosition(),this.stream.data=this.data,b},Eden.AST.BaseStatement=function(){this.start=0,this.end=0,this.parent=void 0,this.errors=[],this.warning=void 0,this.executed=0,this.numlines=-1,this.doxyComment=void 0,this.lock=0,this.source=void 0,this.id=0,this.stamp=0,this.nextSibling=void 0,this.previousSibling=void 0,this.tags=void 0},Eden.AST.BaseStatement.setDoxyComment=function(a){this.doxyComment=a,a&&(void 0===this.tags?this.tags=a.getHashTags():this.tags=this.tags.concat(a.getHashTags()),a.hasTag("#library")&&("function"==this.type||"action"==this.type?edenFunctions[this.name]=!0:"definition"==this.type&&(edenFunctions[this.lvalue.name]=!0)))},Eden.AST.BaseStatement.buildID=function(){var a,b=0,c=this.source;this.doxyComment&&(c=this.doxyComment.content+c);for(var d=c.length,e=0;e0},Eden.AST.BaseStatement.getNumberOfLines=function(){return this.numlines},Eden.AST.BaseStatement.getStartLine=function(a){return this.parent?this.parent.getRelativeLine(this,a):-1},Eden.AST.BaseStatement.getEndLine=function(a){return this.getStartLine(a)+this.getNumberOfLines()},Eden.AST.BaseStatement.getRange=function(a){var b=this.getStartLine(a);return[b,b+this.getNumberOfLines()]},Eden.AST.BaseStatement.setSource=function(a,b,c){this.start=a,this.end=b,this.source=c},Eden.AST.BaseStatement.getSource=function(){return this.source},Eden.AST.BaseStatement.getOuterSource=function(){var a=this.getSource();void 0===this.parent&&(a="action "+this.name+"{"+a+"}"),this.doxyComment&&(a="/** "+this.doxyComment.content+" */\n"+a);for(var b=this.parent;b;)"script"==b.type?(a=b.name?"action "+b.name+" {\n"+a+"\n}":"{\n"+a+"\n}",b.doxyComment&&(a="/** "+b.doxyComment.content+" */\n"+a),b=b.parent):b=void 0;return a},Eden.AST.BaseStatement.getOrigin=function(){for(var a=this;a.parent;)a=a.parent;return a.base?a.base.origin:void 0},Eden.AST.BaseScript=function(){Eden.AST.BaseStatement.apply(this),this.statements=[],this.parameters=void 0,this.locals=void 0,this.indexed=!1},Eden.AST.BaseScript.appendChild=function(a){this.statements.push(a),this.statements.length>1&&(a.previousSibling=this.statements[this.statements.length-2],this.statements[this.statements.length-2].nextSibling=a),a.parent=this,this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this),"dummy"!=a.type&&this.indexed&&a.addIndex(),a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.BaseScript.append=Eden.AST.BaseScript.appendChild,Eden.AST.BaseScript.insertAfter=function(a,b){var c;for(c=0;c0&&this.errors.push.apply(this.errors,b.errors),this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this)},Eden.AST.BaseScript.insertBefore=function(a,b){var c;for(c=0;c0&&this.errors.push.apply(this.errors,b.errors),void(this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this))):void eden.emit("error",[new Eden.RuntimeError((void 0),Eden.RuntimeError.NOCHILD,this,"Statement is not a child when using insertBefore")])},Eden.AST.BaseScript.removeChild=function(a){var b;for(b=0;b=this.statements.length)return void eden.emit("error",[new Eden.RuntimeError((void 0),Eden.RuntimeError.NOCHILD,this,"Statement is not a child when using replaceChild")]);c=d}b.nextSibling=this.statements[c].nextSibling,b.nextSibling&&(b.nextSibling.previousSibling=b),b.previousSibling=this.statements[c].previousSibling,b.previousSibling&&(b.previousSibling.nextSibling=b),this.statements[c].destroy(),this.statements[c]=b,b.parent=this,"dummy"!=b.type&&this.indexed&&b.addIndex(),this.indexed&&0!=this.id&&console.log("INVALIDATE ID",this)},Eden.AST.BaseScript.destroy=function(){this.executed<1&&Eden.Index.remove(this);for(var a=0;aa)&&void 0!==this.statements)for(var d=0;d=c&&a<=c+e&&"dummy"!=this.statements[d].type)return this.statements[d];c+=e}},Eden.AST.BaseScript.getRelativeLine=function(a,b){var c=0;b&&b!==this&&this.parent&&(c=this.parent.getRelativeLine(this,b));for(var d=0;d0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Append.prototype.setIndex=function(a){this.index=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Append.prototype.generate=function(a,b){var c=this.index.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),d=this.destination.generate(a,b);return this.destination.islocal?d+".push("+c+");\n":b+".mutate("+d+", function(s) { scope.lookup(s.name).value.push("+c+"); }, this);"},Eden.AST.Append.prototype.execute=function(a,b,c,d){this.executed=1;var e=this.index.execute(a,b,c);e instanceof BoundValue&&(e=e.value);var f=eden.root.lookup(this.destination.name),g=f.value(c);g.push(e),f.assign(g,c,this)},Eden.AST.registerStatement(Eden.AST.Append),Eden.AST.Assignment=function(a){this.type="assignment",Eden.AST.BaseContext.apply(this),this.errors=a?a.errors:[],a&&a.warning&&(this.warning=a.warning),this.expression=a,this.lvalue=void 0,this.compiled=void 0,this.dirty=!1,this.value=void 0,this.compiled=void 0},Eden.AST.Assignment.prototype.left=function(a){this.lvalue=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Assignment.prototype.generate=function(a,b){var c=this.lvalue.generate(a,b);return this.lvalue.islocal?(c+=" = ",c+=this.expression.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),c+=";\n"):this.lvalue.hasListIndices()?(c=b+".listAssign("+c+",",c+=this.expression.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),c+=", Symbol.localJSAgent, false, ",c+=this.lvalue.generateCompList(a,b),c+=");\n"):(c=b+".assign("+c+",",c+=this.expression.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type}),c+=", Symbol.localJSAgent);\n")},Eden.AST.Assignment.prototype.compile=function(ctx){if(!this.compiled||this.dirty){this.dirty=!1,ctx?ctx.scopes=this.scopes:ctx=this;var rhs="(function(context,scope,cache,ctx) { \n",express=this.expression.generate(ctx,"scope",{bound:!0});if(ctx&&ctx.dirty&&(ctx.dirty=!1,this.dirty=!0),this.scopes.length>0){rhs+="\tvar _scopes = [];\n";for(var i=0;i0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.After.prototype.setStatement=function(a){this.statement=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.After.prototype.generate=function(a,b){void 0===b&&(b="eden.root.scope");var c="(function() {"+this.statement.generate(a,b,{bound:!1})+"})",d=this.expression.generate(a,b,{bound:!1});return"setTimeout("+c+", "+d+");\n"},Eden.AST.After.prototype.execute=function(ctx,base,scope){var statement="(function() { var scope = eden.root.scope;\n"+this.statement.generate(ctx,"root.scope")+"})";setTimeout(eval(statement),this.expression.execute(ctx,base,scope))},Eden.AST.registerStatement(Eden.AST.After),Eden.AST.BinaryOp=function(a){this.type="binaryop",this.op=a,this.errors=[],this.l=void 0,this.r=void 0,this.warning=void 0,"&"==this.op||"and"==this.op?this.op="&&":"|"!=this.op&&"or"!=this.op||(this.op="||")},Eden.AST.BinaryOp.prototype.left=Eden.AST.fnEdenASTleft,Eden.AST.BinaryOp.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.BinaryOp.prototype.setRight=function(a){this.r=a,this.errors.push.apply(this.errors,a.errors),a&&a.warning&&(this.warning=a.warning)},Eden.AST.BinaryOp.prototype.generate=function(a,b,c){var d,e={bound:!1,usevar:c.usevar},f=this.l.generate(a,b,e),g=this.r.generate(a,b,e);switch(this.op){case"//":d="concat";break;case"+":d="add";break;case"-":d="subtract";break;case"/":d="divide";break;case"*":d="multiply";break;case"==":d="equal";break;case"%":d="mod";break;case"^":d="pow";break;default:d="RAW"}var h;return h="RAW"!=d?"rt."+d+"(("+f+"),("+g+"))":"("+f+") "+this.op+" ("+g+")",c.bound?"new BoundValue("+h+", "+b+")":h},Eden.AST.BinaryOp.prototype.execute=function(ctx,base,scope){var rhs="(function(context,scope) { return ";return rhs+=this.generate(ctx,"scope",{bound:!1}),rhs+=";})",eval(rhs)(eden.root,scope)},Eden.AST.Break=function(){this.type="break",Eden.AST.BaseStatement.apply(this)},Eden.AST.Break.prototype.generate=function(a,b){return"break; "},Eden.AST.Break.prototype.execute=function(a,b,c,d){var e=new Eden.RuntimeError(b,Eden.RuntimeError.NOTSUPPORTED,this,"Break not supported here");e.line=this.line,this.errors.push(e),Eden.Agent.emit("error",[d,e])},Eden.AST.registerStatement(Eden.AST.Break),Eden.AST.Case=function(){this.type="case",Eden.AST.BaseStatement.apply(this),this.datatype="",this.literal=void 0},Eden.AST.Case.prototype.setLiteral=function(a,b){this.datatype=a,this.literal=b},Eden.AST.Case.prototype.generate=function(a,b){return"string"==typeof this.literal?'case "'+this.literal+'": ':"case "+this.literal+": "},Eden.AST.Case.prototype.execute=function(a,b,c,d){var e=new Eden.RuntimeError(b,Eden.RuntimeError.NOTSUPPORTED,this,"Case not supported here");e.line=this.line,this.errors.push(e),Eden.Agent.emit("error",[d,e])},Eden.AST.registerStatement(Eden.AST.Case),Eden.AST.CodeBlock=function(){this.type="codeblock",Eden.AST.BaseContext.apply(this),this.params=void 0,this.locals=void 0,this.script=void 0},Eden.AST.CodeBlock.prototype.setLocals=function(a){this.locals=a,this.errors.push.apply(this.errors,a.errors)},Eden.AST.CodeBlock.prototype.setParams=function(a){this.params=a,this.errors.push.apply(this.errors,a.errors)},Eden.AST.CodeBlock.prototype.setScript=function(a){this.script=a,a&&(a.parent=this,this.errors.push.apply(this.errors,a.errors))},Eden.AST.CodeBlock.prototype.generate=function(a){var b="(function(context, scope) {\n";if(this.locals&&this.locals.list)for(var c=0;c0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Definition.prototype.generateDef=function(a,b){var c="primary"==this.expression.type&&0==this.expression.extras.length||"scope"==this.expression.type,d="function(context, scope, cache) {\n";this.locals=a?a.locals:void 0,this.params=a?a.params:void 0,this.backtickCount=0;var e=this.expression.generate(this,"scope",{bound:c,indef:!0});if(this.backtickCount>0&&(d+="var btick = 0;\n"),this.scopes.length>0){d+="\tvar _scopes = [];\n";for(var f=0;f0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Delete.prototype.setIndex=function(a){this.index=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Delete.prototype.generate=function(a,b){var c=this.index.generate(a,b,{bound:!1}),d=this.destination.generate(a);return d+".mutate(scope, function(s) { scope.lookup(s.name).value.splice(rt.index("+c+"), 1); }, this);"},Eden.AST.Delete.prototype.execute=function(a,b,c){this.executed=1;var d=this.index.execute(a,b,c);d instanceof BoundValue&&(d=d.value),eden.root.lookup(this.destination.name).mutate(c,function(a){a.value().splice(d-1,1)},this)},Eden.AST.registerStatement(Eden.AST.Delete),Eden.AST.Do=function(){this.type="do",Eden.AST.BaseStatement.apply(this),this.name=void 0,this.script=void 0,this.parameters=[],this.params=[],this.scope=void 0,this.compScope=void 0,this.nscope=void 0,this.selector=void 0},Eden.AST.Do.prototype.addParameter=function(a){this.parameters.push(a),a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Do.prototype.setScript=function(a){this.script=a,this.script&&this.script.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Do.prototype.setName=function(a){a&&a.errors&&this.errors.push.apply(this.errors,a.errors),this.name=a},Eden.AST.Do.prototype.setScope=function(a){this.scope=a,a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Do.prototype.getScope=function(ctx){if(this.scope&&void 0===this.compScope)try{this.compScope=eval("(function (context, scope) { var s = "+this.scope.generateConstructor(ctx,"scope")+"; s.rebuild(); return s; })")}catch(e){}return this.compScope},Eden.AST.Do.prototype.generate=function(a){return""},Eden.AST.Do.prototype.getParameters=function(a,b,c){for(var d=[],e=0;e0){c+='
Parameters:';for(var d=0;d
'+a.slice(1).join(" ")+"
"}c+=""}return c},Eden.AST.DoxyComment.prototype.getParamString=function(){var a=this.getControls()["@param"];if(a&&a.length>0){for(var b="(",c=0;c0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.FunctionCall.prototype.generate=function(a,b){if(void 0===this.lvalue){var c="(";if(this.params)for(var d=0;d0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Index.prototype.generate=function(a,b,c){var d=this.expression.generate(a,b,{bound:!1});return"[rt.index("+d+")]"},Eden.AST.Index.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.Insert=function(){this.type="insert",Eden.AST.BaseStatement.apply(this),this.destination=void 0,this.index=void 0,this.value=void 0},Eden.AST.Insert.prototype.setDest=function(a){this.destination=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Insert.prototype.setIndex=function(a){this.index=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Insert.prototype.setValue=function(a){this.value=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Insert.prototype.generate=function(a,b){var c=this.index.generate(a,b,{bound:!1}),d=this.value.generate(a,b,{bound:!1}),e=this.destination.generate(a);return this.destination.islocal?e+".splice(rt.index("+c+"), 0, ("+d+"));":e+".mutate(scope, function(s) { scope.lookup(s.name).value.splice(rt.index("+c+"), 0, ("+d+")); }, this);"},Eden.AST.Insert.prototype.execute=function(a,b,c){this.executed=1;var d=this.index.execute(a,b,c),e=this.value.execute(a,b,c);d instanceof BoundValue&&(d=d.value),e instanceof BoundValue&&(e=e.value),eden.root.lookup(this.destination.name).mutate(c,function(a){a.value().splice(d-1,0,e)},this)},Eden.AST.registerStatement(Eden.AST.Insert),Eden.AST.Length=function(){this.type="length",this.errors=[],this.l=void 0},Eden.AST.Length.prototype.left=Eden.AST.fnEdenASTleft,Eden.AST.Length.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.Length.prototype.generate=function(a,b,c){var d=this.l.generate(a,b,{bound:!1,usevar:c.usevar});return c.bound?"new BoundValue(rt.length("+d+"), "+b+")":"rt.length("+d+")"},Eden.AST.Length.prototype.execute=function(a,b,c,d){return rt.length(this.l.execute(a,b,c,d))},Eden.AST.Literal=function(a,b){this.type="literal",Eden.AST.BaseStatement.apply(this),this.datatype=a,this.value=b},Eden.AST.Literal.prototype.generate=function(a,b,c){var d;switch(this.datatype){case"NUMBER":d=this.value;break;case"LIST":d="[";for(var e=0;e0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.LValue.prototype.setExpression=function(a){this.express=a,a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.LValue.prototype.getSymbol=function(a,b,c){if(a&&a.locals&&"declarations"!=a.locals.type&&a.locals.hasOwnProperty(this.name))return this.islocal=!0,a.locals[this.name];if(this.name)return eden.root.lookup(this.name);if(this.primary){var d=this.primary.execute(a,b,c);return d instanceof BoundValue&&(d=d.value),d}if(this.express){var e=this.express.execute(a,b,c);return e instanceof BoundValue&&(e=e.value),eden.root.lookup(e)}},Eden.AST.LValue.prototype.hasListIndices=function(){return this.lvaluep&&this.lvaluep.length>0&&"index"==this.lvaluep[0].kind},Eden.AST.LValue.prototype.generateCompList=function(a,b){for(var c="[",d=0;d0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Modify.prototype.generate=function(a,b){var c=this.lvalue.generate(a,b),d=c;0==this.lvalue.islocal?d=b+".assign("+c+","+b+".value("+c+")":d+=" = "+c;var e;return this.expression&&(e=this.expression.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type})),"+="==this.kind?d+=" + "+e:"-="==this.kind?d+=" - "+e:"/="==this.kind?d+=" / "+e:"*="==this.kind?d+=" * "+e:"++"==this.kind?d+="+1":"--"==this.kind&&(d+="-1"),d+=0==this.lvalue.islocal?", Symbol.localJSAgent);\n":";\n"},Eden.AST.Modify.prototype.execute=function(ctx,base,scope,agent){var _scopes=[];this.executed=1;var sym=this.lvalue.getSymbol(ctx,base);if("++"==this.kind){var newval=sym.value(scope)+1;sym.assign(newval,scope,this)}else if("--"==this.kind){var newval=sym.value(scope)-1;sym.assign(newval,scope,this)}else{var rhs="(function(context,scope) { return ";rhs+=this.expression.generate(ctx,"scope",{bound:!1}),rhs+=";})";for(var context=eden.root,i=0;i0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Primary.prototype.generate=function(a,b,c){var d;if(a&&a.locals)if("declarations"==a.locals.type){if(a.locals.list.indexOf(this.observable)!=-1){d=this.observable;for(var e=0;e0&&(c+=".observe("+JSON.stringify(this.triggers)+");\n"),c},Eden.AST.Action.prototype.execute=function(ctx,base,scope,agent){this.executed=1,this.doxyComment&&eden.updateDictionary(this.name,this.doxyComment);var body=this.body.generate(ctx),sym=eden.root.lookup(this.name);this.triggers.length>0?sym.define(eval(body),this,[]).observe(this.triggers):sym.define(eval(body),this,[])},Eden.AST.registerStatement(Eden.AST.Action),Eden.AST.Range=function(a){this.type="range",this.parent=void 0,this.errors=a?a.errors:[],this.expression=a,this.lvalue=void 0,this.start=0,this.end=0},Eden.AST.Range.prototype.setSource=function(a,b){this.start=a,this.end=b},Eden.AST.Range.prototype.setSecond=function(a){this.second=a,a&&a.errors&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Range.prototype.left=function(a){this.lvalue=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Range.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.Require=function(){this.type="require",Eden.AST.BaseStatement.apply(this),this.expression=void 0},Eden.AST.Require.prototype.setExpression=function(a){this.expression=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Require.prototype.generate=function(a){return"edenUI.loadPlugin("+this.expression.generate(a,"scope",{bound:!1})+");"},Eden.AST.Require.prototype.execute=function(a,b,c){this.executed=1,edenUI.loadPlugin(this.expression.execute(a,b,c))},Eden.AST.registerStatement(Eden.AST.Require),Eden.AST.Return=function(){this.type="return",Eden.AST.BaseStatement.apply(this),this.result=void 0},Eden.AST.Return.prototype.setResult=function(a){this.result=a,this.errors.push.apply(this.errors,a.errors)},Eden.AST.Return.prototype.generate=function(a,b){if(this.result){var c=this.result.generate(a,b,{bound:!1,usevar:"scriptexpr"==a.type});return"return "+c+";\n"}return"return;\n"},Eden.AST.Return.prototype.execute=function(a,b,c,d){var e=new Eden.RuntimeError(b,Eden.RuntimeError.NOTSUPPORTED,this,"Return not supported here");e.line=this.line,this.errors.push(e),Eden.Agent.emit("error",[d,e])},Eden.AST.registerStatement(Eden.AST.Return),Eden.AST.Scope=function(){this.type="scope",this.errors=[],this.range=!1,this.overrides={},this.expression=void 0},Eden.AST.Scope.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.Scope.prototype.prepend=function(a){this.primary.prepend(a)},Eden.AST.Scope.prototype.setExpression=function(a){this.expression=a,a&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Scope.prototype.addOverride=function(a,b,c,d,e){this.errors.push.apply(this.errors,a.errors),e&&(this.range=!0),d?(this.range=!0,this.overrides[a.observable]={start:b,end:d,increment:c,components:a.components,isin:e},this.errors.push.apply(this.errors,b.errors),this.errors.push.apply(this.errors,c.errors),this.errors.push.apply(this.errors,d.errors)):c?(this.range=!0,this.overrides[a.observable]={start:b,end:c,components:a.components,isin:e},this.errors.push.apply(this.errors,b.errors),this.errors.push.apply(this.errors,c.errors)):b&&(this.overrides[a.observable]={start:b,end:void 0,components:a.components,isin:e},this.errors.push.apply(this.errors,b.errors))},Eden.AST.Scope.prototype.generateConstructor=function(a,b){var c;c="new Scope(context, "+b+", [";for(var d in this.overrides){var e,f=this.overrides[d];if(e=this.range?f.start.generate(a,b,{bound:!1}):f.start.generate(a,b,{bound:!1}),c+='new ScopeOverride("'+d+'", '+e,f.end){var g=this.overrides[d].end.generate(a,b,{bound:!1});if(f.increment){var h=f.increment.generate(a,b,{ bound:!1});c+=", "+g+", "+h+"),"}else c+=", "+g+"),"}else c+=", undefined, undefined, "+f.isin+"),"}return c=c.slice(0,-1),c+="], "+this.range+", this,true)"},Eden.AST.Scope.prototype._generate_plain_range=function(a,b){var c="_scopes["+(a.scopes.length-1)+"]",d=this.expression.generate(a,"_scopes["+(a.scopes.length-1)+"].clone()",b),e="(function() {\n";return e+=c+".range = false;\n",e+="var results = [];\n",e+="var scoperesults = [];\n",e+="while(true) {\n",e+="var val = "+d,b.bound&&(e+=";\n\tif (val.value !== undefined) scoperesults.push(val.scope);\n\tval = val.value"),e+=";\n",e+="if (val !== undefined) results.push(val);\n",e+="if ("+c+".next() == false) break;\n",e+="}\n"+c+".range = true;\n",e+=b.bound?"if (cache) cache.scopes = scoperesults;\n return new BoundValue(results,"+c+");}).call(this)":"return results;}).call(this)"},Eden.AST.Scope.prototype._generate_loop_opti=function(a,b,c){console.log("LOOP RANGE INDEX",c);var d="_scopes["+(a.scopes.length-1)+"]",e=this.expression.generate(a,"_scopes["+(a.scopes.length-1)+"]",{bound:!1}),f="(function() {\n";return f+=d+".range = false;\n",f+="var looper = "+d+".overrides["+c[0]+"];\n",f+="var ix = 0;\n",f+="var results = new Array(looper.end - looper.start + 1);\n",f+="for (var i=looper.start; i<=looper.end; i++) {\n",f+="\t"+d+".resetCache();\n",f+="\tlooper.current = i;\n",f+="\t"+d+".refresh();\n",f+="\tvar val = "+e,f+=";\n",f+="\tif (val !== undefined) results[ix++] = val;\n",f+="}\n"+d+".range = true;\n",f+="results.length = ix;\n",f+=b.bound?"return new BoundValue(results,"+d+");}).call(this)":"return results;}).call(this)"},Eden.AST.Scope.prototype.generate=function(a,b,c){if(a.scopes.push(this.generateConstructor(a,b)),this.range){var d=!1,e=[],f=0;for(var g in this.overrides){if(!this.overrides[g].end){this.overrides[g].isin&&(d=!0);break}e.push(f),f++}return d||1!=e.length?this._generate_plain_range(a,c):this._generate_loop_opti(a,c,e)}return this.expression.generate(a,"_scopes["+(a.scopes.length-1)+"]",c)},Eden.AST.Scope.prototype.execute=function(ctx,base,scope){var context={scopes:[]},gen=this.generate(context,"scope",{bound:!1}),rhs="(function(context,scope) {\n";if(context.scopes.length>0){rhs+="\tvar _scopes = [];\n";for(var i=0;i0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.ScopePath.prototype.generate=function(a,b,c){var d=this.path.generate(a,b,{bound:!0,scopeonly:!0});return this.primary.generate(a,d,c)},Eden.AST.ScopePath.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.ScopePattern=function(){this.type="scopepattern",this.observable="NONAME",this.components=[],this.errors=[]},Eden.AST.ScopePattern.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.ScopePattern.prototype.setObservable=function(a){this.observable=a},Eden.AST.ScopePattern.prototype.addListIndex=function(a){this.components.push(a),a&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Script=function(){this.type="script",Eden.AST.BaseScript.apply(this),this.name=void 0,this.active=!1,this.base=void 0,this.prefix="",this.postfix=""},Eden.AST.registerScript(Eden.AST.Script),Eden.AST.Script.prototype.getActionByName=function(a){for(var b,c=0;c0?(a.replaceChild(d,c[e.id][0]),c[e.id].shift(),0==c[e.id].length&&delete c[e.id]):"dummy"!=e.type&&this.indexed&&e.addIndex()}for(var f in c)for(var g=c[f],d=0;d0){void 0===a.locals&&(a.locals={});for(var f=0;f0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.ScriptExpr.prototype.generate=function(a,b){for(var c="(function(escope) {\nescope.isolate = true;\nif (cache) cache.scope = escope;\nvar context = new Eden.AST.Context(context);\nescope.context = context;\n",d=0;d0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Subscribers.prototype.execute=function(a,b,c){},Eden.AST.Subscribers.prototype.setList=function(a){this.list=a},Eden.AST.registerStatement(Eden.AST.Subscribers),Eden.AST.Switch=function(){this.type="switch",Eden.AST.BaseStatement.apply(this),this.expression="",this.statement=void 0,this.compiled=void 0},Eden.AST.Switch.prototype.setExpression=function(a){this.expression=a,a&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Switch.prototype.setStatement=function(a){this.statement=a,this.errors.push.apply(this.errors,a.errors)},Eden.AST.Switch.prototype.generate=function(a,b){void 0===b&&(b="eden.root.scope");var c="switch(";return c+=this.expression.generate(a,b,{bound:!1}),c+=") "+this.statement.generate(a,b)},Eden.AST.Switch.prototype.getSelector=function(ctx){if(this.compiled)return this.compiled;var cond="(function(context,scope) { return ";return cond+=this.expression.generate(ctx,"scope",{bound:!1}),cond+=";})",this.compiled=eval(cond),this.compiled},Eden.AST.Switch.prototype.execute=function(a,b,c,d){var e=new Eden.RuntimeError(b,Eden.RuntimeError.NOTSUPPORTED,this,"Switch not supported here");e.line=this.line,this.errors.push(e),Eden.Agent.emit("error",[d,e])},Eden.AST.registerStatement(Eden.AST.Switch),Eden.AST.TernaryOp=function(a){this.type="ternaryop",this.op=a,this.errors=[],this.first=void 0,this.second=void 0,this.condition=void 0,this.warning=void 0},Eden.AST.TernaryOp.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.TernaryOp.prototype.setFirst=function(a){this.first=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors),a&&a.warning&&(this.warning=a.warning)},Eden.AST.TernaryOp.prototype.setSecond=function(a){this.second=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors),a&&a.warning&&(this.warning=a.warning)},Eden.AST.TernaryOp.prototype.setCondition=function(a){this.condition=a,a.errors.length>0&&this.errors.push.apply(this.errors,a.errors),a&&a.warning&&(this.warning=a.warning)},Eden.AST.TernaryOp.prototype.left=function(a){void 0===this.condition?this.condition=a:this.first=a,a&&a.warning&&(this.warning=a.warning)},Eden.AST.TernaryOp.prototype.generate=function(a,b,c){var d=this.condition.generate(a,b,{bound:!1,usevar:c.usevar}),e=this.first.generate(a,b,c),f=this.second.generate(a,b,c);return"(("+d+")?("+e+"):("+f+"))"},Eden.AST.TernaryOp.prototype.execute=function(ctx,base,scope){var rhs="(function(context,scope) { return ";return rhs+=this.generate(ctx,"scope",{bound:!1}),rhs+=";})",eval(rhs)(eden.root,scope)},Eden.AST.UnaryOp=function(a,b){this.type="unaryop",this.op=a,this.errors=b.errors,this.r=b},Eden.AST.UnaryOp.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.UnaryOp.prototype.generate=function(a,b,c){var d,e=this.r.generate(a,b,{bound:!1,usevar:c.usevar});return"!"==this.op?d="!("+e+")":"&"==this.op?(d="context.lookup("+e+")",console.log(d)):"-"==this.op?d="-("+e+")":"*"==this.op&&(d=e+".value("+b+")"),c.bound?"new BoundValue("+d+","+b+")":d},Eden.AST.UnaryOp.prototype.execute=function(ctx,base,scope){var rhs="(function(context,scope) { return ";return rhs+=this.generate(ctx,"scope",{bound:!1}),rhs+=";})",eval(rhs)(eden.root,scope)},Eden.AST.Wait=function(){this.type="wait",Eden.AST.BaseStatement.apply(this),this.delay=void 0,this.compiled_delay=void 0},Eden.AST.Wait.prototype.setDelay=function(a){this.delay=a,a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Wait.prototype.compile=function(ctx){if(void 0!==this.delay&&!this.compiled_delay){var source="(function(context,scope) { return ";source+=this.delay.generate(ctx,"scope",{bound:!1}),source+=";})",this.compiled_delay=eval(source)}},Eden.AST.Wait.prototype.generate=function(a,b){return"yield "+this.delay+";"},Eden.AST.registerStatement(Eden.AST.Wait),Eden.AST.When=function(){this.type="when",Eden.AST.BaseContext.apply(this),this.name="*When",this.id=0,this.expression=void 0,this.active=!1,this.compiled=void 0,this.scope=void 0,this.compScope=void 0,this.local=!1,this.dirty=!1,this.statement=void 0,this.enabled=!1,this.statements=[],this.retrigger=!1},Eden.AST.registerContext(Eden.AST.When),Eden.AST.When.prototype.getSource=function(){return this.statement?this.prefix+this.statement.getSource()+this.postfix:this.prefix+this.postfix},Eden.AST.When.prototype.setSource=function(a,b,c){if(this.start=a,this.end=b,c){this.statement?(this.prefix=c.substring(0,this.statement.start-a),this.postfix=c.substring(this.statement.end-a)):(this.prefix=c.substring(0,b),this.postfix=""),this.numlines=0;for(var d=0;d0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Query.prototype.setResultTypes=function(a){this.restypes=a},Eden.AST.Query.prototype.setModify=function(a,b){this.modexpr=a,this.kind=b,a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Query.prototype.generate=function(a,b,c){var d="Eden.Selectors.query("+this.selector.generate(a,b,{bound:!1})+', "'+this.restypes.join(",")+'")';return console.log("QUERY",d),c.bound?"new BoundValue("+d+","+b+")":d},Eden.AST.Query.prototype.execute=function(a,b,c,d){if(this.executed=1,void 0===this.modexpr){var e=Eden.Selectors.query(this.selector.execute(a,b,c,d),this.restypes);b.lastresult=e}else{var f=this.selector.execute(a,b,c,d),g=this.modexpr.execute(a,b,c,d);switch(this.kind){case"=":Eden.Selectors.assign(f,this.restypes,g);break;case"+=":Eden.Selectors.append(f,this.restypes,g);break;case"//=":Eden.Selectors.concat(f,this.restypes,g)}}},Eden.AST.registerStatement(Eden.AST.Query),Eden.AST.Alias=function(){this.type="script",Eden.AST.BaseStatement.apply(this),this.name=void 0,this.active=!1,this.selector=void 0},Eden.AST.Alias.prototype.setName=function(a){this.name=a},Eden.AST.Alias.prototype.setSelector=function(a){this.selector=a,a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Alias.prototype.execute=function(a,b,c,d){return Eden.Selectors.query(this.selector.execute(a,b,c,d))},Eden.AST.Alias.prototype.generate=function(a,b,c){},Eden.AST.registerStatement(Eden.AST.Alias),Object.defineProperty(Eden.AST.Alias.prototype,"statements",{get:function(){if(this.selector){var a=this.selector.execute(this,eden.project.ast,eden.root.scope,this);return Eden.Selectors.query(a)}return[]}}),Eden.AST.Alias.addIndex=function(){this.buildID(),Eden.Index.update(this)},Eden.AST.Alias.removeIndex=function(){Eden.Index.remove(this)},Eden.AST.Alias.destroy=function(){this.executed<1&&Eden.Index.remove(this),this.parent=void 0,this.executed=-1},Eden.AST.Indexed=function(){this.type="indexed",this.indexes=[],this.expression=void 0,this.errors=[]},Eden.AST.Indexed.prototype.left=Eden.AST.fnEdenASTleft,Eden.AST.Indexed.prototype.error=Eden.AST.fnEdenASTerror,Eden.AST.Indexed.prototype.setExpression=function(a){this.expression=a,a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Indexed.prototype.addIndex=function(a){this.indexes.push(a),a&&a.errors.length>0&&this.errors.push.apply(this.errors,a.errors)},Eden.AST.Indexed.prototype.generate=function(a,b,c){for(var d="",e=0;ethis.depth);)"dummy"!=f.type&&"script"!=f.type&&"section"!=f.type&&e.push(f),f=f.nextSibling;return e},Eden.AST.registerStatement(Eden.AST.Section),Eden.AST.Section.prototype.getRange=function(a){for(var b=this.getStartLine(a),c=this.nextSibling;c&&c.nextSibling&&("section"!=c.nextSibling.type||c.nextSibling.depth>this.depth);)c=c.nextSibling;c&&"dummy"==c.type&&(c=c.previousSibling);var d=c?c.getEndLine(a):b+this.getNumberOfLines();return[b,d]},Eden.AST.prototype.pACTIONBODY=function(){var a=new Eden.AST.CodeBlock,b=this.parent;return this.parent=a,"{"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONOPEN)),this.parent=b,a):(this.next(),a.setLocals(this.pLOCALS()),a.locals.errors.length>0?(this.parent=b,a):(a.setScript(this.pSCRIPT()),"}"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONCLOSE)),this.parent=b,a):(this.next(),this.parent=b,a)))},Eden.AST.prototype.pAFTER=function(){var a=new Eden.AST.After;if("("!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.AFTEROPEN)),a;this.next();var b=this.pEXPRESSION();if(a.setExpression(b),a.errors.length>0)return a;if(")"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.AFTEROPEN)),a;this.next();var c=this.pSTATEMENT();return void 0===c&&a.error(new Eden.SyntaxError(this,Eden.SyntaxError.AFTERNOSTATEMENT)),a.setStatement(c),a.warning=new Eden.SyntaxWarning(this,a,Eden.SyntaxWarning.DEPRECATED,"'after' should not be used, use 'wait' instead"),a},Eden.AST.prototype.pPARAMS=function(){var a=new Eden.AST.Declarations;for(a.kind="oracle";"para"==this.token||"oracle"==this.token;){this.next();var b=this.pOLIST();if(a.list.push.apply(a.list,b),0==b.length||"NONAME"==b[b.length-1])return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.PARAMNAME)),a;if(";"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.PARAMSEMICOLON)),a;this.next()}return a},Eden.AST.prototype.pLOCALS=function(){for(var a=new Eden.AST.Declarations;"auto"==this.token||"local"==this.token;){this.next();var b=this.pOLIST();if(a.list.push.apply(a.list,b),0==b.length||"NONAME"==b[b.length-1])return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LOCALNAME)),a;if(";"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LOCALSEMICOLON)),a;this.next()}return a},Eden.AST.prototype.pDO=function(){var a=new Eden.AST.Do,b=this.parent;if(this.parent=a,"{"==this.token){this.next();var c=this.pSCRIPT();return c.parent=a,"}"!=this.token?(a.setScript(c),a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONCLOSE)),this.parent=b,a):(this.next(),a.setScript(c),this.parent=b,"with"!=this.token&&"::"!=this.token||(this.next(),a.setScope(this.pSCOPE())),a)}if("OBSERVABLE"!=this.token&&"."!=this.token&&">>"!=this.token&&">"!=this.token&&"<"!=this.token&&"<<"!=this.token&&":"!=this.token&&"*"!=this.token&&"@"!=this.token&&"#"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.DONAME)),this.parent=b,a;var d=this.pCODESELECTOR();if(a.setName(d),a.errors.length>0)return this.parent=b,a;if("with"==this.token||"::"==this.token)this.next(),a.setScope(this.pSCOPE());else if(";"!=this.token)for(var e=this.pELIST(),f=0;f0)return this.parent=b,a;return";"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),this.parent=b,a):(this.next(),this.parent=b,a)},Eden.AST.prototype.pEXPRESSION_PPPPP=function(){if("#"==this.token)return this.next(),new Eden.AST.Length},Eden.AST.prototype.pEXPRESSION_PPPPPP=function(){if("?"==this.token){this.next();var a=new Eden.AST.TernaryOp("?");return a.setFirst(this.pEXPRESSION()),a.warning=new Eden.SyntaxWarning(this,a,Eden.SyntaxWarning.DEPRECATED,"use of ? for 'if'."),a.errors.length>0?a:":"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.TERNIFCOLON)),a):(this.next(),a.setSecond(this.pEXPRESSION()),a)}if("if"==this.token){this.next();var a=new Eden.AST.TernaryOp("?");return a.setCondition(this.pEXPRESSION()),a.errors.length>0?a:"else"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.TERNIFCOLON)),a):(this.next(),a.setSecond(this.pEXPRESSION()),a)}},Eden.AST.prototype.pEXPRESSION_PLAIN=function(){for(var a=this.pTERM();"&&"==this.token||"||"==this.token||"&"==this.token||"|"==this.token||"and"==this.token||"or"==this.token;){var b=new Eden.AST.BinaryOp(this.token);this.next(),b.left(a),b.setRight(this.pTERM()),a=b}return a},Eden.AST.prototype.pEXPRESSION=function(){var a;if("{"==this.token){if(this.next(),a=this.pSCRIPTEXPR(),"}"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONCLOSE)),a;this.next()}else a=this.pEXPRESSION_PLAIN();if("with"==this.token||"::"==this.token){this.next();var b=this.pSCOPE();return b.setExpression(a),b}return a},Eden.AST.prototype.pFACTOR=function(){if("("==this.token){this.next();var a=this.pEXPRESSION();if(a.errors.length>0)return a;if(")"!=this.token?a.error(new Eden.SyntaxError(this,Eden.SyntaxError.EXPCLOSEBRACKET)):this.next(),"["==this.token){var b=this.pINDEXED();return b.setExpression(a),b}return a}if("["==this.token){this.next();var c=[];"]"!=this.token&&(c=this.pELIST());for(var d=new Eden.AST.Literal("LIST",c),e=0;e0&&d.errors.push.apply(d.errors,c[e].errors);return d.errors.length>0?d:("]"!=this.token?d.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTLITCLOSE)):this.next(),d)}if("@"==this.token)return this.next(),new Eden.AST.Literal("UNDEFINED","@");if("JAVASCRIPT"==this.token){var f=new Eden.AST.Literal("JAVASCRIPT",this.data.value);return this.next(),f}if("NUMBER"==this.token){var f=new Eden.AST.Literal("NUMBER",this.data.value);return this.next(),f}if("?"==this.token){this.next();var g=this.pQUERY();if("["==this.token){var b=this.pINDEXED();return b.setExpression(g),b}return g}if("-"==this.token){this.next();var h=new Eden.AST.UnaryOp("-",this.pFACTOR());return h}if("<<"==this.token){if(this.next(),"OBSERVABLE"!=this.token){var f=new Eden.AST.Literal("STRING",this.data.value);return f.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.HEREDOCTOKEN)),f}var i=this.data.value;if(10!=this.stream.get()){var f=new Eden.AST.Literal("STRING",this.data.value);return f.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.HEREDOCTOKEN)),f}for(var j="";this.stream.valid();){var k=this.stream.position,l=this.stream.readLine();if(l.startsWith(i)){this.stream.position=k+3;break}j+=l}this.stream.valid()||this.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.NEWLINE)),this.next();var f=new Eden.AST.Literal("STRING",j.slice(0,-1).replace(/\\/g,"\\\\").replace(/"/g,'\\"'));return f}if("STRING"==this.token){var f=new Eden.AST.Literal("STRING",this.data.value);for(this.data.error||this.next();0==this.data.error&&"STRING"==this.token;)f.value+="\n"+this.data.value,this.next();return this.data.error&&("LINEBREAK"==this.data.value?f.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LITSTRLINE)):f.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LITSTRCLOSE))),f}if("BOOLEAN"==this.token){var f=new Eden.AST.Literal("BOOLEAN",this.data.value);return this.next(),f}if("CHARACTER"==this.token){var f=new Eden.AST.Literal("CHARACTER",this.data.value);return this.data.error?(""==this.data.value?f.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LITCHAREMPTY)):f.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LITCHARCLOSE)),f):(this.next(),f)}if("!"==this.token||"not"==this.token){this.next();var m=this.pFACTOR();return new Eden.AST.UnaryOp("!",m)}if("&"==this.token){this.next();var n=this.pLVALUE();return new Eden.AST.UnaryOp("&",n)}if("*"==this.token){this.next();var n=this.pFACTOR();return new Eden.AST.UnaryOp("*",n)}var o=this.pPRIMARY();return o},Eden.AST.prototype.pFOR=function(){var a=new Eden.AST.For,b=this.parent;if(this.parent=a,"("!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.FOROPEN)),this.parent=b,a;if(this.next(),";"==this.token)this.next();else{if(a.setStart(this.pSTATEMENT_P(!0)),a.errors.length>0)return this.parent=b,a;if("range"!=a.sstart.type&&";"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.FORSTART)),this.parent=b,a;";"==this.token&&this.next()}if("range"!=a.sstart.type){if(";"==this.token)this.next();else{if(a.setCondition(this.pEXPRESSION()),a.errors.length>0)return this.parent=b,a;if(";"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.FORCOND)),this.parent=b,a;this.next()}if(")"==this.token)this.next();else{if(a.setIncrement(this.pSTATEMENT_P()),a.errors.length>0)return this.parent=b,a;if(")"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.FORCLOSE)),this.parent=b,a;this.next()}}else{if(")"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.FORCLOSE)),this.parent=b,a;this.next()}return a.setStatement(this.pSTATEMENT()),a.statement&&(a.statement.parent=a),a.parent=b,this.parent=b,a},Eden.AST.prototype.pFUNCTION=function(){var a=new Eden.AST.Function,b=this.parent;return this.parent=a,"OBSERVABLE"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.FUNCNAME)),this.parent=b,a):(a.name=this.data.value,this.next(),a.setBody(this.pFUNCBODY()),this.parent=b,a)},Eden.AST.prototype.pFUNCBODY=function(){var a=new Eden.AST.CodeBlock,b=this.parent;return this.parent=a,"{"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.FUNCOPEN)),this.parent=b,a):(this.next(),a.setParams(this.pPARAMS()),a.params.errors.length>0?(this.parent=b,a):(a.setLocals(this.pLOCALS()),a.locals.errors.length>0?(this.parent=b,a):(a.setScript(this.pSCRIPT()),"}"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.FUNCCLOSE)),this.parent=b,a):(this.next(),this.parent=b,a))))},Eden.AST.prototype.pIF=function(){var a=new Eden.AST.If;a.parent=this.parent;var b=this.parent;return this.parent=a,"("!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.IFCONDOPEN)),this.parent=b,a):(this.next(),a.setCondition(this.pEXPRESSION()),a.errors.length>0?(this.parent=b,a):")"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.IFCONDCLOSE)),this.parent=b,a):(this.next(),a.setStatement(this.pSTATEMENT()),a.errors.length>0?(this.parent=b,a):void 0===a.statement?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.IFNOSTATEMENT)),this.parent=b,a):(a.setElse(this.pIF_P()),this.parent=b,a)))},Eden.AST.prototype.pIF_P=function(){if("else"==this.token)return this.next(),this.pSTATEMENT()},Eden.AST.prototype.pREQUIRE=function(){var a=new Eden.AST.Require,b=this.pEXPRESSION();return a.setExpression(b),a.warning=new Eden.SyntaxWarning(this,a,Eden.SyntaxWarning.DEPRECATED,"require."),";"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a):(this.next(),a)},Eden.AST.prototype.pIMPORT=function(){var a=new Eden.AST.Import,b=this.pCODESELECTOR();return void 0===b||b.errors.length>0?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.IMPORTPATH)),a):(a.setPath(b),";"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a):(this.next(),a))},Eden.AST.prototype.pINSERT=function(){var a=new Eden.AST.Insert;return a.setDest(this.pLVALUE()),a.errors.length>0?a:","!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.INSERTCOMMA)),a):(this.next(),a.setIndex(this.pEXPRESSION()),a.errors.length>0?a:","!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.INSERTCOMMA)),a):(this.next(),a.setValue(this.pEXPRESSION()),a.errors.length>0?a:";"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a):(this.next(),a)))},Eden.AST.prototype.pDELETE=function(){var a=new Eden.AST.Delete;return a.setDest(this.pLVALUE()),a.errors.length>0?a:","!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.DELETECOMMA)), a):(this.next(),a.setIndex(this.pEXPRESSION()),a.errors.length>0?a:";"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a):(this.next(),a))},Eden.AST.prototype.pAPPEND=function(){var a=new Eden.AST.Append;return a.setDest(this.pLVALUE()),a.errors.length>0?a:","!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.APPENDCOMMA)),a):(this.next(),a.setIndex(this.pEXPRESSION()),a.errors.length>0?a:";"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a):(this.next(),a))},Eden.AST.prototype.pSHIFT=function(){var a=new Eden.AST.Shift;return a.setDest(this.pLVALUE()),a.errors.length>0?a:";"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a):(this.next(),a)},Eden.AST.prototype.pELIST=function(){var a=this.pEXPRESSION();if(a.errors.length>0)return[a];var b=this.pELIST_P();return b.unshift(a),b},Eden.AST.prototype.pELIST_P=function(){for(var a=[];","==this.token;){this.next();var b=this.pEXPRESSION();if(a.push(b),b.errors.length>0)return a}return a},Eden.AST.prototype.pOLIST=function(){if("OBSERVABLE"!=this.token)return[];var a=this.data.value;this.next();var b=this.pOLIST_P();return b.unshift(a),b},Eden.AST.prototype.pOLIST_P=function(){for(var a=[];","==this.token;){if(this.next(),"OBSERVABLE"!=this.token)return a.push("NONAME"),a;a.push(this.data.value),this.next()}return a},Eden.AST.prototype.pLVALUE_P=function(){for(var a=[];;){if("["!=this.token)break;this.next();var b=new Eden.AST.LValueComponent("index"),c=this.pEXPRESSION();if(b.index(c),a.push(b),c.errors.length>0&&b.errors.unshift(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXEXP)),"literal"==b.indexexp.type&&"NUMBER"==b.indexexp.datatype&&b.indexexp.value<1&&b.error(new Eden.SyntaxError(this,Eden.SyntaxError.OUTOFBOUNDS)),"]"!=this.token)return b.error(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXCLOSE)),a;this.next()}return a},Eden.AST.prototype.pLVALUE=function(){var a=new Eden.AST.LValue;if("*"==this.token)this.next(),a.setPrimary(this.pPRIMARY());else if("`"==this.token){if(this.next(),a.setExpression(this.pEXPRESSION()),a.errors.length>0)return a;if("`"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.BACKTICK)),a;this.next()}else{if("OBSERVABLE"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.LVALUE)),a;var b=this.data.value;if(this.next(),"{"==this.token){for(var c=new Eden.AST.Literal("STRING",b);"{"==this.token;){this.next();var d=this.pEXPRESSION();if(d.errors.length>0)return a.setExpression(d),a;if("}"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.BACKTICK)),a;this.next();var e=new Eden.AST.BinaryOp("//");if(e.left(c),e.setRight(d),c=e,"OBSERVABLE"==this.token){var e=new Eden.AST.BinaryOp("//");e.left(c),e.setRight(new Eden.AST.Literal("STRING",this.data.value)),c=e,this.next()}}a.setExpression(c)}else a.setObservable(b)}return a.setExtras(this.pLVALUE_P()),a},Eden.AST.prototype.pPRIMARY=function(){if("`"==this.token){this.next();var a=this.pEXPRESSION();if(a.errors.length>0){var b=new Eden.AST.Primary;return b.setBackticks(a),b}if("`"!=this.token){var b=new Eden.AST.Primary;return b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.BACKTICK)),b}this.next();var b=this.pPRIMARY_P();return b.errors.length>0?b:(b.setBackticks(a),b.setObservable("__BACKTICKS__"),b)}if("OBSERVABLE"==this.token){var b,c=this.data.value;if(this.next(),"{"==this.token){for(var d=new Eden.AST.Literal("STRING",c);"{"==this.token;){this.next();var a=this.pEXPRESSION();if(a.errors.length>0){var b=new Eden.AST.Primary;return b.setBackticks(a),b}if("}"!=this.token){var b=new Eden.AST.Primary;return b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.BACKTICK)),b}this.next();var e=new Eden.AST.BinaryOp("//");if(e.left(d),e.setRight(a),d=e,"OBSERVABLE"==this.token){var e=new Eden.AST.BinaryOp("//");e.left(d),e.setRight(new Eden.AST.Literal("STRING",this.data.value)),d=e,this.next()}}b=this.pPRIMARY_P(),b.setBackticks(d),b.setObservable("__BACKTICKS__")}else b=this.pPRIMARY_P(),b.setObservable(c);return b}var b=new Eden.AST.Primary;return b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.BADFACTOR)),b},Eden.AST.prototype.pPRIMARY_P=function(){if("["==this.token){this.next();var a=new Eden.AST.Index;if("]"==this.token){var b=new Eden.AST.Primary;return b.prepend(a),b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXEXP)),b}var c=this.pEXPRESSION();if(c.errors.length>0){a.setExpression(c);var b=new Eden.AST.Primary;return b.prepend(a),b}if("literal"==c.type&&"NUMBER"==c.datatype&&c.value<1){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.OUTOFBOUNDS));var b=new Eden.AST.Primary;return b.prepend(a),b}if("]"!=this.token){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXCLOSE));var b=new Eden.AST.Primary;return b.prepend(a),b}this.next();var b=this.pPRIMARY_PPP();return a.setExpression(c),b.prepend(a),b}if("("==this.token){this.next();var d=new Eden.AST.FunctionCall;if(")"==this.token){this.next();var b=this.pPRIMARY_PP();return b.prepend(d),b}var e=this.pELIST();if(d.setParams(e),d.errors.length>0){var b=new Eden.AST.Primary;return b.prepend(d),b}if(")"!=this.token){var b=new Eden.AST.Primary;return b.prepend(d),d.errors.length>0?b:(b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.FUNCCALLEND)),b)}this.next();var b=this.pPRIMARY_PP();return b.errors.length>0?b:(b.prepend(d),b)}if("."==this.token){this.next();var f=this.pPRIMARY(),g=new Eden.AST.ScopePath;return g.setPrimary(f),g}return this.pPRIMARY_PPPP()},Eden.AST.prototype.pPRIMARY_PP=function(){if("["==this.token){this.next();var a=new Eden.AST.Index;if("]"==this.token){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXEXP));var b=new Eden.AST.Primary;return b.prepend(a),b}var c=this.pEXPRESSION();if(c.errors.length>0){var b=new Eden.AST.Primary;return a.setExpression(c),b.prepend(a),b}if("literal"==c.type&&"NUMBER"==c.datatype&&c.value<1){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.OUTOFBOUNDS));var b=new Eden.AST.Primary;return b.prepend(a),b}if("]"!=this.token){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXCLOSE));var b=new Eden.AST.Primary;return b.prepend(a),b}this.next();var b=this.pPRIMARY_PP();return a.setExpression(c),b.prepend(a),b}if("("==this.token){this.next();var d=new Eden.AST.FunctionCall;if(")"==this.token){this.next();var b=this.pPRIMARY_PP();return b.prepend(d),b}var e=this.pELIST();if(d.setParams(e),")"!=this.token){var b=new Eden.AST.Primary;return b.prepend(d),d.errors.length>0?b:(b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.FUNCCALLEND)),b)}this.next();var b=this.pPRIMARY_PP();return b.prepend(d),b}return this.pPRIMARY_PPPP()},Eden.AST.prototype.pPRIMARY_PPP=function(){if("["==this.token){this.next();var a=new Eden.AST.Index;if("]"==this.token){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXEXP));var b=new Eden.AST.Primary;return b.prepend(a),b}var c=this.pEXPRESSION();if(c.errors.length>0){var b=new Eden.AST.Primary;return a.setExpression(c),b.prepend(a),b}if("literal"==c.type&&"NUMBER"==c.datatype&&c.value<1){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.OUTOFBOUNDS));var b=new Eden.AST.Primary;return b.prepend(a),b}if("]"!=this.token){a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXCLOSE));var b=new Eden.AST.Primary;return b.prepend(a),b}this.next();var b=this.pPRIMARY_PP();return a.setExpression(c),b.prepend(a),b}if("("==this.token){this.next();var d=new Eden.AST.FunctionCall;if(")"==this.token){this.next();var b=this.pPRIMARY_PP();return b.prepend(d),b}var e=this.pELIST();if(d.setParams(e),")"!=this.token){var b=new Eden.AST.Primary;return b.prepend(d),d.errors.length>0?b:(b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.FUNCCALLEND)),b)}this.next();var b=this.pPRIMARY_PP();return b.errors.length>0?b:(b.prepend(d),b)}if("."==this.token){this.next();var f=this.pPRIMARY();if(f.errors.length>0)return f;var g=new Eden.AST.ScopePath;return g.setPrimary(f),g}return this.pPRIMARY_PPPP()},Eden.AST.prototype.pPRIMARY_PPPP=function(){return new Eden.AST.Primary},Eden.AST.prototype.pACTION=function(){var a=new Eden.AST.Action,b=this.parent;if(this.parent=a,a.warning=new Eden.SyntaxWarning(this,a,Eden.SyntaxWarning.DEPRECATED,"attempt to use 'when' instead of 'proc'"),"OBSERVABLE"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.PROCNAME)),this.parent=b,a;if(a.name=this.data.value,this.next(),":"==this.token){this.next();var c=this.pOLIST();if(0==c.length)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONNOWATCH)),this.parent=b,a;if("NONAME"==c[c.length-1])return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONCOMMAS)),this.parent=b,a;a.triggers=c}return a.setBody(this.pFUNCBODY()),this.parent=b,a},Eden.AST.prototype.pSCOPE=function(){if("("==this.token){this.next();var a=this.pSCOPE_P();return")"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SCOPECLOSE)),a):(this.next(),a)}return this.pSCOPE_P()},Eden.AST.prototype.pSCOPEPATTERN=function(){var a=new Eden.AST.ScopePattern;if("OBSERVABLE"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SCOPENAME)),a;for(a.setObservable(this.data.value),this.next();;)if("["==this.token){this.next();var b=this.pEXPRESSION();if(a.addListIndex(b),b.errors.length>0)return a;if("]"!=this.token)return a.error(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXCLOSE)),a;this.next()}else if("."!=this.token)break;return a},Eden.AST.prototype.pSCOPE_P=function(a){var b,c=!1,d=this.peekNext(1);if(void 0===a&&(a=1),"is"!=d&&"="!=d&&"in"!=d)b=new Eden.AST.ScopePattern,b.setObservable("$"+a),a++,console.log("AUTO NAME",a,d);else{if(b=this.pSCOPEPATTERN(),b.errors.length>0){var e=new Eden.AST.Scope;return e.addOverride(b,void 0,void 0,void 0,!1),e}if("is"!=this.token&&"="!=this.token&&"in"!=this.token){var e=new Eden.AST.Scope;return e.error(new Eden.SyntaxError(this,Eden.SyntaxError.SCOPEEQUALS)),e}"in"==this.token&&(c=!0),this.next()}var f=this.pEXPRESSION();if(f.errors.length>0){var e=new Eden.AST.Scope;return e.errors.push.apply(e.errors,f.errors),e}var g=void 0;if(".."==this.token&&(this.next(),g=this.pEXPRESSION(),g.errors.length>0)){var e=new Eden.AST.Scope;return e.addOverride(b,f,g,void 0,!1),e}var h=void 0;if(".."==this.token&&(this.next(),h=this.pEXPRESSION(),h.errors.length>0)){var e=new Eden.AST.Scope;return e.addOverride(b,f,g,h,!1),e}var e=this.pSCOPE_PP(a);return e.addOverride(b,f,g,h,c),e},Eden.AST.prototype.pSCOPE_PP=function(a){return","==this.token?(this.next(),this.pSCOPE_P(a)):new Eden.AST.Scope},Eden.AST.prototype.pNAMEDSCRIPT=function(){var a;if("OBSERVABLE"!=this.token){var b=new Eden.AST.Script;return b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONNAME)),b}if(a=this.data.value,this.next(),"is"==this.token){this.next();var c=new Eden.AST.Alias;return c.setSelector(this.pCODESELECTOR()),c.setName(a),";"!=this.token?(c.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),c):(this.next(),c)}if("{"!=this.token){var b=new Eden.AST.Script;return b.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONOPEN)),b}this.next();var b=this.pSCRIPT();return b.errors.length>0?b:(b.setName(this,a),"}"!=this.token?(b.error(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONCLOSE)),b):(this.next(),this.scripts[a]=b,b))},Eden.AST.prototype.pSCRIPT=function(){var a=new Eden.AST.Script;a.parent=this.parent;var b=this.parent;this.parent=a;var c=new Eden.AST.DummyStatement;for(c.setSource(this.lastposition,this.stream.prevposition,this.stream.code.substring(this.lastposition,this.stream.prevposition)),c.numlines=c.source.match(/\n/g),null===c.numlines?c.numlines=0:c.numlines=c.numlines.length,a.append(c);"EOF"!=this.token;){var d=this.pSTATEMENT();if(void 0!==d){if(d.errors.length>0){a.appendChild(d);break}var e=d.end;a.appendChild(d);var f=this.stream.code.substring(e,this.stream.prevposition);if(f.length>0){var c=new Eden.AST.DummyStatement;c.setSource(e,this.stream.prevposition,f),c.numlines=c.source.match(/\n/g),null===c.numlines?c.numlines=0:c.numlines=c.numlines.length,a.appendChild(c)}}else{if("}"!=this.token&&";"!=this.token&&a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.STATEMENT)),";"!=this.token)break;this.next()}}return this.parent=b,a},Eden.AST.prototype.pSCRIPTEXPR=function(){var a=new Eden.AST.ScriptExpr;a.parent=this.parent;for(this.parent;"EOF"!=this.token;){var b=this.pSTATEXPR();if(void 0!==b){if(a.append(b),b.errors.length>0)break}else{if("}"!=this.token&&";"!=this.token&&a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.STATEMENT)),";"!=this.token)break;this.next()}}return a},Eden.AST.prototype.pAGENTPATH=function(){if("OBSERVABLE"!=this.token&&void 0===Language.keywords[this.token])return"_ERROR_";var a=this.data.value;for(this.next();"/"==this.token;){if(this.next(),"OBSERVABLE"!=this.token&&void 0===Language.keywords[this.token])return"_ERROR_";a+="/"+this.data.value,this.next()}return a},Eden.AST.prototype.pCODESELECTOR=function(){var a=void 0;if("OBSERVABLE"==this.token||Language.keywords[this.token]&&"with"!=this.token)a=new Eden.AST.Literal("STRING",this.data.value),this.next();else if(":"==this.token||"."==this.token){var b=":"==this.token;if(this.next(),"OBSERVABLE"==this.token){if(!(!b&&Eden.Selectors.PropertyNode.attributes[this.data.value]||b&&Eden.Selectors.PropertyNode.pseudo[this.data.value]))return a=new Eden.AST.Literal("STRING",""),a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SELECTORATTRIB)),a;a=new Eden.AST.Literal("STRING",(b?":":".")+this.data.value),this.next()}else if("NUMBER"==this.token)a=new Eden.AST.Literal("STRING",(b?":":".")+this.data.value),this.next();else if("{"==this.token)a=new Eden.AST.Literal("STRING",b?":":".");else{if("("!=this.token)return a=new Eden.AST.Literal("STRING",""),a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SELECTORATTRIB)),a;var c=this.stream.position;for(this.next();this.stream.valid()&&")"!=this.token;)this.next();var d=this.stream.prevposition,e=":("+this.stream.code.substring(c,d).replace(/[\r\n]*/g,"")+")";a=new Eden.AST.Literal("STRING",e),this.next()}}else if("@"==this.token){if(this.next(),"OBSERVABLE"!=this.token)return a=new Eden.AST.Literal("STRING",""),a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SELECTOROPTION)),a;if(!Eden.Selectors.allowedOptions[this.data.value])return a=new Eden.AST.Literal("STRING",""),a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SELECTOROPTION)),a;a=new Eden.AST.Literal("STRING","@"+this.data.value+" "),this.next()}else if("#"==this.token)if(this.next(),"OBSERVABLE"==this.token)a=new Eden.AST.Literal("STRING","#"+this.data.value),this.next();else{if("{"!=this.token)return a=new Eden.AST.Literal("STRING",""),a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SELECTORTAG)),a;a=new Eden.AST.Literal("STRING","#")}else if("{"==this.token){if(this.next(),a=this.pEXPRESSION(),"}"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SELECTORBTICK)),a;this.next()}else if(">"==this.token)a=new Eden.AST.Literal("STRING"," > "),this.next();else if(">>"==this.token)a=new Eden.AST.Literal("STRING"," >> "),this.next();else if("<"==this.token)a=new Eden.AST.Literal("STRING"," < "),this.next();else if(","==this.token)a=new Eden.AST.Literal("STRING",","),this.next();else if("<<"==this.token)a=new Eden.AST.Literal("STRING"," << "),this.next();else if("("==this.token){var c=this.stream.position;for(this.next();this.stream.valid()&&")"!=this.token;)this.next();var d=this.stream.prevposition,e="("+this.stream.code.substring(c,d).replace(/[\r\n]*/g,"")+")";a=new Eden.AST.Literal("STRING",e),this.next()}else{if(")"==this.token)return;"*"==this.token&&(a=new Eden.AST.Literal("STRING","*"),this.next())}if(a){var f=this.pCODESELECTOR();if(void 0===f)return a;if(f.errors.length>0)return f;if("literal"==a.type&&"literal"==f.type)a.value+=f.value;else{var g=new Eden.AST.BinaryOp("//");g.left(a),g.setRight(f),a=g}}return a},Eden.AST.prototype.pSTATEMENT_PP=function(a){if("is"==this.token){this.next();var b=new Eden.AST.Definition,c=this.parent;this.parent=b;var d=this.pEXPRESSION();return b.setExpression(d),this.parent=c,b}if("in"==this.token){if(this.next(),!a){var e=new Eden.AST.Range;return e.error(new Eden.SyntaxError(this,Eden.SyntaxError.RANGEBANNED)),e}var e=new Eden.AST.Range(this.pEXPRESSION());return".."==this.token&&(this.next(),e.setSecond(this.pEXPRESSION())),e}if("="==this.token)return this.next(),new Eden.AST.Assignment(this.pEXPRESSION());if("+="==this.token)return this.next(),new Eden.AST.Modify("+=",this.pEXPRESSION());if("-="==this.token)return this.next(),new Eden.AST.Modify("-=",this.pEXPRESSION());if("/="==this.token)return this.next(),new Eden.AST.Modify("/=",this.pEXPRESSION());if("*="==this.token)return this.next(),new Eden.AST.Modify("*=",this.pEXPRESSION());if("~>"==this.token){this.next();var f=new Eden.AST.Subscribers;return"["!=this.token?(f.error(new Eden.SyntaxError(this,Eden.SyntaxError.SUBSCRIBEOPEN)),f):(this.next(),f.setList(this.pOLIST()),f.errors.length>0?f:"]"!=this.token?(f.error(new Eden.SyntaxError(this,Eden.SyntaxError.SUBSCRIBECLOSE)),f):(this.next(),f))}if("++"==this.token)return this.next(),new Eden.AST.Modify("++",(void 0));if("--"==this.token)return this.next(),new Eden.AST.Modify("--",(void 0));if("("==this.token){var g=new Eden.AST.FunctionCall;if(this.next(),")"!=this.token){if(g.setParams(this.pELIST()),g.errors.length>0)return g;if(")"!=this.token)return g.error(new Eden.SyntaxError(this,Eden.SyntaxError.FUNCCLOSE)),g}return this.next(),g}var h=[];h.push(new Eden.SyntaxError(this,Eden.SyntaxError.DEFINITION));var i=new Eden.AST.Assignment((void 0));return i.errors.unshift(h[0]),i},Eden.AST.prototype.pSTATEMENT_P=function(a){var b=this.pLVALUE();if(b.errors.length>0)return b;var c=this.pSTATEMENT_PP(a);return c.left(b),c.errors.length>0?c:c},Eden.AST.prototype.pSTATEMENT=function(){var a=this.stream.prevposition,b=this.stream.line-1,c=-1,d=void 0,e=-1,f=this.lastDoxyComment.length>0?this.lastDoxyComment.pop():void 0;switch(0==this.lastDoxyComment.length&&this.parentDoxy&&this.lastDoxyComment.push(this.parentDoxy),this.token){case"proc":this.next(),d=this.pACTION();break;case"func":this.next(),d=this.pFUNCTION();break;case"when":this.next(),d=this.pWHEN();break;case"action":this.next(),d=this.pNAMEDSCRIPT();break;case"for":this.next(),d=this.pFOR();break;case"while":this.next(),d=this.pWHILE();break;case"do":this.next(),d=this.pDO();break;case"wait":this.next(),d=this.pWAIT();break;case"switch":this.next(),d=this.pSWITCH();break;case"case":this.next(),d=this.pCASE();break;case"insert":this.next(),d=this.pINSERT();break;case"delete":this.next(),d=this.pDELETE();break;case"append":this.next(),d=this.pAPPEND();break;case"shift":this.next(),d=this.pSHIFT();break;case"require":this.next(),d=this.pREQUIRE();break;case"after":this.next(),d=this.pAFTER();break;case"import":this.next(),d=this.pIMPORT();break;case"local":case"auto":d=this.pLOCALS();break;case"default":this.next();var g=new Eden.AST.Default;":"!=this.token?g.error(new Eden.SyntaxError(this,Eden.SyntaxError.DEFAULTCOLON)):this.next(),d=g;break;case"if":this.next(),d=this.pIF();break;case"#":var h=this.stream.position+1,i=this.stream.line,j=33==this.stream.peek();do this.stream.skipLine(),this.stream.valid()||this.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.NEWLINE)),this.stream.skip(),this.stream.line++;while(35==this.stream.peek()&&35!=this.stream.peek2());if(j){var k=new Eden.AST.DoxyComment(this.stream.code.substring(h,this.stream.position-1).trim(),i,this.stream.line);k.parent=this.parentDoxy,k.content.endsWith("@{")?this.parentDoxy=k:k.content.startsWith("@}")&&this.parentDoxy&&(this.parentDoxy=this.parentDoxy.parent),!this.lastStatement||void 0!==this.lastStatement.doxyComment||this.lastStatEndline!=i-1&&this.lastStatEndline!=i?this.lastDoxyComment.push(k):this.lastStatement.setDoxyComment(k)}this.next(),d=new Eden.AST.DummyStatement;break;case"##":d=this.pSECTION(),this.lastDoxyComment.length>0&&this.lastline==this.lastDoxyComment[0].startline-1&&d.setDoxyComment(this.lastDoxyComment.shift());break;case"return":this.next();var l=new Eden.AST.Return;if(";"==this.token){this.next(),d=l;break}if(l.setResult(this.pEXPRESSION()),l.errors.length>0){d=l;break}";"!=this.token?l.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next(),d=l;break;case"continue":this.next();var m=new Eden.AST.Continue;if(m.errors.length>0){d=m;break}";"!=this.token?m.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next(),d=m;break;case"break":this.next();var n=new Eden.AST.Break;if(n.errors.length>0){d=n;break}";"!=this.token?n.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next(),d=n;break;case"{":this.next();var o=this.pSCRIPT();if("}"!=this.token){o.error(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONCLOSE)),d=o;break}this.next(),d=o;break;case"JAVASCRIPT":b=this.data.line-1;var p=this.data.value;this.next(),d=new Eden.AST.Literal("JAVASCRIPT",p);break;case"?":this.next(),d=this.pQUERY(),";"!=this.token?d.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next();break;case"`":case"*":case"OBSERVABLE":var q=this.pLVALUE();if(q.errors.length>0){d=new Eden.AST.DummyStatement,d.lvalue=q,d.errors=q.errors;break}var r=this.pSTATEMENT_PP();if(r.left(q),r.errors.length>0){d=r;break}";"!=this.token?r.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next(),void 0===this.definitions[q.name]&&(this.definitions[q.name]=[]),this.definitions[q.name].push(r),d=r;break;default:return}return e=this.lastposition,c=this.lastline,d.parent=this.parent,void 0===d.doxyComment&&d.setDoxyComment(f),d.stamp=this.stamp,d.numlines=c-b-1,d.setSource(a,e,this.stream.code.substring(a,e)),"dummy"!=d.type&&(this.lastStatement=d,this.lastStatEndline=c),d},Eden.AST.prototype.pSTATEXPR=function(){var a=(this.stream.prevposition,void 0),b=this.lastDoxyComment;switch(this.lastDoxyComment=this.parentDoxy,this.token){case"proc":case"func":case"when":case"wait":case"do":case"require":case"after":case"import":case"action":a=new Eden.AST.DummyStatement,a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.UNKNOWN));break;case"for":this.next(),a=this.pFOR();break;case"while":this.next(),a=this.pWHILE();break;case"switch":this.next(),a=this.pSWITCH();break;case"case":this.next(),a=this.pCASE();break;case"insert":this.next(),a=this.pINSERT();break;case"delete":this.next(),a=this.pDELETE();break;case"append":this.next(),a=this.pAPPEND();break;case"shift":this.next(),a=this.pSHIFT();break;case"para":case"oracle":a=this.pPARAMS();break;case"local":case"auto":a=this.pLOCALS();break;case"default":this.next();var c=new Eden.AST.Default;":"!=this.token?c.error(new Eden.SyntaxError(this,Eden.SyntaxError.DEFAULTCOLON)):this.next(),a=c;break;case"if":this.next(),a=this.pIF();break;case"return":this.next();var d=new Eden.AST.Return;if(";"==this.token){this.next(),a=d;break}if(d.setResult(this.pEXPRESSION()),d.errors.length>0){a=d;break}";"!=this.token?d.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next(),a=d;break;case"continue":this.next();var e=new Eden.AST.Continue;if(e.errors.length>0){a=e;break}";"!=this.token?e.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next(),a=e;break;case"break":this.next();var f=new Eden.AST.Break;if(f.errors.length>0){a=f;break}";"!=this.token?f.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):this.next(),a=f;break;case"{":this.next();var g=this.pSCRIPT();if("}"!=this.token){g.error(new Eden.SyntaxError(this,Eden.SyntaxError.ACTIONCLOSE)),endline=this.stream.line,a=g;break}endline=this.stream.line,this.next(),a=g;break;case"JAVASCRIPT":curline=this.data.line-1;var h=this.data.value;this.next(),a=new Eden.AST.Literal("JAVASCRIPT",h);break;case"`":case"*":case"OBSERVABLE":var i=this.pLVALUE();if(i.errors.length>0){a=new Eden.AST.DummyStatement,a.lvalue=i,a.errors=i.errors;break}var j=this.pSTATEMENT_PP();if(j.left(i),j.errors.length>0){a=j,endline=this.stream.line;break}";"!=this.token?j.error(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)):(end=this.stream.position,endline=this.stream.line,this.next()),void 0===this.definitions[i.name]&&(this.definitions[i.name]=[]),this.definitions[i.name].push(j),a=j;break;default:return}return a.parent=this.parent,a.doxyComment=b,a},Eden.AST.prototype.pSWITCH=function(){var a=new Eden.AST.Switch,b=this.parent;return this.parent=a,"("!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SWITCHOPEN)),this.parent=b,a):(this.next(),a.setExpression(this.pEXPRESSION()),a.errors.length>0?(this.parent=b,a):")"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SWITCHCLOSE)),this.parent=b,a):(this.next(),"{"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.SWITCHSCRIPT)),this.parent=b,a):(a.setStatement(this.pSTATEMENT()),this.parent=b,a)))},Eden.AST.prototype.pCASE=function(){var a=new Eden.AST.Case;return"STRING"!=this.token&&"NUMBER"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.CASELITERAL)),a):(a.setLiteral(this.token,this.data.value),this.next(),":"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.CASECOLON)),a):(this.next(),a))},Eden.AST.prototype.pTERM=function(){var a=this.pTERM_A(),b=this.pEXPRESSION_PPPPPP();return b?(b.left(a),b):a},Eden.AST.prototype.pTERM_A=function(){for(var a=this.pTERM_P();"<"==this.token||"<="==this.token||">"==this.token||">="==this.token||"=="==this.token||"!="==this.token;){var b=new Eden.AST.BinaryOp(this.token);this.next(),b.left(a),b.setRight(this.pTERM_P()),a=b}return a},Eden.AST.prototype.pTERM_P=function(){for(var a=this.pTERM_PP();"+"==this.token||"-"==this.token||"//"==this.token;){var b=new Eden.AST.BinaryOp(this.token);this.next(),b.left(a),b.setRight(this.pTERM_PP()),a=b}return a},Eden.AST.prototype.pTERM_PP=function(){for(var a=this.pTERM_PPP();"*"==this.token||"/"==this.token||"%"==this.token||"^"==this.token;){var b=new Eden.AST.BinaryOp(this.token);this.next(),b.left(a),b.setRight(this.pTERM_PPP()),a=b}return a},Eden.AST.prototype.pTERM_PPP=function(){var a=this.pFACTOR(),b=this.pEXPRESSION_PPPPP();return b?(b.left(a),b):a},Eden.AST.prototype.pWAIT=function(){var a=new Eden.AST.Wait;if(";"==this.token)return this.next(),a;var b=this.pEXPRESSION();return a.setDelay(b),";"!=this.token?(a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a):(this.next(),a)},Eden.AST.prototype.pWHEN=function(){var a=new Eden.AST.When,b=this.parent;if(this.parent=a,"("!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.WHENOPEN)),this.parent=b,a;if(this.next(),a.setExpression(this.pEXPRESSION()),a.errors.length>0)return this.parent=b,a;if(")"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.WHENCLOSE)),this.parent=b,a;if(this.next(),a.setStatement(this.pSTATEMENT()),a.errors.length>0)return this.parent=b,a;if(void 0===a.statement)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.WHENNOSTATEMENT)),a.active=!0,this.parent=b,a;if("with"==this.token||"::"==this.token){this.next();var c=this.pSCOPE();if(a.setScope(c),c.errors.length>0)return a;if(";"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.SEMICOLON)),a;this.next()}return a.compile(this),this.whens.push(a),this.parent=b,a},Eden.AST.prototype.pWHILE=function(){var a=new Eden.AST.While,b=this.parent;return this.parent=a,a.warning=new Eden.SyntaxWarning(this,a,Eden.SyntaxWarning.USEOFWHILE),"("!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.WHILEOPEN)),this.parent=b,a):(this.next(),a.setCondition(this.pEXPRESSION()),a.errors.length>0?(this.parent=b,a):")"!=this.token?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.WHILECLOSE)),this.parent=b,a):(this.next(),a.setStatement(this.pSTATEMENT()),void 0===a.statement?(a.error(new Eden.SyntaxError(this,Eden.SyntaxError.WHILENOSTATEMENT)),this.parent=b,a):(this.parent=b,a)))},Eden.AST.prototype.pQUERY=function(){var a=new Eden.AST.Query,b=[];if("("!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.QUERYOPEN)),a;if(this.next(),a.setSelector(this.pCODESELECTOR()),")"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.QUERYCLOSE)),a;if(this.next(),"["!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.QUERYSELECTOPEN)),a;for(this.next();this.stream.valid()&&"]"!=this.token&&(b.push(this.data.value),this.next(),"]"!=this.token);){if(","!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.QUERYSELECTCOMMA)),a;this.next()}if("]"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.QUERYSELECTCLOSE)),a;if(this.next(),"="==this.token||"+="==this.token||"//="==this.token){var c=this.token;this.next();var d=this.pEXPRESSION();a.setModify(d,c)}return 0==b.length&&b.push("id"),a.setResultTypes(b),a},Eden.AST.prototype.pINDEXED=function(){for(var a=new Eden.AST.Indexed;this.stream.valid()&&"["==this.token;){this.next();var b=new Eden.AST.Index;if("]"==this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXEXP)),a;var c=this.pEXPRESSION();if(c.errors.length>0)return b.setExpression(c),a.addIndex(b),a;if("literal"==c.type&&"NUMBER"==c.datatype&&c.value<1)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.OUTOFBOUNDS)),a;if("]"!=this.token)return a.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.LISTINDEXCLOSE)),a;this.next(),b.setExpression(c),a.addIndex(b)}return a},Eden.AST.prototype.pSECTION=function(){for(var a=1;35==this.stream.peek();)a++,this.stream.skip();var b=this.stream.readLine().trim();return this.stream.valid()?(this.stream.position--,this.stream.line--):this.errors.push(new Eden.SyntaxError(this,Eden.SyntaxError.NEWLINE)),this.next(),stat=new Eden.AST.Section,stat.setName(b),stat.depth=a,stat},Eden.Project=function(a,b,c){this.title=b,this.name=b.replace(/[^a-zA-Z0-9]/g,""),this.author=void 0,this.authorid=-1,this.tags=b.toLowerCase().split(" "),this.src=c,this.ast=new Eden.AST(c,(void 0),this),this.id=a,this.vid=void 0,this.parentid=void 0,this.thumb=void 0,this.desc=void 0,this.readPassword=void 0,this.ast&&0==this.ast.script.errors.length,eden.root.lookup("jseden_project_title").assign(b,eden.root.scope,Symbol.localJSAgent),eden.root.lookup("jseden_project_name").assign(this.name,eden.root.scope,Symbol.localJSAgent)},Eden.Project.listenTo=listenTo,Eden.Project.emit=emit,Eden.Project.unListen=unListen,Eden.Project.listeners={},Eden.Project.init=function(){var a=eden.root.lookup("jseden_project_title");a.addJSObserver("project",function(a,b){if(a.origin!==eden.project){if(void 0===eden.project)return;eden.project.title=b,void 0===this.id&&(Eden.Index.remove(eden.project.ast.script),eden.project.name=b.replace(/[^a-zA-Z0-9]/g,""),eden.project.ast.script.name=eden.project.name,console.log("REINDEX PROJECT"),Eden.Index.update(eden.project.ast.script)),eden.project.ast.script.doxyComment=eden.project.ast.doxyFromOrigin(),Eden.Fragment.emit("aststatus",[eden.project.ast.script])}}),$.get("resources/projects.db.json",function(a){Eden.Project.local=a},"json")},Eden.Project.newFromExisting=function(a,b){var c=this;Eden.Project.emit("loading",[c]),Eden.Project.local[a]&&$.get(Eden.Project.local[a].file,function(d){eden.root.lookup("jseden_project_mode").assign("restore",eden.root.scope,Symbol.defaultAgent),eden.project=new Eden.Project((void 0),a,d),eden.project.start(function(){Eden.Project.emit("load",[c]),b&&b(eden.project)})},"text")},Eden.Project.search=function(a,b){},Eden.Project.load=function(a,b,c,d){var e=this;3==arguments.length&&(d=c,c=void 0),Eden.Project.emit("loading",[e]),Eden.DB.load(a,b,c,function(b){if(b){var f=b;if(eden.project=new Eden.Project(a,f.minimisedTitle,b.source), diff --git a/js/ui/jseden-ui.min.js b/js/ui/jseden-ui.min.js index 3bf562663..bf50912ca 100644 --- a/js/ui/jseden-ui.min.js +++ b/js/ui/jseden-ui.min.js @@ -1,4 +1,4 @@ !function(a){function b(a,b,c,d){function e(){f.insertBefore(b,g)}var f=b.parentNode,g=b.nextSibling;return f?(f.removeChild(b),"boolean"!=typeof c&&(d=c,c=!1),void(d&&c?d.call(a,b,e):d&&(d.call(a,b),e()))):void d.call(a,b)}EdenUI.Highlight=function(a,b){this.ast=void 0,this.outelement=a,this.line=1,this.currentline=-1,this.mode_at_line={},this.heredocend=void 0,this.scrolltop=-1,this.token=void 0,this.prevtoken=void 0,this.modestack=[],this.linestack=void 0,this.outerline=void 0,this.lineelement=void 0,this.startmode=b&&b.start?b.start:"START",this.styles=b&&b.styles?b.styles:EdenUI.Highlight.defaultStyles,this.clearmodes=b&&b.clearmodes?b.clearmodes:EdenUI.Highlight.lineclearmode,this.mode=this.startmode,this.incomment=!1,this.brline=b&&b.brline,this.styleExtensions={},this.metrics={}},EdenUI.Highlight.defaultStyles={comment:"eden-comment","hidden-comment":"eden-comment-hidden",operator:"eden-operator",observable:"eden-observable",storage:"eden-storage",number:"eden-number",string:"eden-string",constant:"eden-constant",parameter:"eden-parameter",keyword:"eden-keyword",javascript:"eden-javascript",selector:"eden-selector",selector2:"eden-selector2",selector3:"eden-selector3",function:"eden-function",type:"eden-type",special:"eden-special",backticks:"eden-backticks",doxycomment:"eden-doxycomment",pathblock:"eden-pathblock","comment-h1":"eden-comment-h1","comment-h2":"eden-comment-h2","comment-h3":"eden-comment-h3","comment-h4":"eden-comment-h4","horizontal-line":"eden-section-line","comment-line":"eden-comment-line","comment-emph":"eden-comment-emph","comment-bold":"eden-comment-bold","script-line":"eden-line-script",doxytag:"eden-doxytag","comment-query":"eden-comment-query","block-comment":"eden-blockcomment","comment-ul":"eden-comment-ul","comment-blockquote":"eden-comment-blockquote",script:"eden-script",notexist:"eden-notexist"},EdenUI.Highlight.prototype.pushLine=function(){this.linestack.push(this.lineelement)},EdenUI.Highlight.prototype.pushMode=function(){this.modestack.push(this.mode)},EdenUI.Highlight.prototype.popLine=function(){this.linestack.length>0&&(this.lineelement=this.linestack.pop())},EdenUI.Highlight.prototype.popMode=function(){this.modestack.length>0&&(this.mode=this.modestack.pop())},EdenUI.Highlight.prototype.setScrollTop=function(a){this.scrolltop=a},EdenUI.Highlight.isType=function(a){return!1},EdenUI.Highlight.lineclearmode={COMMENT:!0,SECTION_TITLE:!0,SECTION_TITLE2:!0,SECTION_TITLE3:!0,SECTION_TITLE4:!0,SECTION_TITLE_H1:!0,SECTION_TITLE_H2:!0,SECTION_TITLE_H3:!0,SECTION_TITLE_H4:!0,COMMENT_BOLD:!0,COMMENT_CODE:!0,COMMENT_ICON:!0,COMMENT_EMPH:!0,COMMENT_ITALIC:!0,COMMENT_BOLD_END:!0,COMMENT_QUERY:!0,END_COMMENT_TAG:!0,COMMENT_TAG:!0,COMMENT_LINK:!0,COMMENT_LINK_END:!0,COMMENT_HTML:!0,COMMENT_HTML_START:!0,COMMENT_HTML_CONTENT:!0,COMMENT_ATTRS:!0},EdenUI.Highlight.prototype.applyClasses=function(a,b){for(var c=b?b:this.classes,d="",e=0;e0&&(c=a.script.errors[0].prevposition,d=a.script.errors[0].position,e=a.script.errors[0].messageText());var k="",l=document.createElement("div");for(l.className=this.styles["script-line"];;){if(g.position==b){if(""!=k){var m=document.createTextNode(k);l.appendChild(m),k=""}var n=document.createElement("span");n.className="fake-caret",l.appendChild(n);for(var o=l;o&&"DIV"!=o.nodeName;)o=o.parentNode;o&&o.className.startsWith(this.styles["comment-line"])&&(o.className+=" current")}var p=g.peek();if(10==p||13==p){if(""!=k){if(l.lastChild&&l.lastChild.className!=this.styles["hidden-comment"]&&"fake-caret"!=l.lastChild.className)if(l.lastChild.lastChild&&"#text"==l.lastChild.lastChild.nodeName)l.lastChild.lastChild.textContent+=k;else{var m=document.createTextNode(k);l.lastChild.appendChild(m)}else{var m=document.createTextNode(k);l.appendChild(m)}k=""}break}if(9!=p&&13!=p&&32!=p&&160!=p){if(""!=k){if(l.lastChild&&l.lastChild.className!=this.styles["hidden-comment"]&&"fake-caret"!=l.lastChild.className)if(l.lastChild.lastChild&&"#text"==l.lastChild.lastChild.nodeName)l.lastChild.lastChild.textContent+=k;else{var m=document.createTextNode(k);l.lastChild.appendChild(m)}else{var m=document.createTextNode(k);l.appendChild(m)}k=""}if(j=i,i=g.readToken(this.incomment),"string"!=typeof i&&console.error("Token error: line = "+this.line+" position = "+g.position),"EOF"==i){if(""!=k){if(l.lastChild&&l.lastChild.className!=this.styles["hidden-comment"]&&"fake-caret"!=l.lastChild.className)if(l.lastChild.lastChild&&"#text"==l.lastChild.lastChild.nodeName)l.lastChild.lastChild.textContent+=k;else{var m=document.createTextNode(k);l.lastChild.appendChild(m)}else{var m=document.createTextNode(k);l.appendChild(m)}k=""}break}if("INVALID"!=i)if(this.token=i,this.prevtoken=j,this.type=g.tokenType(i),this.classes=[],this.tokentext=g.tokenText(),this.lineelement=l,c!=-1&&(c<=g.prevposition&&!f&&(f=!0),d<=g.prevposition&&f&&(f=!1),f&&(h=!0)),f&&"EOF"!=a.script.errors[0].token&&this.classes.push("error"),void 0===this[this.mode]&&console.error("No Mode",this.mode),this[this.mode].call(this),l=this.lineelement,g.prevpositionb){var n=b-g.prevposition,q=this.tokentext.slice(0,n),r=this.tokentext.slice(n),s=document.createElement("span");this.applyClasses(s);var t=document.createElement("span");t.appendChild(document.createTextNode(q)),s.appendChild(t);var n=document.createElement("span");n.className="fake-caret",s.appendChild(n),t=document.createElement("span"),t.appendChild(document.createTextNode(r)),s.appendChild(t),l.appendChild(s);for(var o=l;o&&"DIV"!=o.nodeName;)o=o.parentNode;o&&o.className.startsWith(this.styles["comment-line"])&&(o.className+=" current")}else if(l.lastChild&&l.lastChild.className==this.generateClasses()){var t=l.lastChild;t.lastChild&&"#text"==t.lastChild.nodeName?t.lastChild.textContent+=this.tokentext:t.appendChild(document.createTextNode(this.tokentext))}else{var t=document.createElement("span");this.applyClasses(t),t.appendChild(document.createTextNode(this.tokentext)),l.appendChild(t)}else console.log("INVALID: "+g.peek()),g.skip()}else g.skip(),32==p||160==p?k+=" ":13!=p&&(k+=String.fromCharCode(p))}return this.linestack.length>0&&(l=this.linestack[0]),this.mode_at_line[this.line]=this.mode,l},EdenUI.Highlight.prototype.updateAST=function(a){this.ast=a,this.errstart=-1,this.errend=-1,this.errmsg="",this.inerror=!1,this.stream=a.stream,this.stream.reset(),this.title="",a.script&&a.script.errors.length>0&&(this.errstart=a.script.errors[0].prevposition,this.errend=a.script.errors[0].position,this.errmsg=a.script.errors[0].messageText())},EdenUI.Highlight.prototype.highlightAll=function(a,c){var d=void 0,e=!1,f=0,g=this.stream;this.metrics={},this.styleExtensions={},b(this,this.outelement,!1,function(){for(;this.outelement.lastChild;)this.outelement.removeChild(this.outelement.lastChild);for(this.mode_at_line={};g.valid();){var b=g.peek();if(10!=b&&13!=b)if(this.disablehl||this.scrolltop>=0&&(this.linethis.scrolltop+105)){var h,i=g.code.indexOf("\n",g.position);i==-1?(h=g.code.substring(g.position),g.position=g.code.length):(h=g.code.substring(g.position,i),g.position=i),d=document.createTextNode(h),this.disablehl||"#"!=h.trim().charAt(0)||(this.outerline="eden-line eden-wrapline")}else d=this.highlightLine(this.ast,a);else{e=f<=this.errstart&&g.position>=this.errend;var j=document.createElement("div");j.className=this.outerline,c&&c.spacing&&c.spacing[this.line]&&(j.height=""+c.spacing[this.line]+"px"),j.setAttribute("data-line",this.line-1),this.line++,void 0===d&&this.brline&&(d=document.createElement("br")),void 0!==d?j.appendChild(d):this.mode_at_line[this.line-1]=this.mode;var k=document.createTextNode("\n");j.appendChild(k),this.outelement.appendChild(j),f=g.position+1,d=void 0,g.skip(),13==b&&g.skip(),this.outerline="eden-line"}}if(e=f<=this.errstart&&g.position>=this.errend,void 0===d&&this.brline&&(d=document.createElement("br")),void 0!==d){var j=document.createElement("div");j.className="eden-line",j.style.height=""+(c&&c.spacing&&c.spacing[this.line]?c.spacing[this.line]:20)+"px",j.setAttribute("data-line",this.line-1),j.appendChild(d),this.outelement.appendChild(j)}else{var j=document.createElement("div");if(a>=g.position){j.className="eden-line",j.style.height=""+(c&&c.spacing&&c.spacing[this.line]?c.spacing[this.line]:20)+"px",j.setAttribute("data-line",this.line-1);var l=document.createElement("span");l.className="fake-caret",j.appendChild(l)}else j.className="eden-line";this.outelement.appendChild(j)}})},EdenUI.Highlight.prototype.highlightOpt=function(a,b,c){for(var d=void 0,e=!1,f=0,g=this.stream;g.valid()&&this.line=0;i--){this.line=a-i+1,this.metrics[this.line]&&delete this.metrics[this.line];var j=this.outelement.childNodes[a-i];if(void 0!==j){for(;j.lastChild;)j.removeChild(j.lastChild);if(f=g.position,this.disablehl){var k,l=g.code.indexOf("\n",g.position);if(l==-1?(k=g.code.substring(g.position),g.position=g.code.length):(k=g.code.substring(g.position,l),g.position=l),fb){var m=b-f,n=k.slice(0,m),o=k.slice(m),p=document.createElement("span"),q=document.createTextNode(n);p.appendChild(q);var m=document.createElement("span");m.className="fake-caret",p.appendChild(m);var r=document.createTextNode(o);p.appendChild(r),d=p}else d=document.createTextNode(k)}else d=this.highlightLine(this.ast,b);e=f<=this.errstart&&g.position>=this.errend,j.appendChild(d),j.className=this.outerline;var h=g.peek(),s=document.createTextNode("\n");j.appendChild(s),g.skip(),13==h&&g.skip()}}if(!this.disablehl)for(;void 0!==this.mode_at_line[this.line+1]&&this.mode_at_line[this.line]!=this.mode_at_line[this.line+1];){this.line++,this.metrics[this.line]&&delete this.metrics[this.line];var j=this.outelement.childNodes[this.line-1];if(void 0!==j){for(;j.lastChild;)j.removeChild(j.lastChild);f=g.position,d=this.highlightLine(this.ast,b),e=f<=this.errstart&&g.position>=this.errend,j.appendChild(d),j.className=this.outerline;var h=g.peek(),s=document.createTextNode("\n");j.appendChild(s),g.skip(),13==h&&g.skip()}}},EdenUI.Highlight.prototype.highlight=function(a,b,c,d){if(this.ast=a,this.updateAST(a),this.line=1,void 0!==this.outelement)return 0==a.stream.code.length?void(this.outelement&&(this.outelement.innerHTML="
")):(this.disablehl=!(!d||!d.disabled),b==-1?this.highlightAll(c,d):this.highlightOpt(b,c,d))},EdenUI.Highlight.html=function(a,b,c){var d=document.createElement("div"),e=new EdenUI.Highlight(d);if(e.ast={stream:new EdenStream(a)},e.highlight(e.ast,-1,-1,void 0),b)return d.childNodes[0].innerHTML;for(var f="",g=0;g
'+f+"
":f}}("undefined"!=typeof window?window:global);var edenFunctions={apply:!0,array:!0,canvasURL:!0,centroid:!0,char:!0,charCode:!0,choose:!0,compose:!0,concat:!0,curry:!0,decodeHTML:!0,definitionOf:!0,definitionRHS:!0,doDefault:!0,edenCode:!0,escapeRE:!0,foldl:!0,foldr:!0,hasProperty:!0,hslColour:!0,htmlBulletList:!0,htmlNumberedList:!0,positionInList:!0,positionOfRE:!0,substringPosition:!0,int:!0,isBoolean:!0,isCallable:!0,isChar:!0,isDefined:!0,isDependency:!0,isDependent:!0,isFunc:!0,isInt:!0,isList:!0,isNaN:!0,isNumber:!0,isObject:!0,isPoint:!0,isPointer:!0,isProc:!0,isString:!0,isValue:!0,distanceMoved:!0,angleTurned:!0,List:!0,listcat:!0,lookup:!0,lowercase:!0,map:!0,mapPartial:!0,max:!0,Menu:!0,MenuItem:!0,min:!0,mod:!0,nameof:!0,partApply:!0,Point:!0,pow:!0,properties:!0,randomBoolean:!0,randomFloat:!0,randomInteger:!0,RE:!0,replaceFirst:!0,reverse:!0,rgbColour:!0,rotatePoint:!0,round:!0,roundMultiple:!0,scalePoint:!0,search:!0,sequenceItoJ:!0,sequenceN:!0,sequenceArithmeticN:!0,sequenceList:!0,sequencePrevious:!0,sort:!0,str:!0,sqrt:!0,strcat:!0,sublist:!0,substitute:!0,substr:!0,sum:!0,tail:!0,trim:!0,type:!0,uppercase:!0,include_css:!0,html:!0,time:!0,execute:!0,Text:!0,textWidth:!0,textHeight:!0,Arc:!0,Curve:!0,FillPattern:!0,Ellipse:!0,Line:!0,LinearGradient:!0,LineSequence:!0,PixelList:!0,GreyPixelList:!0,Rectangle:!0,RotateAboutCentre:!0,RotateAboutPoint:!0,CombinedRotation:!0,Scale:!0,Translate:!0,RoundedRectangle:!0,Polygon:!0,RegularPolygon:!0,Sector:!0,Shadow:!0,Circle:!0,Button:!0,Checkbox:!0,Div:!0,Image:!0,imageWithZones:!0,HTMLImage:!0,RadioButtons:!0,Slider:!0,Textbox:!0,DropDownList:!0,Combobox:!0,BulletSlide:!0,Video:!0,Audio:!0,Slide:!0,TitledSlide:!0,TitleSlide:!0,cos:!0,sin:!0,tan:!0,abs:!0,acos:!0,asin:!0,atan:!0,ceil:!0,roundUp:!0,exp:!0,floor:!0,roundDown:!0,log:!0,random:!0,forget:!0,forgetAll:!0,shapeOnTopAt:!0,zoneOnTopAt:!0,observableOnTopAt:!0,shapeOnBottomAt:!0,zoneOnBottomAt:!0,observableOnBottomAt:!0,shapesAt:!0,zonesAt:!0,observablesAt:!0,observableForShape:!0,alias:!0,arrangeWindows:!0,attemptMouseCapture:!0,bindCSSNumericProperty:!0,bindCSSProperty:!0,bindCSSRule:!0,createCanvas:!0,createHTMLView:!0,createProjectList:!0,createView:!0,destroyView:!0,eager:!0,error:!0,hideView:!0,highlightView:!0,moveView:!0,patch:!0,removeedenclock:!0,resizeView:!0,setedenclock:!0,showObservables:!0,showView:!0,stopHighlightingView:!0,todo:!0,touch:!0,unbind:!0,withAppendedItem:!0,writeln:!0},edenSpecials={autocalc:!0,mouseX:!0,mouseY:!0,mousePosition:!0,screenHeight:!0,screenWidth:!0,PI:!0},edenValues={true:!0,false:!0,green:!0},jskeywords={var:!0,if:!0,while:!0,typeof:!0,this:!0,function:!0,return:!0,else:!0,break:!0,continue:!0,switch:!0,for:!0,prototype:!0};EdenUI.Highlight.prototype.START=function(){switch(this.token){case"##":"INVALID"==this.prevtoken?(this.classes.push("hidden-comment"),this.mode="SECTION_TITLE",this.applyClasses(this.lineelement,["comment-line"]),32==this.stream.peek()&&(this.tokentext+=" ",this.stream.position++)):(this.classes.push("comment"),this.mode="COMMENT");break;case"#":if("INVALID"==this.prevtoken||";"==this.prevtoken){var a=33==this.stream.peek();a&&(this.tokentext+="!",this.stream.position++),this.classes.push("hidden-comment"),this.mode="COMMENT",this.incomment=!0,"INVALID"==this.prevtoken&&(this.lineelement.style.marginLeft="0");var b=document.createElement("div");this.applyClasses(b,a?["comment-line","doxycomment"]:["comment-line"]),this.pushLine(),this.lineelement.appendChild(b),this.lineelement=b,32==this.stream.peek()&&(this.tokentext+=" ",this.stream.position++)}else this.classes.push("operator");break;case"local":case"para":case"handle":case"oracle":case"auto":this.classes.push("storage");break;case"NUMBER":this.classes.push("number");break;case"STRING":this.classes.push("string");break;case"BOOLEAN":this.classes.push("constant");break;case"CHARACTER":this.classes.push("string");break;case"import":case"do":this.classes.push("keyword"),this.pushMode(),this.mode="SELECTOR";break;case"${{":this.classes.push("javascript"),this.mode="JAVASCRIPT";break;case"?":this.classes.push("selector"),this.pushMode(),this.mode="SELECTOR";break;case"<<":var c=(this.stream.readToken(),this.stream.tokenText());this.tokentext+=c,this.heredocend=c,this.classes.push("storage"),this.mode="HEREDOC";break;case"OBSERVABLE":edenFunctions[this.stream.data.value]?this.classes.push("function"):EdenUI.Highlight.isType(this.stream.data.value)?this.classes.push("type"):edenValues[this.stream.data.value]?this.classes.push("constant"):edenSpecials[this.stream.data.value]?this.classes.push("special"):"$"==this.stream.data.value.charAt(0)?this.classes.push("parameter"):(this.classes.push("observable"),Eden.Index.name_index.hasOwnProperty(this.stream.data.value)||eden.root.symbols.hasOwnProperty(this.stream.data.value)||this.classes.push("notexist"));break;case"`":this.pushMode(),this.mode="BACKTICK",this.pushLine();var b=document.createElement("span");this.applyClasses(b,["backticks"]),this.lineelement.appendChild(b),this.lineelement=b;break;default:"keyword"==this.type?this.classes.push("keyword"):"-"==this.token&&this.stream.isNumeric(this.stream.peek())?(this.token=this.stream.readToken(),this.tokentext="-"+this.stream.tokenText(),this.classes.push("number")):"/*"==this.token?42==this.stream.peek()?(this.mode="DOXY_COMMENT",this.classes.push("block-comment")):(this.mode="BLOCK_COMMENT",this.classes.push("block-comment")):this.classes.push("operator")}},EdenUI.Highlight.prototype.BACKTICK=function(){"`"==this.token?this.mode="ENDBACKTICK":"}"==this.token?(this.popMode(),this.classes.push("operator")):this.START()},EdenUI.Highlight.prototype.ENDBACKTICK=function(){this.popLine(),this.popMode(),this.START()},EdenUI.Highlight.prototype.SELECTOR=function(){this.pushLine();var a=document.createElement("span");this.applyClasses(a,["pathblock"]),this.lineelement.appendChild(a),this.lineelement=a,this.mode="SELECTOR2",this.SELECTOR2()},EdenUI.Highlight.prototype.SELECTOR2=function(){"{"==this.token?(this.classes.push("operator"),this.pushMode(),this.mode=this.startmode):"["==this.token?(this.classes.push("selector"),this.mode="SELECTOR_TYPES"):";"==this.token||"="==this.token||"+="==this.token||"//="==this.token?(this.popLine(),this.classes.push("operator"),this.popMode()):"::"==this.token||"with"==this.token?(this.popLine(),this.classes.push("keyword"),this.popMode()):"OBSERVABLE"!=this.token||"."!=this.prevtoken&&":"!=this.prevtoken||!Eden.Selectors.PropertyNode.attributes[this.tokentext]&&!Eden.Selectors.PropertyNode.pseudo[this.tokentext]?this.classes.push("selector"):this.classes.push("selector2")},EdenUI.Highlight.prototype.SELECTOR_TYPES=function(){"OBSERVABLE"==this.token&&Eden.Selectors.resultTypes[this.tokentext]?this.classes.push("selector3"):"]"==this.token?(this.classes.push("selector"),this.mode="SELECTOR2"):this.classes.push("selector")},EdenUI.Highlight.prototype.JAVASCRIPT=function(){this.classes.push("javascript"),"}}$"==this.token&&(this.mode=this.startmode)},EdenUI.Highlight.prototype.HEREDOC=function(){"INVALID"==this.prevtoken&&this.tokentext==this.heredocend?(this.classes.push("storage"),this.mode=this.startmode):this.classes.push("string")},EdenUI.Highlight.prototype.SECTION_TITLE=function(){"#"==this.token?(this.classes.push("hidden-comment"),this.applyClasses(this.lineelement,["comment-line","comment-h2"]),this.mode="COMMENT",32==this.stream.peek()&&(this.tokentext+=" ",this.stream.position++)):"##"==this.token?(this.classes.push("hidden-comment"),this.mode="SECTION_TITLE3",32==this.stream.peek()&&(this.tokentext+=" ",this.stream.position++)):(this.applyClasses(this.lineelement,["comment-line","comment-h1"]),this.mode="COMMENT",this.COMMENT())},EdenUI.Highlight.prototype.SECTION_TITLE2=function(){"#"==this.token?(this.classes.push("hidden-comment"),this.mode="SECTION_TITLE3",32==this.stream.peek()&&(this.tokentext+=" ",this.stream.position++)):(this.classes.push("comment-h2"),this.mode="SECTION_TITLE_H2")},EdenUI.Highlight.prototype.SECTION_TITLE3=function(){"#"==this.token?(this.classes.push("hidden-comment"),this.applyClasses(this.lineelement,["comment-line","comment-h4"]),this.mode="COMMENT",32==this.stream.peek()&&(this.tokentext+=" ",this.stream.position++)):(this.applyClasses(this.lineelement,["comment-line","comment-h3"]),this.mode="COMMENT",this.COMMENT())},EdenUI.Highlight.prototype.SECTION_TITLE4=function(){this.classes.push("comment-h4"),this.mode="SECTION_TITLE_H4"},EdenUI.Highlight.prototype.SECTION_TITLE_H1=function(){this.classes.push("comment-h1")},EdenUI.Highlight.prototype.SECTION_TITLE_H2=function(){this.classes.push("comment-h2")},EdenUI.Highlight.prototype.SECTION_TITLE_H3=function(){this.classes.push("comment-h3")},EdenUI.Highlight.prototype.SECTION_TITLE_H4=function(){this.classes.push("comment-h4")},EdenUI.Highlight.prototype.BLOCK_COMMENT=function(){switch(this.token){case"*/":this.mode=this.startmode,this.classes.push("block-comment");break;default:this.classes.push("block-comment")}},EdenUI.Highlight.prototype.COMMENT=function(){switch(this.token){case"@":case"#":this.mode="COMMENT_TAG",this.pushLine();var a=document.createElement("span");this.applyClasses(a,["doxytag"]),this.lineelement.appendChild(a),this.lineelement=a;break;case"-":case"*":if("##"!=this.prevtoken&&"#"!=this.prevtoken&&"INVALID"!=this.prevtoken||32!=this.stream.peek()&&9!=this.stream.peek())"-"!=this.token?(this.pushMode(),this.mode="COMMENT_EMPH",this.classes.push("hidden-comment")):this.classes.push("comment");else{this.pushLine();var a=document.createElement("span");this.applyClasses(a,["comment-ul"]),this.lineelement.appendChild(a),this.lineelement=a,this.classes.push("hidden-comment")}break;case"--":if(45==this.stream.peek()){for(this.outerline="eden-line eden-section-line";45==this.stream.peek();)this.tokentext+="-",this.stream.position++;this.classes.push("hidden-comment")}else this.classes.push("comment");break;case"[":if(32!=this.stream.peek()){this.pushMode(),this.mode="COMMENT_LINK",this.pushLine();var a=document.createElement("span");this.lineelement.appendChild(a),this.lineelement=a,this.classes.push("hidden-comment")}else this.classes.push("comment");break;case"!":91==this.stream.peek()?(this.mode="COMMENT_IMAGE",this.tokentext+="[",this.stream.position++,this.classes.push("hidden-comment")):this.classes.push("comment");break;case"$":91==this.stream.peek()?(this.pushMode(),this.mode="COMMENT_BUTTON",this.tokentext+="[",this.stream.position++,this.classes.push("hidden-comment")):this.classes.push("comment");break;case">":"##"!=this.prevtoken&&"#"!=this.prevtoken&&"INVALID"!=this.prevtoken||32!=this.stream.peek()&&9!=this.stream.peek()?this.classes.push("comment"):(this.outerline+=" "+this.styles["comment-blockquote"],this.classes.push("hidden-comment"));break;case"`":this.pushMode(),this.mode="COMMENT_CODE",this.classes.push("hidden-comment");break;case":":32!=this.stream.peek()?(this.pushMode(),this.mode="COMMENT_ICON",this.classes.push("hidden-comment")):this.classes.push("comment");break;case"<":32!=this.stream.peek()?(this.mode="COMMENT_HTML",this.classes.push("hidden-comment")):this.classes.push("comment");break;case'"':this.pushMode(),this.mode="COMMENT_ESCAPE",this.classes.push("hidden-comment");break;case"?":this.pushMode(),this.mode="COMMENT_QUERY",this.cacheddata=void 0,void 0==this.metrics[this.line]&&(this.metrics[this.line]={}),this.metrics[this.line].query=!0,void 0===this.metrics[this.line].qelements&&(this.metrics[this.line].qelements=[]),this.classes.push("hidden-comment");break;case"{":this.pushMode(),this.mode="COMMENT_ATTRS",this.classes.push("hidden-comment");break;default:this.classes.push("comment")}};var css_color_names={aliceblue:!0,antiquewhite:!0,aqua:!0,aquamarine:!0,azure:!0,beige:!0,bisque:!0,black:!0,blanchedalmond:!0,blue:!0,blueviolet:!0,brown:!0,burlywood:!0,cadetblue:!0,chartreuse:!0,chocolate:!0,coral:!0,cornflowerblue:!0,cornsilk:!0,crimson:!0,cyan:!0,darkblue:!0,darkcyan:!0,darkgoldenrod:!0,darkgray:!0,darkgrey:!0,darkgreen:!0,darkkhaki:!0,darkmagenta:!0,darkolivegreen:!0,darkorange:!0,darkorchid:!0,darkred:!0,darksalmon:!0,darkseagreen:!0,darkslateblue:!0,darkslategray:!0,darkslategrey:!0,darkturquoise:!0,darkviolet:!0,deeppink:!0,deepskyblue:!0,dimgray:!0,dimgrey:!0,dodgerblue:!0,firebrick:!0,floralwhite:!0,forestgreen:!0,fuchsia:!0,gainsboro:!0,ghostwhite:!0,gold:!0,goldenrod:!0,gray:!0,grey:!0,green:!0,greenyellow:!0,honeydew:!0,hotpink:!0,indianred:!0,indigo:!0,ivory:!0,khaki:!0,lavender:!0,lavenderblush:!0,lawngreen:!0,lemonchiffon:!0,lightblue:!0,lightcoral:!0,lightcyan:!0,lightgoldenrodyellow:!0,lightgray:!0,lightgrey:!0,lightgreen:!0,lightpink:!0,lightsalmon:!0,lightseagreen:!0,lightskyblue:!0,lightslategray:!0,lightslategrey:!0,lightsteelblue:!0,lightyellow:!0,lime:!0,limegreen:!0,linen:!0,magenta:!0,maroon:!0,mediumaquamarine:!0,mediumblue:!0,mediumorchid:!0,mediumpurple:!0,mediumseagreen:!0,mediumslateblue:!0,mediumspringgreen:!0,mediumturquoise:!0,mediumvioletred:!0,midnightblue:!0,mintcream:!0,mistyrose:!0,moccasin:!0,navajowhite:!0,navy:!0,oldlace:!0,olive:!0,olivedrab:!0,orange:!0,orangered:!0,orchid:!0,palegoldenrod:!0,palegreen:!0,paleturquoise:!0,palevioletred:!0,papayawhip:!0,peachpuff:!0,peru:!0,pink:!0,plum:!0,powderblue:!0,purple:!0,red:!0,rosybrown:!0,royalblue:!0,saddlebrown:!0,salmon:!0,sandybrown:!0,seagreen:!0,seashell:!0,sienna:!0,silver:!0,skyblue:!0,slateblue:!0,slategray:!0,slategrey:!0,snow:!0,springgreen:!0,steelblue:!0,tan:!0,teal:!0,thistle:!0,tomato:!0,turquoise:!0,violet:!0,wheat:!0,white:!0,whitesmoke:!0,yellow:!0,yellowgreen:!0};EdenUI.Highlight.prototype.applyAttribute=function(a,b,c){if(a.style)switch(b){case"color":case"font-size":case"font-family":case"font-weight":case"font-style":case"text-decoration":case"margin-left":case"margin-right":a.style[b]=c;break;case"editable":"true"!=c&&"false"!=c||(a.contentEditable=c);break;case"script":a.setAttribute("data-jseden",c),a.contentEditable=!1,a.style.cursor="pointer",changeClass(a,"executable",!0);break;case"width":case"height":a.setAttribute(b,c);break;case"background":a.style.background=c;break;case"title":a.title=c;break;case"cursor":a.style.cursor=c;break;case"class":this.applyClasses(a,c.split(" "));break;default:a.style[b]=c}},EdenUI.Highlight.prototype.parseAttrs=function(a,b){b||(b=this.lineelement.lastChild),b=b?b.previousSibling:this.lineelement,b||(b=this.lineelement);var c;if(a=a.trim(),"."==a.charAt(0)){var d=a.substring(1).match(/[a-z0-9\-]+/);if(null===d)return;c=d[0],a=a.substring(c.length+1).trim(),void 0===this.styleExtensions[c]&&(this.styleExtensions[c]={})}for(;a&&a.length>0;){var e,f=a.indexOf("=");f==-1?(e=a,a=""):(e=a.substring(0,f),a=a.substring(f+1));var g="";if("?"==a.charAt(0));else if('"'==a.charAt(0)||"'"==a.charAt(0)){f=-1;for(var h=a.charAt(0),i=1;i0){f=-1;for(var i=0;i1?g.join(", "):"",f.setAttribute("data-result",g),this.cacheddata&&f.setAttribute("data-attribs",this.cacheddata),f.setAttribute("data-query",e),this.metrics[this.line].qelements.push(f)}}else this.popMode(),this.classes.push("hidden-comment")},EdenUI.Highlight.prototype.COMMENT_LINK=function(){if("]"!=this.token)this.COMMENT();else if(this.classes.push("hidden-comment"),40==this.stream.peek()){var a=this.lineelement,b=a.parentNode,c=document.createElement("a");c.setAttribute("target","_blank"),c.contentEditable=!1,b&&(b.removeChild(a),c.appendChild(a),b.appendChild(c),this.lineelement=c),this.mode="COMMENT_LINK_END"}else this.popMode(),this.popLine()},EdenUI.Highlight.prototype.COMMENT_LINK_END=function(){console.log("LINKEND",this.token);var a=this.stream.peekLine();if("("==this.token){var b=a.indexOf(")");if(b==-1)this.classes.push("hidden-comment"),this.popMode(),this.popLine();else{var c=a.substring(0,b);this.tokentext+=c+")",this.stream.position+=b+1,this.classes.push("hidden-comment"),this.popMode(),c.startsWith("http://")?this.lineelement.setAttribute("href",c):this.lineelement.setAttribute("href","javascript: Eden.Selectors.goto('"+c+"');"),this.popLine()}}},EdenUI.Highlight.prototype.COMMENT_IMAGE=function(){var a=this.stream.peekLine(),b=a.indexOf("]");if(b==-1)this.classes.push("comment"),this.mode="COMMENT";else{var c=a.substring(0,b);console.log("IMG",this.tokentext),this.classes.push("comment"),this.mode="COMMENT_IMAGE_END",this.pushLine();var d=document.createElement("img");d.title=c,d.style.verticalAlign="top",this.lineelement.appendChild(d),this.lineelement=d}},EdenUI.Highlight.prototype.COMMENT_BUTTON=function(){this.pushLine();var a=document.createElement("button");this.lineelement.appendChild(a),this.lineelement=a,a.contentEditable=!1,this.mode="COMMENT_BUTTON_CONTENT"},EdenUI.Highlight.prototype.COMMENT_BUTTON_CONTENT=function(){"]"==this.token?(this.classes.push("hidden-comment"),this.popLine(),this.popMode()):this.COMMENT()},EdenUI.Highlight.prototype.COMMENT_IMAGE_END=function(){var a=this.stream.peekLine(),b=a.indexOf(")");if(b==-1)this.classes.push("hidden-comment"),this.mode="COMMENT",this.popLine();else{var c=a.substring(0,b);this.tokentext+=c+")",this.stream.position+=b+1,this.classes.push("hidden-comment"),this.mode="COMMENT",this.lineelement.setAttribute("src",c.substring(1)),this.popLine()}},EdenUI.Highlight.prototype.COMMENT_ESCAPE=function(){this.popMode(),this.classes.push("comment")},EdenUI.Highlight.prototype.validHTMLTags={button:!0,span:!0,a:!0,img:!0,input:!0,table:!0,textarea:!0},EdenUI.Highlight.prototype.COMMENT_HTML=function(){var a=this.tokentext;if(!EdenUI.Highlight.prototype.validHTMLTags[a])return this.mode="COMMENT",void this.COMMENT();for(var b=this.stream.peekLine(),c=-1,d=!1,e=0,f=0;f"==b.charAt(f)){c=f;break; -}}else d=!d,e=b.charCodeAt(f);if(c>=0){var g="<"+a+b.substring(0,c+1);this.tokentext=g.substring(1),this.cacheddata={opentag:g,tagname:a},this.classes.push("hidden-comment"),this.mode="COMMENT_HTML_START",this.stream.position+=c+1}else this.classes.push("hidden-comment"),this.tokentext+=b.substring(0,b.length-1),this.stream.position+=b.length-1,this.mode="COMMENT"},EdenUI.Highlight.prototype.COMMENT_HTML_CONTENT=function(){if("<"!=this.token)this.COMMENT();else if(this.cacheddata){var a=this.stream.peekLine(),b="/"+this.cacheddata.tagname+">",c=a.indexOf(b);c==-1?this.classes.push("hidden-comment"):(this.cacheddata&&this.popLine(),this.tokentext+=b,this.stream.position+=c+b.length,this.classes.push("hidden-comment")),this.mode="COMMENT"}else this.mode="COMMENT"},EdenUI.Highlight.prototype.COMMENT_HTML_START=function(){if("<"!=this.token){var a=this.cacheddata.opentag+d;this.mode="COMMENT_HTML_CONTENT",this.pushLine();var b=$(a).get(0);"button"!=this.cacheddata.tagname&&"a"!=this.cacheddata.tagname||(b.contentEditable=!1),this.lineelement.appendChild(b),this.lineelement=b,this.COMMENT()}else{var c=this.stream.peekLine(),d="/"+this.cacheddata.tagname+">",e=c.indexOf(d);e==-1?this.classes.push("hidden-comment"):(this.cacheddata&&this.popLine(),this.tokentext+=d,this.stream.position+=e+d.length,this.classes.push("hidden-comment")),this.mode="COMMENT"}},EdenUI.Highlight.prototype.COMMENT_CODE=function(){"`"==this.token?(this.classes.push("hidden-comment"),this.popMode()):(this.classes.push("script"),this.START())},EdenUI.Highlight.prototype.COMMENT_ICON=function(){if("OBSERVABLE"==this.token){if("-"==this.stream.code.charAt(this.stream.position)){var a=this.stream.peekLine(),b=a.indexOf(":");if(b==-1)return this.classes.push("comment"),void this.popMode();var c=a.substring(0,b);this.tokentext+=c,this.stream.position+=c.length}var d=document.createElement("span");d.className="eden-comment-icon fa fa-"+this.tokentext,this.lineelement.appendChild(d),this.classes.push("hidden-comment")}else":"==this.token&&(this.classes.push("hidden-comment"),this.popMode())},EdenUI.Highlight.prototype.COMMENT_EMPH=function(){if("*"==this.token)this.mode="COMMENT_BOLD",this.classes.push("hidden-comment");else{var a=document.createElement("span");this.applyClasses(a,["comment-emph"]),this.lineelement.appendChild(a),this.pushLine(),this.lineelement=a,this.mode="COMMENT_ITALIC",this.COMMENT()}},EdenUI.Highlight.prototype.COMMENT_ITALIC=function(){"*"==this.token?(this.classes.push("hidden-comment"),this.popLine(),this.popMode()):this.COMMENT()},EdenUI.Highlight.prototype.COMMENT_BOLD=function(){if("*"==this.token)this.classes.push("hidden-comment"),this.popLine(),this.mode="COMMENT_BOLD_END";else{var a=document.createElement("span");this.applyClasses(a,["comment-bold"]),this.lineelement.appendChild(a),this.pushLine(),this.lineelement=a,this.mode="COMMENT_BOLD_END",this.COMMENT()}},EdenUI.Highlight.prototype.COMMENT_BOLD_END=function(){"*"==this.token?("*"==this.stream.code.charAt(this.stream.position)&&(this.classes.push("hidden-comment"),this.stream.position++,this.tokentext+="*"),this.popLine(),this.popMode()):this.COMMENT()},EdenUI.Highlight.prototype.COMMENT_TAG=function(){this.mode="END_COMMENT_TAG"},EdenUI.Highlight.prototype.END_COMMENT_TAG=function(){this.popLine(),this.mode="COMMENT",this.COMMENT()},EdenUI.Highlight.prototype.DOXY_COMMENT=function(){this.BLOCK_COMMENT()},EdenUI.ContextMenu=function(a){this.element=$('
'),this.origin=a,this.target=void 0,this.items=[],$(document.body).append(this.element);var b=this;this.element.on("mousedown",".eden-contextmenu-item",function(a){var c=parseInt(a.currentTarget.getAttribute("data-index"));b.items[c].action&&b.items[c].action(b.target)}),this.origin.oncontextmenu=function(a){b.target=a.target,"SPAN"==b.target.nodeName&&(b.target=b.target.parentNode);var c=document.body.scrollLeft+a.clientX;c+150>=screen.width&&(c-=c+150-screen.width),b.element.css("top",""+(document.body.scrollTop+a.clientY+10)+"px"),b.element.css("left",""+c+"px");for(var d=0;d'+a+""+b+"");e.get(0).setAttribute("data-index",""+this.items.length),this.element.append(e),this.items.push({status:c,action:d,element:e.get(0)})},EdenUI.ContextMenu.prototype.addSeparator=function(){var a=$('
');this.element.append(a)},EdenUI.ButtonBar=function(a){this.container=a,this.bar=$('
'),this.buttons={},this.container.appendChild(this.bar.get(0))},EdenUI.ButtonBar.prototype.addButton=function(a,b,c,d){var e=$('");this.bar.find(".buttonsDiv").append(e),e.get(0).onclick=d,this.buttons[a]=e},EdenUI.ButtonBar.prototype.enableButton=function(a){this.buttons[a]&&this.buttons[a].addClass("control-enabled")},EdenUI.ButtonBar.prototype.disableButton=function(a){this.buttons[a]&&this.buttons[a].removeClass("control-enabled")},EdenUI.Tabs=function(a){this.tabs=a,this.scrollix=0,this.maxtabs=3},EdenUI.Tabs.prototype.build=function(a,b){for(;this.tabs.firstChild;)this.tabs.removeChild(this.tabs.firstChild);var c=document.createElement("div");c.className="agent-tableft noselect",this.tabs.appendChild(c);var d=document.createElement("div");if(d.className="agent-tab-container",this.tabs.appendChild(d),a&&a instanceof Array){var e=-1;b&&(e=a.indexOf(b)),e>this.scrollix+(this.maxtabs-1)&&(this.scrollix=e-(this.maxtabs-1)),e18&&(h="..."+h.slice(-15));var i;i=Eden.Agent.agents[b]?Eden.Agent.agents[b].hasErrors()?"tab-icon errored":Eden.Agent.agents[b].executed?"tab-icon executed":"tab-icon":"tab-icon noagent",f.className=g,f.innerHTML=""+h,f.draggable=!0,f.setAttribute("data-name",b),a.appendChild(f)},EdenUI.MenuBar=function(){function a(){$(".menubar-menu").hide(),t=!1;var a=$("#menubar-mainitem-views");a.children().css("display","")}function b(a){var b=$("#menubar-mainitem-"+a);b.show(),u=a,t=!0,"sharebox"==a&&o.sharebox.show()}function c(){var a=$("#menubar-mainitem-existing-views");Object.keys&&0===Object.keys(edenUI.activeDialogs).length&&a.html('')}function d(b){a();var c=edenUI.eden.root,d=c.lookup("mouseFollow").value(),e=c.lookup("views_number_created"),f=e.value()+1;e.assign(f,c.scope,Symbol.hciAgent,!0);var g=this.view,h=g.toLowerCase()+f;d?edenUI.eden.execute('createView("'+h+'", "'+g+'");'):edenUI.createView(h,g),o.updateViewsMenu()}function e(b){var d=this.parentNode.viewname;edenUI.viewInstances[d].confirmClose&&a(),edenUI.destroyView(d),c()}function f(a){var b=a.currentTarget.children[0],c=this.parentNode.viewname;edenUI.viewInstances[c].pinned?(edenUI.unpinView(c),b.src=n):(edenUI.pinView(c),b.src=m)}function g(a){for(var b=$(""),c=0;c'+b+"")}function i(a){return $("")}function j(b){return{mouseover:function(a){edenUI.highlightView(b,!0)},mouseout:function(a){edenUI.stopHighlightingView(b,!0,!1)},click:function(c){edenUI.stopHighlightingView(b,!0,!0),a()}}}function k(a){return a&&"false"!=a?'checked="checked"':""}function l(a,b,c,d){var e=edenUI.getOptionValue(a);null===e&&(e=c);var f=h("menubar-item-input",'"),i=f.get(0).children[0],j=h("menubar-item-label",b),l=g([f,j]);l.click(function(b){b.target!=i&&(i.checked=!i.checked),edenUI.setOptionValue(a,i.checked)}),edenUI.listenTo("optionChange",void 0,function(b,c){if(b==a){var e="true"===c;i.checked=e,d&&d(a,e)}}),l.appendTo(v)}var m="images/pin.png",n="images/pin-greyed.png",o=this;this.itemViews={};var p=$('');p.html(''),p.hide(),Eden.AST&&eden.execute2("views_number_created = 0;",Symbol.defaultAgent),this.element=$('"),$(document.body).append(this.element);var q=this.element.find("#menubar-login"),r=new EdenUI.ContextMenu(q.get(0));r.addItem("","Log out",function(){return Eden.DB.isLoggedIn()},function(){Eden.DB.logOut(function(){$("#menubar-login").html('Login')})}),edenUI.listenTo("loadPlugin",this,function(a,b){this.updateViewsMenu()}),edenUI.listenTo("createView",this,function(a,b){this.updateViewsMenu()}),edenUI.listenTo("destroyView",this,function(a){$(this.itemViews[a]).remove(),delete this.itemViews[a],c()}),Eden.DB.listenTo("connected",this,function(a){$("#menubar-login").html('Sign-in')}),Eden.DB.listenTo("disconnected",this,function(){$("#menubar-login").html('Not Connected')}),Eden.DB.listenTo("login",this,function(a){a&&(setTimeout(function(){$("#menubar-obscurer").remove()},1e3),$("#menubar-login").html(''+a+""))});var o=this;if($("#menubar-login").click(function(){o.showLogin()}),this.showLogin=function(){Eden.DB.isConnected()&&!Eden.DB.isLoggedIn()?(p.show(),$(document.body).append(p),p.find("iframe").attr("src",Eden.DB.remoteURL+"/login"),p.on("click",".button-cancel",function(){p.remove()})):Eden.DB.isConnected()&&Eden.DB.isLoggedIn()},mobilecheck()){var s=new EdenUI.ContextMenu(this.element.find(".mobilemore").get(0));s.addItem("","Share",!0,function(a){o.script.stickAll()}),s.addItem("","New Script View",!0,function(a){o.script.unstickAll()}),s.addItem("","New Observable Lists",!0,function(a){o.script.clearUnstuck()}),s.addItem("","New Graphic View",!0,function(a){o.script.activateAll()}),this.element.on("click",".mobilemore",function(a){o.element.find(".mobilemore").get(0).oncontextmenu(a)})}Eden.AST&&(this.sharebox=new EdenUI.Sharebox(this.element.find("#menubar-mainitem-sharebox")),this.element.on("click",".menubar-button.share",function(a){a.currentTarget===a.target&&o.sharebox.update()}),this.searchbox=new EdenUI.SearchBox(this.element.find("#menubar-searchresults")),this.element.on("keyup",".search",function(a){o.searchbox.updateSearch(a.currentTarget.value)}),this.element.on("focus",".search",function(a){o.searchbox.updateSearch(a.currentTarget.value)}));var t=!1,u=void 0;$(document.body).on("mousedown",function(){a(),o.searchbox&&o.searchbox.element.hide()}),this.element.on("mousedown",".menubar-search-outer",function(a){a.stopPropagation()}),this.element.on("mousedown",".menubar-button.main",function(c){var d=c.currentTarget.getAttribute("data-obs");t&&c.target===this?d==u?a():(a(),b(d)):b(d),o.searchbox&&o.searchbox.element.hide(),c.stopPropagation()}),this.element.on("mouseenter",".menubar-button.main",function(a){}),this.updateViewsMenu=function(){var a=$("#menubar-mainitem-views"),b=$("#menubar-mainitem-existing");a.html("");var k=$(''),l=k[0],p=$('');p.append(k);var q=$("");q.append(p),l.search=function(){var b,c=l.value,d=new RegExp("(^|\\s)"+c,"i"),e=!1;a.children().each(function(a,f){if(!f.classList.contains("menubar-item-search")){var g=f.children[0],h=g.innerHTML,i=g.classList.contains("menubar-item-separator");i?(c.length>1&&(e=d.test(h)),b=f,e?f.style.display="":f.style.display="none"):e?f.style.display="":d.test(h)?(f.style.display="",b.style.display=""):f.style.display="none"}})},k.on("input",l.search);var r,s,t,u,v,w,x=[];for(s in edenUI.views){var y=edenUI.views[s],z=y.title,A=y.category.getLabel(),B=y.category.getMenuPriority(),C=y.menuPriority;u=h("menubar-item-fullwidth menubar-view",z),t=g([u]),t[0].view=s,t.click(d),x.push({title:z,viewEntry:t,categoryLabel:A,categoryPriority:B,itemPriority:C})}x=x.sort(function(a,b){if(a.categoryPriority!=b.categoryPriority)return a.categoryPriority-b.categoryPriority;if(void 0!==a.itemPriority){if(void 0===b.itemPriority)return-1;if(a.itemPriority!=b.itemPriority)return a.itemPriority-b.itemPriority}else if(void 0!==b.itemPriority)return 1;return a.title>b.title?1:a.title['+r+"]"),u.click(I.click);var J;J=edenUI.viewInstances[r].pinned?m:n,v=h("menubar-item-pin",''),v.click(f),w=h("menubar-item-close",''),w.click(e),t=g([u,v,w]),t.bind("mouseover",I.mouseover),t.bind("mouseout",I.mouseout),t[0].viewname=r,t.appendTo(b),o.itemViews[r]=t[0]}},this.updateViewsMenu();var v=$("#menubar-mainitem-options");l("optConfirmUnload",Language.ui.menu_bar.opt_confirm,!0,function(a,b){b?window.addEventListener("beforeunload",confirmUnload):window.removeEventListener("beforeunload",confirmUnload)}),l("optSimpleWildcards",Language.ui.menu_bar.opt_simple_search,!0),l("optHideOnMinimize",Language.ui.menu_bar.opt_hide,!1),l("optCollapseToTitleBar",Language.ui.menu_bar.opt_collapse,!1,function(a,b){var c;c=b?"collapse":"maximize",$(".ui-dialog-content").each(function(){$(this).dialogExtend("option","dblclick",c)})}),l("developer",Language.ui.menu_bar.opt_debug,!1,function(b,c){var d;d=c?"/index-dev.html":"/index.html";var e=document.location.pathname;d=e.slice(0,e.lastIndexOf("/"))+d,d!=document.location.pathname?(a(),edenUI.modalDialog("Restart Required","

JS-EDEN must be restarted for this change to fully take effect. Would you like to restart JS-EDEN now?

",["Restart Now","Restart Later"],1,function(a){if(0==a)window.onbeforeunload=void 0,document.location.pathname=d;else if(1==a)root.lookup("debug").mutate(root.scope,function(a){a.cache.value.jsExceptions=c},Symbol.hciAgent);else{var b=document.getElementById("menu-developer");b.checked=!b.checked,edenUI.setOptionValue("developer",b.checked)}})):root.lookup("debug").mutate(root.scope,function(a){a.cache.value.jsExceptions=c},Symbol.hciAgent)}),this.element.on("keyup",".jseden-title",function(a){try{window.localStorage&&window.localStorage.setItem("title",a.currentTarget.textContent)}catch(a){}}),eden.root.lookup("jseden_project_title").addJSObserver("menubar",function(a,b){if(a.origin&&a.origin!==Symbol.hciAgent){var c=$(".jseden-title").get(0);c.contentEditable=!0,c.textContent=b,document.title=b}try{window.localStorage&&window.localStorage.setItem("title",b)}catch(d){}}),eden.root.lookup("jseden_maker").addJSObserver("menubar",function(a,b){b?o.element.find(".maker").addClass("active"):o.element.find(".maker").removeClass("active")}),eden.root.lookup("jseden_menu_showsearch").addJSObserver("menubar",function(a,b){b?o.element.find(".menusearch").show():o.element.find(".menusearch").hide()}),eden.root.lookup("jseden_menu_showshare").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.share").show():o.element.find(".menubar-button.share").hide()}),eden.root.lookup("jseden_menu_showcreate").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.create").show():o.element.find(".menubar-button.create").hide()}),eden.root.lookup("jseden_menu_showexisting").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.existing").show():o.element.find(".menubar-button.existing").hide()}),eden.root.lookup("jseden_menu_showsettings").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.settings").show():o.element.find(".menubar-button.settings").hide()}),eden.root.lookup("jseden_menu_showhelp").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.help").show():o.element.find(".menubar-button.help").hide()}),eden.root.lookup("jseden_project_subtitle").addJSObserver("menubar",function(a,b){}),this.notifications=new EdenUI.Notifications(this.element.find("#menubar-mainitem-notifications"),this.element.find(".menubar-notification-jewel")),this.element.on("click",".notifications",function(a){o.notifications.clearCount()}),this.element.on("click",".maker",function(a){var b=eden.root.lookup("jseden_maker");if(!b.eden_definition){var c=b.value();void 0===c&&(c=!1),b.assign(!c,eden.root.scope,Symbol.localJSAgent)}}),this.element.on("keyup",".jseden-title",function(a){var b=eden.root.lookup("jseden_project_title");b.definition||b.assign(a.currentTarget.textContent,eden.root.scope,Symbol.hciAgent)})},EdenUI.MenuBar.prototype.hide=function(){this.element.hide()},EdenUI.MenuBar.prototype.show=function(){this.element.show()},EdenUI.MenuBar.reset=function(){$(".jseden-title").html("CONSTRUIT")},EdenUI.MenuBar.saveTitle=function(a){eden.root.lookup("jseden_project_title").assign(a,eden.root.scope,Symbol.jsAgent)},EdenUI.Dialogs={},EdenUI.Dialogs.MergeError=function(a,b,c){var d=new diff_match_patch,e=d.diff_main(a,b);d.diff_cleanupSemantic(e);var f=d.diff_prettyHtml(e),g=$('
'+f+"
");g.dialog({resizable:!0,height:"auto",width:600,modal:!0,buttons:{"Use Mine":function(){c&&c("old"),$(this).dialog("close")},"Use New":function(){c&&c("new"),$(this).dialog("close")},Merge:function(){c&&c("merge"),$(this).dialog("close")}}})},EdenUI.Notifications=function(a,b){function c(a,b){if(b){var c=("runtime"==b.type?"Runtime error":"Syntax error")+" in "+a.name+":"+(b.line!=-1?b.line:"")+" -> "+b.messageText(),e="'+a.name+":"+(b.line!=-1?b.line+1:"")+" "+b.messageText();if(!a.owned||"syntax"!=b.type){console.error(c);var f=$('
'+e+"
\n\n");f.on("click",function(){var a="";if(!b.statement||"definition"!=b.statement.type&&"assignment"!=b.statement.type||(a+=" Symbol: "+b.statement.lvalue.name+"\n"),b.lastsymbol&&(a+=" Related Symbol: "+b.lastsymbol+"\n"),String(b.extra).search("SyntaxError")>=0)a+=" JavaScript: "+b.javascriptSource()+"\n",f.html(e+"\n"+a);else if(a+=" Source:
\n",f.html(e+"\n"+a),b.statement){var c=new Eden.AST(b.edenSource(),(void 0),Symbol.jsAgent),d=new EdenUI.Highlight(f.find(".error-source").get(0));d.highlight(c,-1,-1)}}),d.notification("error",f)}}}var d=this;this.notificationCount=0,this.notificationCountElement=b,this.notificationCountElement.hide(),this.notificationPanel=a,this.notificationPanel.html('
'),this.notificationPanel.on("click",".close-button",function(){d.notificationPanel.hide()}).on("click",".clear-button",function(){d.notificationPanel.find("#errors-dialog").html("")}),this.notificationPanel.hide(),this.notificationContent=this.notificationPanel.find("#errors-dialog"),Eden.Peer.listenTo("user",void 0,function(a,b){d.notification("net",$('
User \'"+b+"' connected to you.
Watch Broadcast Collaborate
"))}),Eden.Peer.listenTo("share",void 0,function(a,b){d.notification("net",$('
Your model is being shared...
'))}),Eden.Peer.listenTo("disconnect",void 0,function(a,b){b?d.notification("net",$('
User \''+b+"' disconnected.
")):d.notification("net",$('
P2P User disconnected.
'))}),Eden.Peer.listenTo("error",void 0,function(a){d.notification("error",$('
P2P: '+a+"
"))}),Eden.Fragment&&(Eden.Fragment.listenTo("error",void 0,c),eden.listenTo("error",void 0,c),Eden.Fragment.listenTo("warning",void 0,function(a,b){if(b){var c=(("runtime"==b.type?"Runtime warning":"Syntax warning")+" in "+a.name+":"+(b.line!=-1?b.line:"")+" -> "+b.messageText(),"'+a.name+":"+(b.line!=-1?b.line+1:"")+" "+b.messageText());if(!a.owned||"syntax"!=b.type){var e=$('
'+c+"
\n\n");e.on("click",function(){var a="";if(!b.statement||"definition"!=b.statement.type&&"assignment"!=b.statement.type||(a+=" Symbol: "+b.statement.lvalue.name+"\n"),b.lastsymbol&&(a+=" Related Symbol: "+b.lastsymbol+"\n"),String(b.extra).search("SyntaxError")>=0)a+=" JavaScript: "+b.javascriptSource()+"\n",e.html(c+"\n"+a);else if(a+=" Source:
\n",e.html(c+"\n"+a),b.statement){var d=new Eden.AST(b.edenSource(),(void 0),Symbol.jsAgent),f=new EdenUI.Highlight(e.find(".error-source").get(0));f.highlight(d,-1,-1)}}),d.notification("warning",e)}}})),Eden.DB.listenTo("disconnected",this,function(){d.notification("info",$('
Disconnected from project server
'))}),Eden.DB.listenTo("error",this,function(a){d.notification("error",$('
'+a+"
"))})},EdenUI.Notifications.prototype.notification=function(a,b){this.notificationCount++,this.notificationCountElement.html(this.notificationCount),this.notificationCountElement.show();var c;if("error"==a)c=$('
'),c.append($('
'));else{var d,e="#777";switch(a){case"net":d="";break;case"comment":d="";break;case"log":d="";break;case"warning":d="",e="#f57900";break;case"info":default:d="",e="#29454B"}c=$('
'),c.append($('
'+d+"
"))}"string"==typeof b?c.append($('
'+b+"
")):c.append(b),this.notificationContent.prepend(c),this.notificationContent.prop("scrollTop",0)},EdenUI.Notifications.prototype.clearCount=function(){this.notificationCountElement.hide(),this.notificationCount=0},EdenUI.Sharebox=function(a){var b=this;this.title=void 0,this.visible=!1,this.sharebox=a,this.sharebox.html('');var c=this.sharebox.find("#projectoptions");this.markdown=new EdenUI.Markdown(""),c.get(0).appendChild(this.markdown.contents),this.sharebox.on("change","#thumbfile",function(a){var c=b.sharebox.find("#projectthumb"),d=$("#thumbfile");c.html("");var e=d.get(0),f=e.files[0],g=new FileReader;g.onload=function(a){var d=document.createElement("canvas");d.setAttribute("width","200"),d.setAttribute("height","112");var e=d.getContext("2d"),f=new Image;f.onload=function(){var a,g,h,i,j=f.width,k=f.height,l=200,m=112,n=j/k,o=l/m;no?(g=l,a=k*(g/j),h=0,i=(m-a)/2):(a=m,g=l,h=0,i=0),e.drawImage(f,h,i,g,a);var p=d.toDataURL("image/png");b.thumbdata=p,c.get(0).childNodes[0].src=p},f.src=a.target.result},g.readAsDataURL(f)}),this.sharebox.on("click",".upload",function(a){var c=b.title.textContent,d=b.markdown.intextarea.value,e=$("#listpublic").get(0).checked;return"New Project"==c?void b.sharebox.find("#projectuploadbox").html('Please give your project a name by editing the "New Project" title in the top left.'):(b.sharebox.find("#projectuploadbox").html('Saved to your projects and shared at:
Saving...
'),eden.project.thumb=b.thumbdata,eden.project.setDescription(d),console.log("SAVE",e,d),void eden.project.save(e,function(a){if(a){var c="?load="+eden.project.id+"&vid="+eden.project.vid+"&r="+eden.project.readPassword;window.history.replaceState({id:eden.project.id,vid:eden.project.vid},"",c),b.sharebox.find(".projecturl").html('
'+window.location.href+'
');var d=document.createRange();d.selectNodeContents(b.sharebox.find(".projecturl").get(0));var e=window.getSelection();e.removeAllRanges(),e.addRange(d)}else b.sharebox.find(".projecturl").html("Save failed, not logged in.")}))}),this.sharebox.on("click",".fork",function(a){var c=b.title.textContent,d=b.markdown.intextarea.value,e=$("#listpublic").get(0).checked;return"New Project"==c?void b.sharebox.find("#projectuploadbox").html('Please give your project a name by editing the "New Project" title in the top left.'):(b.sharebox.find("#projectuploadbox").html('Saved to your projects and shared at:
Saving...
'),eden.project.thumb=b.thumbdata,eden.project.id&&(eden.project.parentid=eden.project.id),eden.project.id=void 0,eden.project.vid=void 0,eden.project.setDescription(d),console.log("FORK",e,d),void eden.project.save(e,function(a){if(a){var c="?load="+eden.project.id+"&vid="+eden.project.vid;window.history.replaceState({id:eden.project.id,vid:eden.project.vid},"",c),b.sharebox.find(".projecturl").html('
'+window.location.href+'
');var d=document.createRange();d.selectNodeContents(b.sharebox.find(".projecturl").get(0));var e=window.getSelection();e.removeAllRanges(),e.addRange(d)}else b.sharebox.find(".projecturl").html("Save failed, not logged in.")}))})},EdenUI.Sharebox.prototype.show=function(){this.visible||this.update(),this.visible=!0},EdenUI.Sharebox.prototype.hide=function(){this.visible=!1},EdenUI.Sharebox.prototype.update=function(){var a=this;void 0===a.title&&(a.title=$(document).find(".jseden-title").get(0));var b=a.title.textContent;Eden.DB.isLoggedIn()?(eden.project.authorid!=Eden.DB.userid&&eden.project.authorid!=-1?a.sharebox.find("#projectuploadbox").html('
List publically
Thumbnail:
'):a.sharebox.find("#projectuploadbox").html('
List publically
'),a.sharebox.find("#projectoptions").show()):(a.sharebox.find("#projectuploadbox").html('
'),a.sharebox.find("#projectoptions").hide());var c=this.sharebox.find("#projectthumb");this.thumbdata=void 0,this.thumbimg=$(""),this.thumbimg.get(0).style.border="1px solid #aaa",this.thumbimg.get(0).style.marginRight="10px",c.append(this.thumbimg),eden.project.thumb?(a.thumbdata=eden.project.thumb,a.thumbimg.get(0).src=eden.project.thumb):a.thumbdata=void 0,void 0===eden.project.id&&(eden.project.tags=(eden.project.title.toLowerCase()+" "+(Eden.DB.isLoggedIn()?Eden.DB.username.toLowerCase():"")).split(" ")),a.markdown.setValue(eden.project.getDescription()),a.projectsource=eden.project.generate();var d="data:application/octet-stream,"+encodeURIComponent(a.projectsource);a.sharebox.find(".downloadurl").html('File')},EdenUI.SearchBox=function(a){var b=this;this.element=a,a.on("click",".menubar-search-result",function(a){var c=a.currentTarget.getAttribute("data-id");c&&""!=c?b.updateSymbolDetails(a.currentTarget,c):script&&""!=script; -}),a.on("click",".edit-result",function(a){}),a.on("click",".script-goto",function(a){var c=a.currentTarget.parentNode.parentNode.parentNode.getAttribute("data-id");b.element.hide(),Eden.Selectors.goto("@external "+c)}),a.on("click",".script-import",function(a){var c=a.currentTarget.parentNode.parentNode.parentNode.getAttribute("data-id");Eden.Selectors.query(c,void 0,{minimum:1,options:{external:!0,index:!0}},function(d){c&&""!=c&&(a.currentTarget.parentNode.parentNode.parentNode.setAttribute("data-imported","true"),b.updateSymbolDetails(a.currentTarget.parentNode.parentNode.parentNode,c))})})},EdenUI.SearchBox.prototype.updateSymbolDetails=function(a,b){console.log("Update details",b);var c=(a.getAttribute("data-imported"),a.getAttribute("data-remote"));Eden.Selectors.query("@history "+b,"id,path,source,type,value,active,tags,rawcomment,historic",{minimum:1,options:{external:!0}},function(b){if(0==b.length)return void console.log("No result");b=b[0];var d=(b[0],b[1]),e=b[2],f=b[3],g=b[4],h=b[5],i=(b[6],b[7]),j=b[8];i&&(i=new Eden.AST.DoxyComment(i));var k=$(a).find(".doxy-search-details");null!==k&&0!=k.length||(k=$('
'),a.appendChild(k.get(0))),k=k.get(0),"assignment"!=f&&"definition"!=f||(symstr=e,""==a.firstChild.className?a.firstChild.innerHTML=EdenUI.Highlight.html(symstr):a.childNodes[1].innerHTML=EdenUI.Highlight.html(symstr));var l="";if(j?l="":"true"==c?(l+="

",l+='

'):l='

',i){var m=i.pretty();m&&m.length>0&&(l+=m)}h?(l+="

",l+="Path: "+d+"
",l+="Current Value: "+Eden.edenCodeForValue(g),l+="

"):(l+="

",l+="Path: "+d+"",l+="

"),k.innerHTML=l})},EdenUI.SearchBox.prototype.makeStatementResult=function(a){var b,c="",d="",e="",f=!0;a.executed==-1&&(d=" historic");var g=a.getOrigin();"script"==a.type?(g&&g.remote?(e+=' data-remote="true"',a.indexed&&(e+=' data-imported="true"'),c=''):c='',b=a.doxyComment&&a.doxyComment.getProperty("title")?a.doxyComment.getProperty("title")[0]:a.name?"action "+a.name:a.getInnerSource()):"when"==a.type?(a.enabled&&(c=''),b=a.prefix.trim()):(a.lvalue&&eden.root.symbols[a.lvalue.name]&&eden.root.symbols[a.lvalue.name].origin&&eden.root.symbols[a.lvalue.name].origin.id==a.id&&(c=''),a.getSource()||console.error("NO SOURCE",a),b=a.getSource().split("\n")[0]),f&&(b.length>55&&(b=b.substr(0,55)+"..."),b=EdenUI.Highlight.html(b));var h="";if(a.doxyComment){var i=a.doxyComment.brief();i&&i.length>0&&(h='

'+i+"

")}var j=$('");return j},EdenUI.SearchBox.prototype.makeScriptResult=function(a){},EdenUI.SearchBox.prototype.updateSearch=function(a){if(a&&""!=a){this.element.show();var b=this;Eden.Selectors.query(a,void 0,{minimum:1,options:{external:!0}},function(a){function c(){var d=$('');e.append(d),d.on("click",function(){e.html("");for(var d=0;fg);f++){d++;var h;h=a[f]instanceof Symbol?b.makeSymbolResult(a[f]):b.makeStatementResult(a[f]),e.append(h)}f
'),e=$('');d.append(e),b.element.append(d);var f=0,g=8,h=0;for(f=0;f=g)break;h++;var i;i=b.makeStatementResult(a[f]),e.append(i)}f=q.ast.script.end)return q.history.push(q.ast.stream.code),q.historyindex=q.history.length,window.localStorage&&window.localStorage.setItem("console_history",JSON.stringify(q.history)),$(q.outdiv).find(".fake-caret").remove(),q.$codearea.append($('
'+q.outdiv.innerHTML+"
")),q.ast.execute(EdenUI.ScriptBox.consoleAgent,function(){void 0!==q.ast.lastresult&&(console.log("Result",q.ast.lastresult),q.$codearea.append($('
'+EdenUI.Highlight.html(Eden.edenCodeForValue(q.ast.lastresult))+"
")))}),q.inputhider.scrollTop=q.inputhider.scrollHeight,q.setSource(""),void a.preventDefault();if(a.altKey)187==a.keyCode||61==a.keyCode?a.preventDefault():189==a.keyCode||173==a.keyCode?a.preventDefault():48==a.keyCode&&a.preventDefault();else if(a.ctrlKey||17==a.keyCode||16==a.keyCode){if(a.ctrlKey)if(a.shiftKey){if(37==a.keyCode||38==a.keyCode||39==a.keyCode||40==a.keyCode||36==a.keyCode||35==a.keyCode)return q.setCaretToFakeCaret(),void q.outdiv.focus()}else 38===a.keyCode?onPrevious():40===a.keyCode?onNext():86===a.keyCode||65===a.keyCode&&(a.preventDefault(),q.outdiv.focus())}else if(9==a.keyCode){a.preventDefault();var b=q.intextarea.selectionStart,c=q.intextarea.selectionEnd;q.intextarea.value=q.intextarea.value.substring(0,b)+"\t"+q.intextarea.value.substring(c),q.intextarea.selectionStart=q.intextarea.selectionEnd=b+1,q.rebuild()}else if(37==a.keyCode||38==a.keyCode||39==a.keyCode||40==a.keyCode||36==a.keyCode||35==a.keyCode){if(a.shiftKey)return q.setCaretToFakeCaret(),void q.outdiv.focus();38==a.keyCode?q.historyindex>0&&(q.historyindex--,q.setSource(q.history[q.historyindex]),a.preventDefault()):40==a.keyCode&&(q.historyindex=0?changeClass(a.currentTarget,"stuck",!1):changeClass(a.currentTarget,"stuck",!0)}function o(a){if(q.dragline==-1&&(void 0===q.outdiv||a.currentTarget!==q.outdiv.parentNode)){var b=parseInt(a.currentTarget.getAttribute("data-statement"));q.moveTo(b)}}function p(a){var b=a.currentTarget.parentNode.parentNode,c=parseInt(b.getAttribute("data-statement"));b.removeChild(q.valuedivs[c][0]),delete q.valuedivs[c]}this.changeCB=void 0,this.outer=a,this.savecb=void 0,this.contents=$(this.outer),this.contents.html('
'),this.currentstatement=void 0,this.statements={},this.$codearea=this.contents.find(".scriptbox-codearea"),this.codearea=this.$codearea.get(0),this.intextarea=this.contents.find(".hidden-textarea").get(0),this.inputhider=this.contents.find(".scriptbox-inputhider").get(0),this.outdiv=this.contents.find(".scriptbox-output").get(0),this.$codearea.sortable({revert:100,handle:".grippy",distance:10,axis:"y",scroll:!1}),this.infobox=this.contents.find(".info-bar").get(0),this.outputbox=this.contents.find(".scriptbox-outputbox").get(0),this.suggestions=this.contents.find(".eden_suggestions"),this.suggestions.hide(),$(this.infobox).hide(),this.highlighter=new EdenUI.Highlight(this.outdiv),this.enable(),this.ast=void 0,this.refreshentire=!0,this.dirty=!0,this.rebuildtimer=void 0,this.rebuildtimeout=10,this.currentlineno=1,this.currentcharno=0,this.dragint=!1,this.dragline=-1,this.dragvalue=0,this.draglast=0,this.history=void 0,window.localStorage?this.history=JSON.parse(window.localStorage.getItem("console_history"))||[]:this.history=[],this.historyindex=this.history.length;var q=this;this.contents.on("input",".hidden-textarea",c).on("keydown",".hidden-textarea",d).on("keyup",".hidden-textarea",f).on("paste",".hidden-textarea",e).on("keydown",".scriptbox-output",g).on("keyup",".scriptbox-output",i).on("paste",".scriptbox-output",h).on("blur",".hidden-textarea",j).on("focus",".hidden-textarea",k).on("mouseup",".scriptbox-output",l).on("click",".scriptbox-gutter",m).on("click",".scriptbox-sticky",n).on("click",".scriptbox-valueclose",p).on("mousedown",".scriptbox-statement",o),this.setSource(""),setInterval(function(){for(var a in q.valuedivs){var b=Eden.Statement.statements[a];if(b){var c=EdenUI.htmlForStatement(b,30,30);b.isActive();q.valuedivs[a].innerHTML='
'+c+"
"}}},200)},EdenUI.ScriptBox.consoleAgent={local:!1,name:"*Console"},EdenUI.ScriptBox.prototype.focus=function(){if(this.outdiv.focus(),document.activeElement===this.outdiv){var a=this.intextarea.value.length,b=this.currentlineno;this.intextarea.focus(),this.intextarea.selectionEnd=a,this.intextarea.selectionStart=a,this.ast&&(this.highlighter.highlight(this.ast,b,a),this.updateLineCachedHighlight())}},EdenUI.ScriptBox.prototype.setCaretToFakeCaret=function(){var a=$(this.outdiv).find(".fake-caret").get(0),b=document.createRange(),c=window.getSelection();a.nextSibling&&(a=a.nextSibling),b.setStart(a,0),b.collapse(!0),c.removeAllRanges(),c.addRange(b),$(this.outdiv).remove(".fake-caret")},EdenUI.ScriptBox.prototype.setChangeCB=function(a){this.savecb=a},EdenUI.ScriptBox.prototype.hideInfoBox=function(){$(this.infobox).hide("fast")},EdenUI.ScriptBox.prototype.showInfoBox=function(a,b,c,d){console.log("SHOW INFO BOX "+d),"warning"==c?this.infobox.innerHTML="
"+d+"
":"error"==c&&(this.infobox.innerHTML="
"+d+"
");var e=$(this.infobox);e.css("top",""+b+"px"),e.css("left",""+a+"px"),$(this.infobox).show()},EdenUI.ScriptBox.prototype.disable=function(){if(this.outdiv){changeClass(this.outdiv,"goto",!1),this.valuedivs[this.currentstatement]=this.outdiv;var a=EdenUI.htmlForStatement(Eden.Statement.statements[this.currentstatement],30,30);this.valuedivs[this.currentstatement].innerHTML='
'+a+"
",changeClass(this.outdiv.parentNode,"readonly",!0),this.ast}},EdenUI.ScriptBox.prototype.enable=function(){this.outdiv&&(this.outdiv.contentEditable=!0,changeClass(this.outdiv.parentNode,"readonly",!1),this.ast&&this.highlighter.highlight(this.ast,-1,-1))},EdenUI.ScriptBox.prototype.setSource=function(a){this.intextarea.value=a,this.ast=new Eden.AST(a,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),this.highlightContent(this.ast,-1,0),this.intextarea.focus(),this.ast.script&&0==this.ast.script.errors.length?changeClass(this.outdiv.parentNode,"error",!1):""==a?changeClass(this.outdiv.parentNode,"error",!1):changeClass(this.outdiv.parentNode,"error",!0),this.outdiv.contentEditable=!0},EdenUI.ScriptBox.prototype.updateLineHighlight=function(){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.ast=new Eden.AST(this.intextarea.value,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),this.highlighter.ast=this.ast,this.runScript(a),this.highlightContent(this.ast,a,b),this.ast.script&&0==this.ast.script.errors.length?changeClass(this.outdiv.parentNode,"error",!1):changeClass(this.outdiv.parentNode,"error",!0)},EdenUI.ScriptBox.prototype.updateLineCachedHighlight=function(){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.highlightContent(this.ast,a,b)},EdenUI.ScriptBox.prototype.updateEntireHighlight=function(a){this.ast=new Eden.AST(this.intextarea.value,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),this.highlighter.ast=this.ast;var b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd),a&&this.runScript(0),this.highlightContent(this.ast,-1,b),this.ast.script&&0==this.ast.script.errors.length||console.log("indicated error")},EdenUI.ScriptBox.prototype.highlightContent=function(a,b,c){if(this.highlighter.highlight(a,b,c),a.mainDoxyComment&&(b==-1||b>=1&&b<=a.mainDoxyComment.endline)){var d=a.mainDoxyComment.content.match(/@[a-z]+.*\n/gi);if(d)for(var e=0;e=0){d[e].substring(0,f),d[e].substr(f).trim()}}}document.activeElement!==this.intextarea&&$(this.outdiv).find(".fake-caret").addClass("fake-blur-caret");var g=this;$(this.outdiv).find(".eden-number").draggable({helper:function(a){return $("
")},axis:"x",distance:5,drag:function(a,b){var c;if(g.dragint?c=Math.round(g.dragvalue+(b.position.left-g.dragstart)/2):(c=g.dragvalue+.005*(b.position.left-g.dragstart),c=c.toFixed(4)),c!=g.draglast){g.draglast=c,a.target.innerHTML=""+c;var d=a.target.parentNode.textContent;"\n"==d.charAt(d.length-1)&&(d=d.slice(0,-1)),g.replaceLine(g.dragline,d),g.ast=new Eden.AST(g.intextarea.value,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),g.highlighter.ast=g.ast,g.highlightContent(g.ast,g.dragline,-1),Eden.Statement.statements[g.currentstatement].setSource(g.intextarea.value,g.ast)}},start:function(a,b){g.edited=!0,g.dragline=g.findElementLineNumber(a.target),g.dragstart=b.position.left;var c=a.target.textContent;c.indexOf(".")==-1?(g.dragvalue=parseInt(c),g.dragint=!0):(g.dragvalue=parseFloat(c),g.dragint=!1),g.draglast=g.dragvalue,$(a.target).addClass("eden-select"),$(g.outdiv).css("cursor","ew-resize")},stop:function(a,b){$(a.target).removeClass("eden-select"),$(g.outdiv).css("cursor","text"),g.dragline=-1},cursor:"move",cursorAt:{top:-5,left:-5}}).click(function(){$(this).draggable({disabled:!0})}).blur(function(){$(this).draggable({disabled:!1})})},EdenUI.ScriptBox.prototype.clear=function(){this.$codearea.html(""),this.setSource("")},EdenUI.ScriptBox.prototype.getLineNumber=function(a){var b=a.value.substr(0,a.selectionStart).split("\n");return this.currentlineno=b.length,this.currentcharno=b[b.length-1].length,this.currentlineno},EdenUI.ScriptBox.prototype.doRebuild=function(){this.refreshentire?(this.updateEntireHighlight(),this.refreshentire=!1):this.updateLineHighlight()},EdenUI.ScriptBox.prototype.runScript=function(a){},EdenUI.ScriptBox.prototype.rebuild=function(){clearTimeout(this.rebuildtimer);var a=this;this.rebuildtimer=setTimeout(function(){a.doRebuild()},this.rebuildinterval)},EdenUI.ScriptBox.prototype.findElementLineNumber=function(a){for(var b=a;b.parentNode!==this.outdiv;)b=b.parentNode;for(var c=0;c
\t
\t\t
State
\t\t\t
\t
\t\t
Script Input
\t\t\t
\t
'),$("#jseden-main").append(this.element),this.consoleele=this.element.find(".explore-console-code"),this.expscripts=this.element.find(".explore-script"),this.expstate=this.element.find(".explore-state"),this.element.resizable({handles:"w",stop:function(a,b){eden.root.lookup("jseden_explorer_width").assign(b.element[0].clientWidth+2,eden.root.scope,Symbol.localJSAgent)}}),eden.root.lookup("jseden_explorer_width").assign(this.element.get(0).clientWidth+2,eden.root.scope,Symbol.localJSAgent),this.console=new EdenUI.ScriptBox(this.consoleele.get(0),{nobuttons:!0}),this.state=new EdenUI.ExplorerState(this.expstate),this.element.on("click",".clear-button",function(b){a.console.clear()}),this.element.on("click",".explore-tab",function(b){var c=b.currentTarget.getAttribute("data-name"),d=a.element.find(".explore-tab-current");d.removeClass("explore-tab-current"),d.addClass("explore-tab-notcurrent"),changeClass(b.currentTarget,"explore-tab-current",!0),changeClass(b.currentTarget,"explore-tab-notcurrent",!1),"state"==c?(a.expstate.css("display","flex"),a.expscripts.css("display","none")):"scripts"==c&&(a.expstate.css("display","none"),a.expscripts.css("display","flex"))});var b=eden.root.lookup("jseden_explorer_enabled"),c=b.value();c?a.state.show():(this.enabled=!1,this.element.hide(),a.state.hide()),b.addJSObserver("explorer",function(b,c){a.enabled=c,c?eden.root.lookup("jseden_explorer_visible").value()&&(a.element.show(),a.state.show()):(a.element.hide(),a.state.hide(),a.capture=!1)});var d=eden.root.lookup("jseden_explorer_visible"),e=d.value();e?a.state.show():(this.element.hide(),a.state.hide()),d.addJSObserver("explorer",function(b,c){c&&a.enabled?(a.element.show(),a.state.show(),eden.root.lookup("jseden_explorer_width").assign(a.element.get(0).clientWidth+2,eden.root.scope,Symbol.localJSAgent)):(a.element.hide(),a.state.capture=!1,a.state.clear(),a.state.hide(),eden.root.lookup("jseden_explorer_width").assign(0,eden.root.scope,Symbol.localJSAgent))});var f=eden.root.lookup("jseden_explorer_zoom"),g=f.value();f.addJSObserver("explorer",function(b,c){if("number"==typeof c&&c>0){var d=10*c;a.state.results.css("font-size",""+d+"pt")}}),void 0===g&&f.assign(1,eden.root.scope,Symbol.defaultAgent)},EdenUI.Explorer.MAXHIGHLIGHTLENGTH=1e3,EdenUI.Explorer.prototype.showConsole=function(){},EdenUI.Explorer.prototype.hideConsole=function(){},EdenUI.ExplorerState=function(a){var b=this;this.outer=a,this.controls=$('
\t\t\t\t\t\t\t
'),this.results=$('
'),this.outer.append(this.controls),this.outer.append(this.results),this.searchbox=this.controls.find(".explorerfilter"),this.watchobs={},this.capture=!1,this.delay=100,this.delay2=20,this.timeout=void 0,this.timeout2=void 0,this.mode="tree",this.index={},this.todo={},this.filter=void 0,this.listener=function(a,c){var d=a.name;!b.capture||c==Symbol.EXPIRED&&void 0!==b.watchobs[d]||void 0!==b.filter&&!b.filter[d]?(b.todo[d]=!0,void 0===b.timeout2&&(b.timeout2=setTimeout(function(){b.timeout2=void 0;var a=b.todo;b.todo={};for(var c in b.index)if(a[c]){var d=eden.root.symbols[c];if(void 0===d){for(var e=0;e
'+d+'
'),m=l.find(".symvalue").get(0);b.updateEntry(k,m),void 0===b.index[d]&&(b.index[d]=[]),b.index[d].push(m),c.appendChild(l.get(0))}$(c).append(b.makeAgentEntry(h.last_modified_by))}});var c=eden.root.lookup("jseden_explorer_search"),d=c.value();d&&this.searchbox.val(searchval),c.addJSObserver("explorer",function(a,c){void 0!==c&&"*JavaScript"!=a.origin.name&&b.searchbox.val(c)}),this.searchbox.on("keyup",function(a){void 0===c.definition&&c.assign(a.target.value,eden.root.scope,Symbol.localJSAgent)});var e=eden.root.lookup("jseden_explorer_watch"),f=e.value();Array.isArray(f)&&(this.clear(),this.watch(f)),e.addJSObserver("explorer",function(a,c){Array.isArray(c)&&(b.capture?b.filter=void 0:b.clear(),b.watch(c))});var g=eden.root.lookup("jseden_explorer_capture");g.addJSObserver("explorer",function(a,c){c?(b.record(),b.controls.find(".capture").addClass("active")):(b.capture=!1,b.controls.find(".capture").removeClass("active"))}),g.value()&&b.record();var h=eden.root.lookup("jseden_explorer_clear");h.addJSObserver("explorer",function(a,c){c&&b.clear()})},EdenUI.ExplorerState.prototype.show=function(){eden.root.addGlobal(this.listener)},EdenUI.ExplorerState.prototype.hide=function(){eden.root.removeGlobal(this.listener)},EdenUI.ExplorerState.prototype.triggerUpdate=function(){if(void 0===this.timeout){var a=this;this.timeout=setTimeout(function(){a.index={},a.timeout=void 0,"list"==a.mode?a.updateList():"tree"==a.mode?a.updateTree():"graph"==a.mode&&a.updateGraph()},this.delay)}},EdenUI.ExplorerState.prototype.updateList=function(){},EdenUI.ExplorerState.prototype.makeAgentEntry=function(a){var b=a.name;if(b.startsWith("*Console"))return $('
console
');if(b.startsWith("*When")){var c=b.split(":"),d=c[1].split("/");return d=d[d.length-1],c=d+":"+c[2],$('
when '+c+"
")}if(b.startsWith("*Action")){var c=b.split(":"),d=c[1].split("/");return d=d[d.length-1],c=d+":"+c[2],$('
action '+c+"
")}if("/"==b.charAt(0)){if(a.eden_definition&&a.eden_definition.startsWith("proc"))return $('
proc '+b+"
")}else if("*"!=b.charAt(0))return $('
'+b+"
")},EdenUI.ExplorerState.prototype.removeEntry=function(a,b){b.innerHTML='DELETED',delete this.watchobs[a],this.triggerUpdate()},EdenUI.ExplorerState.prototype.updateEntry=function(a,b,c){if(a){var d,e,f=a.value();if(a.eden_definition&&a.eden_definition.startsWith("func"))e='func';else{if(c){var g=Eden.edenCodeForValue(f,void 0,2);d=g.lengthis':"=";e=h+" "+d}b.innerHTML=e}},EdenUI.ExplorerState.prototype.makeEntry=function(a,b,c){var d=eden.root.symbols[a],e=$('
'+a+'
'),f=e.find(".symvalue").get(0);this.updateEntry(d,f),void 0===this.index[a]&&(this.index[a]=[]),this.index[a].push(f);var g=0;if(b)for(var h in b)g++,e.append(this.makeEntry(h,b[h],c));return e},EdenUI.ExplorerState.prototype.updateTree=function(){var a=this.capture?Eden.Query.dependencyTree(this.watchobs):this.watchobs;this.results.html("");for(var b in a)this.results.append(this.makeEntry(b,this.capture?a[b]:void 0,this.capture))},EdenUI.ExplorerState.prototype.watch=function(a){this.capture,void 0===this.filter&&a.length>0&&(this.filter={});for(var b=0;b\t\t\t'),this.scripts=$('
'),this.outer.append(this.controls),this.outer.append(this.scripts)},EdenUI.ExplorerScripts.prototype.buildScriptTree=function(a){for(var b={},c=0;c
'+c+"
");this.makeEntry(d,b[c]),a.append(d)}},EdenUI.ExplorerScripts.prototype.update=function(){this.scripts.html("");var a=Eden.Selectors.query(">> script:has-name","id"),b=this.buildScriptTree(a),c=[],d=[];for(var e in Eden.Selectors.cache)d.push(e),c.push(Eden.Selectors.cache[e]);a=Eden.Selectors.queryWithin(c,">> script:has-name","id"),a.push.apply(a,d);var f={External:this.buildScriptTree(a)};this.makeEntry(this.scripts,b),this.makeEntry(this.scripts,f)},EdenUI.Markdown=function(a){this.contents=document.createElement("div"),this.contents.className="markdown-inputhider",this.intextarea=document.createElement("textarea"),this.intextarea.autofocus=!0,this.intextarea.tabIndex=1,this.intextarea.className="hidden-textarea2",this.intextarea.value=a,this.contents.appendChild(this.intextarea),this.codearea=document.createElement("div"),this.codearea.className="markdown-inputCodeArea",this.contents.appendChild(this.codearea),this.outdiv=document.createElement("div"),this.outdiv.contentEditable=!0,this.outdiv.className="markdown-outputcontent",this.outdiv.spellcheck=!1,this.outdiv.tabIndex=2,this.codearea.appendChild(this.outdiv),this.highlighter=new EdenUI.Highlight(this.outdiv,{start:"MARKDOWN",styles:EdenUI.Markdown.styles,clearmodes:{SECTION_TITLE:!0,SECTION_TITLE2:!0,SECTION_TITLE_H1:!0,SECTION_TITLE_H2:!0,COMMENT_BOLD:!0,COMMENT_CODE:!0,COMMENT_ICON:!0,COMMENT_EMPH:!0,COMMENT_ITALIC:!0,END_COMMENT_TAG:!0,COMMENT_TAG:!0,COMMENT_LINK:!0,COMMENT_LINK_END:!0},brline:!0});new EdenUI.ScriptArea.Keyboard(this),new EdenUI.ScriptArea.Mouse(this);this.updateLineCachedHighlight()},EdenUI.Highlight.prototype.MARKDOWN=function(){"#"==this.token&&(this.stream.position-2<=0||"\n"==this.stream.code.charAt(this.stream.position-2))?(this.classes.push("hidden-comment"),this.mode="SECTION_TITLE",this.lineelement.className=this.styles["comment-line"]):"##"==this.token&&(this.stream.position-3<=0||"\n"==this.stream.code.charAt(this.stream.position-3))?(this.classes.push("hidden-comment"),this.mode="SECTION_TITLE2",this.lineelement.className=this.styles["comment-line"]):this.COMMENT()},EdenUI.Markdown.styles={comment:"","hidden-comment":"markdown-comment-hidden",operator:"eden-operator",observable:"eden-observable",storage:"eden-storage",number:"eden-number",string:"eden-string",constant:"eden-constant",string:"eden-string",keyword:"eden-keyword",javascript:"eden-javascript",selector:"eden-selector",selector2:"eden-selector2",selector3:"eden-selector3",function:"eden-function",type:"eden-type",special:"eden-special",backticks:"eden-backticks",doxycomment:"eden-doxycomment",pathblock:"eden-pathblock","comment-h1":"markdown-comment-h1","comment-h2":"markdown-comment-h2","comment-h3":"eden-comment-h3","horizontal-line":"eden-section-line","comment-line":"eden-comment-line","comment-emph":"eden-comment-emph","comment-bold":"eden-comment-bold","script-line":"markdown-comment-line",doxytag:"markdown-tag","comment-query":"eden-comment-query","block-comment":"eden-blockcomment","comment-ul":"eden-comment-ul","comment-blockquote":"eden-comment-blockquote",script:"eden-script"},EdenUI.Markdown.prototype.getLineNumber=function(){var a=this.intextarea.value.substr(0,this.intextarea.selectionStart).split("\n"); -return this.currentlineno=a.length,this.currentcharno=a[a.length-1].length,this.currentlineno},EdenUI.Markdown.prototype.hideInfoBox=function(){},EdenUI.Markdown.prototype.disableGotoMode=function(){},EdenUI.Markdown.prototype.rebuild=function(){this.updateLineCachedHighlight()},EdenUI.Markdown.prototype.updateLineCachedHighlight=function(){var a=new Eden.AST(this.intextarea.value,(void 0),{},{noparse:!0,noindex:!0}),b=-1,c=-1;document.activeElement===this.intextarea&&(c=this.intextarea.selectionEnd,b=this.getLineNumber(this.intextarea)),this.highlighter.highlight(a,-1,c)},EdenUI.Markdown.prototype.setValue=function(a){this.intextarea.value=a,this.updateLineCachedHighlight()},EdenUI.Markdown.prototype.moveCaret=function(){this.updateLineCachedHighlight()},EdenUI.Markdown.prototype.checkScroll=function(){},EdenUI.Markdown.prototype.enableGotoMode=function(){},EdenUI.Markdown.prototype.focusText=function(){var a=getCaretCharacterOffsetWithin(this.outdiv),b=getStartCaretCharacterOffsetWithin(this.outdiv);this.intextarea.focus(),this.intextarea.selectionEnd=a,this.intextarea.selectionStart=b},EdenUI.Markdown.prototype.focusOutput=function(){this.setCaretToFakeCaret(),this.outdiv.focus()},EdenUI.Markdown.prototype.setCaretToFakeCaret=function(){var a=$(this.outdiv).find(".fake-caret").get(0);if(a){var b=document.createRange(),c=window.getSelection();a.nextSibling&&(a=a.nextSibling),b.setStart(a,0),b.collapse(!0),c.removeAllRanges(),c.addRange(b),$(this.outdiv).remove(".fake-caret")}},EdenUI.Markdown.html=function(a,b,c){var d=document.createElement("div"),e=new EdenUI.Highlight(d,{start:"MARKDOWN",styles:EdenUI.Markdown.styles,clearmodes:{SECTION_TITLE:!0,SECTION_TITLE2:!0,SECTION_TITLE_H1:!0,SECTION_TITLE_H2:!0,COMMENT_BOLD:!0,COMMENT_CODE:!0,COMMENT_ICON:!0,COMMENT_EMPH:!0,COMMENT_ITALIC:!0,END_COMMENT_TAG:!0,COMMENT_TAG:!0,COMMENT_LINK:!0,COMMENT_LINK_END:!0},brline:!0});if(EdenUI.Markdown.styles["hidden-comment"]="eden-comment-hidden",EdenUI.Markdown.styles["script-line"]="markdown-comment-line2",e.ast={stream:new EdenStream(a)},e.highlight(e.ast,-1,-1,void 0),EdenUI.Markdown.styles["hidden-comment"]="markdown-comment-hidden",EdenUI.Markdown.styles["script-line"]="markdown-comment-line",b)return d.childNodes[0].innerHTML;for(var f="",g=0;g
'+f+"
":f},EdenUI.ProjectDetails=function(a,b){var c=this;this.projectid=a,this.meta=void 0,this.newtab=b,this.obscurer=$(''),this.obscurer.on("click",function(a){a.target===a.currentTarget&&c.remove()}),this.dialog=$(''),this.obscurer.append(this.dialog),document.body.appendChild(this.obscurer.get(0)),Eden.DB.getMeta(a,function(b){if(console.log("DETAILS META",b),null!==b[0].image){var d=$('');c.dialog.append(d)}console.log(b[0].projectMetaData);var e=null!==b[0].projectMetaData?JSON.parse(b[0].projectMetaData):{},f=document.createElement("div");f.className="markdown";var g=new showdown.Converter,h=e&&e.description?e.description.replace(/\@author[^\n]*/g,"").replace(/\s(#[a-zA-Z0-9]+)/g,' $1'):"",i=b[0].ownername;if(e&&e.description){var j=new Eden.AST.DoxyComment(e.description,0,0),k=j.getProperty("author");if(k&&k.length>0){if(i=k[0]+(k.length>1?" et al.":""),k.length>1){h+="\n\n__Authors:__";for(var l=0;l\t\t\t'+o.toFixed(1)+'by:'+i+'\t\t\t, '+get_time_diff(new Date(n[0],n[1]-1,n[2],n[3],n[4],n[5]).getTime()/1e3)+"\t\t"),q=$('
');c.dialog.append(q),c.dialog.append(p),q.on("click",".projectdetails-star",function(b){if(0!=Eden.DB.isLoggedIn()){for(var c=b.currentTarget.parentNode,d=0,e=0;e<5;e++)c.childNodes[e].className="projectdetails-star"+(d>0?"":" selected"),c.childNodes[e].innerHTML="",c.childNodes[e]===b.currentTarget&&(d=e+1);Eden.DB.rate(a,d)}});var r=q[0];if(o)for(var s=Math.floor(o),l=0;l<5;l++)r.childNodes[l].className="projectdetails-star"+(l>=s?"":" average"),r.childNodes[l].innerHTML="";var t=b[0].myrating;if(t)for(var l=0;l<5;l++)r.childNodes[l].className="projectdetails-star"+(l>=t?"":" selected"),r.childNodes[l].innerHTML="";var u;u=b[0].owner==Eden.DB.userid?$('

'):$('

'),u.on("click",".openproject",function(){c.remove(),c.newtab?window.open(window.location.origin+window.location.pathname+"?load="+a):($(".loadmodal").show(),Eden.Project.load(a))}),u.on("click",".deleteproject",function(){confirm("Are you sure you want to delete this project?")&&(c.remove(),Eden.DB.remove(a))}),u.on("click",".restoreproject",function(){c.remove(),eden.root.lookup("jseden_project_mode").assign("restore",eden.root.scope,Symbol.defaultAgent),Eden.Project.load(a)}),u.on("click",".followproject",function(b){Eden.DB.follow(a,function(a){a&&b.currentTarget.parentNode.removeChild(b.currentTarget)})}),u.append($('')),c.dialog.append(u),Eden.DB.search(":parent("+a+")",1,1,void 0,function(b){if(b.length>0){var d=document.createElement("div");d.className="projectdetails-forks";for(var e=0;e0){var d=document.createElement("div");d.style.borderTop="1px solid #aaa",d.style.height="10px",c.dialog.get(0).appendChild(d)}for(var e=0;e",f.appendChild(g);var i=document.createElement("div");i.style.padding="0",i.style.marginBottom="3px",i.className="markdown",f.appendChild(i),f.className="feedback-result",i.innerHTML=b.makeHtml(a[e].comment),c.dialog.get(0).appendChild(f)}})})})},EdenUI.ProjectDetails.prototype.remove=function(){document.body.removeChild(this.obscurer.get(0))},EdenUI.ProjectDetails.searchProjects=function(a,b,c,d,e,f){var g=c?c:7,h=1;a.on("click",".more",function(c){a.find(".more").remove(),h++,Eden.DB.search(b,h,g,f,function(c){EdenUI.ProjectDetails._searchProjects(b,a,!b.startsWith(":me"),c,g,h,e)}),c.stopPropagation()}),b||(b=""),Eden.DB.search(b,1,g,f,function(c){EdenUI.ProjectDetails._searchProjects(b,a,!b.startsWith(":me"),c,g,h,e),d&&d(c)})},EdenUI.ProjectDetails._searchProjects=function(a,b,c,d,e,f,g){var h=e?e:7;if(void 0!==d){for(var i=0;i0?r[0]:k.ownername}else j=k.ownername;else j=get_time_diff(new Date(l[0],l[1]-1,l[2],l[3],l[4],l[5]).getTime()/1e3),null===k.publicVersion&&(o=!0);var s;s=null!==n?$('
'+m+'
'+j+"
"):$('
'+m+'
'+j+"
"),b.append(s),s.click(function(a){var b=a.currentTarget.getAttribute("data-pid");console.log("Load project: "+b),new EdenUI.ProjectDetails(b,g)});var t=null!==k.overallRating?k.overallRating/k.numRatings:0,u=$('
');s.append(u);var v=u.get(0);if(t)for(var w=Math.floor(t),x=0;x<5;x++)v.childNodes[x].className="projectdetails-star"+(x>=w?"":" average")}d.length==h&&b.append($('
'))}},EdenUI.ProjectDetails.localProjects=function(a,b,c){if(void 0!==b)for(var d=0;d0?j[0]:f.author}else e=f.author;var k;k=null!==h?$('
'+g+'
'+e+"
"):$('
'+g+'
'+e+"
"),a.append(k),k.click(function(a){var b=a.currentTarget.getAttribute("data-path");console.log("Load project: "+b),Eden.Project.newFromExisting(b,function(){})});var l=f.rating;if(l){var m=$('
\t\t\t\t\t\t
');k.append(m);var n=m.get(0);if(l)for(var o=Math.floor(l),p=0;p<5;p++)n.childNodes[p].className="projectdetails-star"+(p>=o?"":" average")}}},EdenUI.Feedback=function(){function a(a,b){if(b)f.odialog.style.display="initial",f.clear(),f.updateComments(""),clearInterval(f.interval),f.interval=setInterval(function(){f.updateComments("")},5e3);else{f.odialog.style.display="none",clearInterval(f.interval);var c;f.interval=setInterval(function(){Eden.DB.searchComments(eden.project,"",1,10,c,function(a){if(void 0===c&&a.length>0)return void(c=a[0].commentID);for(var b=0;b0&&(c=a[0].commentID)})},1e4)}}var b=document.createElement("div");b.className="feedback-icon noselect",b.innerHTML="",document.getElementById("jseden-views").appendChild(b),this.odialog=document.createElement("div"),this.odialog.className="feedback-dialog",this.odialog.style.display="none",document.getElementById("jseden-views").appendChild(this.odialog),this.dialog=document.createElement("div"),this.dialog.className="feedback-scroller",this.odialog.appendChild(this.dialog);var c=document.createElement("div");c.className="feedback-title",c.innerHTML='',this.dialog.appendChild(c);var d=eden.root.lookup("jseden_feedback_visible"),e=eden.root.lookup("jseden_feedback_width"),f=this;b.addEventListener("click",function(a){void 0===d.definition&&d.assign(!0,eden.root.scope,Symbol.hciAgent)});var g=c.childNodes[2];g.addEventListener("click",function(a){void 0===d.definition&&d.assign(!1,eden.root.scope,Symbol.hciAgent)}),e.assign(420,eden.root.scope,Symbol.defaultAgent),d.addJSObserver("feedback",a),a(d,d.value());var h=new EdenUI.Markdown(""),i=document.createElement("div");i.className="feedback-input",i.appendChild(h.contents);var j=document.createElement("div");j.className="feedback-buttons";var k=document.createElement("div");k.textContent="Sign-in to post a comment...",k.style.display="none",k.className="feedback-signinmsg",this.dialog.appendChild(k),Eden.DB.isLoggedIn()||(i.style.display="none",j.style.display="none",k.style.display="block"),this.dialog.appendChild(i),this.dialog.appendChild(j),this.results=document.createElement("div"),this.dialog.appendChild(this.results),this.results.addEventListener("click",function(a){"feedback-delete"==a.srcElement.className?(console.log("delete",a.srcElement.getAttribute("data-id")),Eden.DB.removeComment(a.srcElement.getAttribute("data-id")),f.results.removeChild(a.srcElement.parentNode.parentNode)):"eden-hl-play"==a.srcElement.className&&(console.log("PLAY COMMENT",a.srcElement.getAttribute("data-src")),eden.execute2(a.srcElement.getAttribute("data-src")))});var l=document.createElement("button");l.className="script-button",l.textContent="Comment",j.appendChild(l),l.addEventListener("click",function(){Eden.DB.postComment(eden.project,h.intextarea.value),h.setValue(""),f.updateComments("")}),this.cache=[],setInterval(function(){f.updateTimes()},2e4),Eden.DB.listenTo("login",this,function(a){a&&(i.style.display="block",j.style.display="block",k.style.display="none")})},EdenUI.Feedback.prototype.clear=function(){for(this.cache=[];this.results.lastChild;)this.results.removeChild(this.results.lastChild)},EdenUI.Feedback.prototype.updateTimes=function(){for(var a=0;a0?this.cache[0].commentID:void 0,e=this.results.firstChild;Eden.DB.searchComments(eden.project,a,1,100,d,function(a){if(a)for(var f=0;f':""),g.appendChild(h);var j=document.createElement("div");j.style.padding="0",j.style.marginBottom="3px",j.className="markdown",g.appendChild(j),g.className="feedback-result"+(d?" newitem":""),j.innerHTML=c.makeHtml(a[f].comment),e?b.results.insertBefore(g,e):b.results.appendChild(g),$(j).find("code").each(function(a,b){"PRE"==b.parentNode.nodeName&&(b.innerHTML=EdenUI.Highlight.html(b.textContent,!1,!0))})}b.cache=a.concat(b.cache)})}; \ No newline at end of file +}}else d=!d,e=b.charCodeAt(f);if(c>=0){var g="<"+a+b.substring(0,c+1);this.tokentext=g.substring(1),this.cacheddata={opentag:g,tagname:a},this.classes.push("hidden-comment"),this.mode="COMMENT_HTML_START",this.stream.position+=c+1}else this.classes.push("hidden-comment"),this.tokentext+=b.substring(0,b.length-1),this.stream.position+=b.length-1,this.mode="COMMENT"},EdenUI.Highlight.prototype.COMMENT_HTML_CONTENT=function(){if("<"!=this.token)this.COMMENT();else if(this.cacheddata){var a=this.stream.peekLine(),b="/"+this.cacheddata.tagname+">",c=a.indexOf(b);c==-1?this.classes.push("hidden-comment"):(this.cacheddata&&this.popLine(),this.tokentext+=b,this.stream.position+=c+b.length,this.classes.push("hidden-comment")),this.mode="COMMENT"}else this.mode="COMMENT"},EdenUI.Highlight.prototype.COMMENT_HTML_START=function(){if("<"!=this.token){var a=this.cacheddata.opentag+d;this.mode="COMMENT_HTML_CONTENT",this.pushLine();var b=$(a).get(0);"button"!=this.cacheddata.tagname&&"a"!=this.cacheddata.tagname||(b.contentEditable=!1),this.lineelement.appendChild(b),this.lineelement=b,this.COMMENT()}else{var c=this.stream.peekLine(),d="/"+this.cacheddata.tagname+">",e=c.indexOf(d);e==-1?this.classes.push("hidden-comment"):(this.cacheddata&&this.popLine(),this.tokentext+=d,this.stream.position+=e+d.length,this.classes.push("hidden-comment")),this.mode="COMMENT"}},EdenUI.Highlight.prototype.COMMENT_CODE=function(){"`"==this.token?(this.classes.push("hidden-comment"),this.popMode()):(this.classes.push("script"),this.START())},EdenUI.Highlight.prototype.COMMENT_ICON=function(){if("OBSERVABLE"==this.token){if("-"==this.stream.code.charAt(this.stream.position)){var a=this.stream.peekLine(),b=a.indexOf(":");if(b==-1)return this.classes.push("comment"),void this.popMode();var c=a.substring(0,b);this.tokentext+=c,this.stream.position+=c.length}var d=document.createElement("span");d.className="eden-comment-icon fa fa-"+this.tokentext,this.lineelement.appendChild(d),this.classes.push("hidden-comment")}else":"==this.token&&(this.classes.push("hidden-comment"),this.popMode())},EdenUI.Highlight.prototype.COMMENT_EMPH=function(){if("*"==this.token)this.mode="COMMENT_BOLD",this.classes.push("hidden-comment");else{var a=document.createElement("span");this.applyClasses(a,["comment-emph"]),this.lineelement.appendChild(a),this.pushLine(),this.lineelement=a,this.mode="COMMENT_ITALIC",this.COMMENT()}},EdenUI.Highlight.prototype.COMMENT_ITALIC=function(){"*"==this.token?(this.classes.push("hidden-comment"),this.popLine(),this.popMode()):this.COMMENT()},EdenUI.Highlight.prototype.COMMENT_BOLD=function(){if("*"==this.token)this.classes.push("hidden-comment"),this.popLine(),this.mode="COMMENT_BOLD_END";else{var a=document.createElement("span");this.applyClasses(a,["comment-bold"]),this.lineelement.appendChild(a),this.pushLine(),this.lineelement=a,this.mode="COMMENT_BOLD_END",this.COMMENT()}},EdenUI.Highlight.prototype.COMMENT_BOLD_END=function(){"*"==this.token?("*"==this.stream.code.charAt(this.stream.position)&&(this.classes.push("hidden-comment"),this.stream.position++,this.tokentext+="*"),this.popLine(),this.popMode()):this.COMMENT()},EdenUI.Highlight.prototype.COMMENT_TAG=function(){this.mode="END_COMMENT_TAG"},EdenUI.Highlight.prototype.END_COMMENT_TAG=function(){this.popLine(),this.mode="COMMENT",this.COMMENT()},EdenUI.Highlight.prototype.DOXY_COMMENT=function(){this.BLOCK_COMMENT()},EdenUI.ContextMenu=function(a){this.element=$('
'),this.origin=a,this.target=void 0,this.items=[],$(document.body).append(this.element);var b=this;this.element.on("mousedown",".eden-contextmenu-item",function(a){var c=parseInt(a.currentTarget.getAttribute("data-index"));b.items[c].action&&b.items[c].action(b.target)}),this.origin.oncontextmenu=function(a){b.target=a.target,"SPAN"==b.target.nodeName&&(b.target=b.target.parentNode);var c=document.body.scrollLeft+a.clientX;c+150>=screen.width&&(c-=c+150-screen.width),b.element.css("top",""+(document.body.scrollTop+a.clientY+10)+"px"),b.element.css("left",""+c+"px");for(var d=0;d'+a+""+b+"");e.get(0).setAttribute("data-index",""+this.items.length),this.element.append(e),this.items.push({status:c,action:d,element:e.get(0)})},EdenUI.ContextMenu.prototype.addSeparator=function(){var a=$('
');this.element.append(a)},EdenUI.ButtonBar=function(a){this.container=a,this.bar=$('
'),this.buttons={},this.container.appendChild(this.bar.get(0))},EdenUI.ButtonBar.prototype.addButton=function(a,b,c,d){var e=$('");this.bar.find(".buttonsDiv").append(e),e.get(0).onclick=d,this.buttons[a]=e},EdenUI.ButtonBar.prototype.enableButton=function(a){this.buttons[a]&&this.buttons[a].addClass("control-enabled")},EdenUI.ButtonBar.prototype.disableButton=function(a){this.buttons[a]&&this.buttons[a].removeClass("control-enabled")},EdenUI.Tabs=function(a){this.tabs=a,this.scrollix=0,this.maxtabs=3},EdenUI.Tabs.prototype.build=function(a,b){for(;this.tabs.firstChild;)this.tabs.removeChild(this.tabs.firstChild);var c=document.createElement("div");c.className="agent-tableft noselect",this.tabs.appendChild(c);var d=document.createElement("div");if(d.className="agent-tab-container",this.tabs.appendChild(d),a&&a instanceof Array){var e=-1;b&&(e=a.indexOf(b)),e>this.scrollix+(this.maxtabs-1)&&(this.scrollix=e-(this.maxtabs-1)),e18&&(h="..."+h.slice(-15));var i;i=Eden.Agent.agents[b]?Eden.Agent.agents[b].hasErrors()?"tab-icon errored":Eden.Agent.agents[b].executed?"tab-icon executed":"tab-icon":"tab-icon noagent",f.className=g,f.innerHTML=""+h,f.draggable=!0,f.setAttribute("data-name",b),a.appendChild(f)},EdenUI.MenuBar=function(){function a(){$(".menubar-menu").hide(),t=!1;var a=$("#menubar-mainitem-views");a.children().css("display","")}function b(a){var b=$("#menubar-mainitem-"+a);b.show(),u=a,t=!0,"sharebox"==a&&o.sharebox.show()}function c(){var a=$("#menubar-mainitem-existing-views");Object.keys&&0===Object.keys(edenUI.activeDialogs).length&&a.html('')}function d(b){a();var c=edenUI.eden.root,d=c.lookup("mouseFollow").value(),e=c.lookup("views_number_created"),f=e.value()+1;e.assign(f,c.scope,Symbol.hciAgent,!0);var g=this.view,h=g.toLowerCase()+f;d?edenUI.eden.execute('createView("'+h+'", "'+g+'");'):edenUI.createView(h,g),o.updateViewsMenu()}function e(b){var d=this.parentNode.viewname;edenUI.viewInstances[d].confirmClose&&a(),edenUI.destroyView(d),c()}function f(a){var b=a.currentTarget.children[0],c=this.parentNode.viewname;edenUI.viewInstances[c].pinned?(edenUI.unpinView(c),b.src=n):(edenUI.pinView(c),b.src=m)}function g(a){for(var b=$(""),c=0;c'+b+"")}function i(a){return $("")}function j(b){return{mouseover:function(a){edenUI.highlightView(b,!0)},mouseout:function(a){edenUI.stopHighlightingView(b,!0,!1)},click:function(c){edenUI.stopHighlightingView(b,!0,!0),a()}}}function k(a){return a&&"false"!=a?'checked="checked"':""}function l(a,b,c,d){var e=edenUI.getOptionValue(a);null===e&&(e=c);var f=h("menubar-item-input",'"),i=f.get(0).children[0],j=h("menubar-item-label",b),l=g([f,j]);l.click(function(b){b.target!=i&&(i.checked=!i.checked),edenUI.setOptionValue(a,i.checked)}),edenUI.listenTo("optionChange",void 0,function(b,c){if(b==a){var e="true"===c;i.checked=e,d&&d(a,e)}}),l.appendTo(v)}var m="images/pin.png",n="images/pin-greyed.png",o=this;this.itemViews={};var p=mobilecheck(),q=$('');q.html(''),q.hide(),Eden.AST&&eden.execute2("views_number_created = 0;",Symbol.defaultAgent),p?this.element=$(''):this.element=$(''),$(document.body).append(this.element);var r=this.element.find("#menubar-login");if(!p){var s=new EdenUI.ContextMenu(r.get(0));s.addItem("","Log out",function(){return Eden.DB.isLoggedIn()},function(){Eden.DB.logOut(function(){$("#menubar-login").html('Login')})})}edenUI.listenTo("loadPlugin",this,function(a,b){p||this.updateViewsMenu()}),edenUI.listenTo("createView",this,function(a,b){p||this.updateViewsMenu()}),edenUI.listenTo("destroyView",this,function(a){p||($(this.itemViews[a]).remove(),delete this.itemViews[a],c())}),Eden.DB.listenTo("connected",this,function(a){p||$("#menubar-login").html('Sign-in')}),Eden.DB.listenTo("disconnected",this,function(){p||$("#menubar-login").html('Not Connected')}),Eden.DB.listenTo("login",this,function(a){p||a&&(setTimeout(function(){$("#menubar-obscurer").remove()},1e3),$("#menubar-login").html(''+a+""))});var o=this;p||$("#menubar-login").click(function(){o.showLogin()}),this.showLogin=function(){Eden.DB.isConnected()&&!Eden.DB.isLoggedIn()?(q.show(),$(document.body).append(q),q.find("iframe").attr("src",Eden.DB.remoteURL+"/login"),q.on("click",".button-cancel",function(){q.remove()})):Eden.DB.isConnected()&&Eden.DB.isLoggedIn()},Eden.AST&&(this.sharebox=new EdenUI.Sharebox(this.element.find("#menubar-mainitem-sharebox")),this.element.on("click",".menubar-button.share",function(a){a.currentTarget===a.target&&o.sharebox.update()}),this.searchbox=new EdenUI.SearchBox(this.element.find("#menubar-searchresults")),this.element.on("keyup",".search",function(a){o.searchbox.updateSearch(a.currentTarget.value)}),this.element.on("focus",".search",function(a){o.searchbox.updateSearch(a.currentTarget.value)}));var t=!1,u=void 0;$(document.body).on("mousedown",function(){a(),o.searchbox&&o.searchbox.element.hide()}),this.element.on("mousedown",".menubar-search-outer",function(a){a.stopPropagation()}),this.element.on("mousedown",".menubar-button.main",function(c){var d=c.currentTarget.getAttribute("data-obs");t&&c.target===this?d==u?a():(a(),b(d)):b(d),o.searchbox&&o.searchbox.element.hide(),c.stopPropagation()}),this.element.on("mouseenter",".menubar-button.main",function(a){}),this.updateViewsMenu=function(){var a=$("#menubar-mainitem-views"),b=$("#menubar-mainitem-existing");a.html("");var k=$(''),l=k[0],p=$('');p.append(k);var q=$("");q.append(p),l.search=function(){var b,c=l.value,d=new RegExp("(^|\\s)"+c,"i"),e=!1;a.children().each(function(a,f){if(!f.classList.contains("menubar-item-search")){var g=f.children[0],h=g.innerHTML,i=g.classList.contains("menubar-item-separator");i?(c.length>1&&(e=d.test(h)),b=f,e?f.style.display="":f.style.display="none"):e?f.style.display="":d.test(h)?(f.style.display="",b.style.display=""):f.style.display="none"}})},k.on("input",l.search);var r,s,t,u,v,w,x=[];for(s in edenUI.views){var y=edenUI.views[s],z=y.title,A=y.category.getLabel(),B=y.category.getMenuPriority(),C=y.menuPriority;u=h("menubar-item-fullwidth menubar-view",z),t=g([u]),t[0].view=s,t.click(d),x.push({title:z,viewEntry:t,categoryLabel:A,categoryPriority:B,itemPriority:C})}x=x.sort(function(a,b){if(a.categoryPriority!=b.categoryPriority)return a.categoryPriority-b.categoryPriority;if(void 0!==a.itemPriority){if(void 0===b.itemPriority)return-1;if(a.itemPriority!=b.itemPriority)return a.itemPriority-b.itemPriority}else if(void 0!==b.itemPriority)return 1;return a.title>b.title?1:a.title['+r+"]"),u.click(I.click);var J;J=edenUI.viewInstances[r].pinned?m:n,v=h("menubar-item-pin",''),v.click(f),w=h("menubar-item-close",''),w.click(e),t=g([u,v,w]),t.bind("mouseover",I.mouseover),t.bind("mouseout",I.mouseout),t[0].viewname=r,t.appendTo(b),o.itemViews[r]=t[0]}},this.updateViewsMenu();var v=$("#menubar-mainitem-options");l("optConfirmUnload",Language.ui.menu_bar.opt_confirm,!0,function(a,b){b?window.addEventListener("beforeunload",confirmUnload):window.removeEventListener("beforeunload",confirmUnload)}),l("optSimpleWildcards",Language.ui.menu_bar.opt_simple_search,!0),l("optHideOnMinimize",Language.ui.menu_bar.opt_hide,!1),l("optCollapseToTitleBar",Language.ui.menu_bar.opt_collapse,!1,function(a,b){var c;c=b?"collapse":"maximize",$(".ui-dialog-content").each(function(){$(this).dialogExtend("option","dblclick",c)})}),l("developer",Language.ui.menu_bar.opt_debug,!1,function(b,c){var d;d=c?"/index-dev.html":"/index.html";var e=document.location.pathname;d=e.slice(0,e.lastIndexOf("/"))+d,d!=document.location.pathname?(a(),edenUI.modalDialog("Restart Required","

JS-EDEN must be restarted for this change to fully take effect. Would you like to restart JS-EDEN now?

",["Restart Now","Restart Later"],1,function(a){if(0==a)window.onbeforeunload=void 0,document.location.pathname=d;else if(1==a)root.lookup("debug").mutate(root.scope,function(a){a.cache.value.jsExceptions=c},Symbol.hciAgent);else{var b=document.getElementById("menu-developer");b.checked=!b.checked,edenUI.setOptionValue("developer",b.checked)}})):root.lookup("debug").mutate(root.scope,function(a){a.cache.value.jsExceptions=c},Symbol.hciAgent)}),this.element.on("keyup",".jseden-title",function(a){try{window.localStorage&&window.localStorage.setItem("title",a.currentTarget.textContent)}catch(a){}}),eden.root.lookup("jseden_project_title").addJSObserver("menubar",function(a,b){if(!p){if(a.origin&&a.origin!==Symbol.hciAgent){var c=$(".jseden-title").get(0);c.contentEditable=!0,c.textContent=b,document.title=b}try{window.localStorage&&window.localStorage.setItem("title",b)}catch(d){}}}),eden.root.lookup("jseden_maker").addJSObserver("menubar",function(a,b){b?o.element.find(".maker").addClass("active"):o.element.find(".maker").removeClass("active")}),eden.root.lookup("jseden_menu_showsearch").addJSObserver("menubar",function(a,b){b?(o.element.find(".menusearch").show(),p&&o.element.find("#eden-logo").hide()):(o.element.find(".menusearch").hide(),p&&o.element.find("#eden-logo").show())}),eden.root.lookup("jseden_menu_showshare").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.share").show():o.element.find(".menubar-button.share").hide()}),eden.root.lookup("jseden_menu_showcreate").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.create").show():o.element.find(".menubar-button.create").hide()}),eden.root.lookup("jseden_menu_showexisting").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.existing").show():o.element.find(".menubar-button.existing").hide()}),eden.root.lookup("jseden_menu_showsettings").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.settings").show():o.element.find(".menubar-button.settings").hide()}),eden.root.lookup("jseden_menu_showhelp").addJSObserver("menubar",function(a,b){b?o.element.find(".menubar-button.help").show():o.element.find(".menubar-button.help").hide()}),eden.root.lookup("jseden_project_subtitle").addJSObserver("menubar",function(a,b){}),this.notifications=new EdenUI.Notifications(this.element.find("#menubar-mainitem-notifications"),this.element.find(".menubar-notification-jewel")),this.element.on("click",".notifications",function(a){o.notifications.clearCount()}),this.element.on("click",".maker",function(a){var b=eden.root.lookup("jseden_maker");if(!b.eden_definition){var c=b.value();void 0===c&&(c=!1),b.assign(!c,eden.root.scope,Symbol.localJSAgent)}}),this.element.on("keyup",".jseden-title",function(a){var b=eden.root.lookup("jseden_project_title");b.definition||b.assign(a.currentTarget.textContent,eden.root.scope,Symbol.hciAgent)})},EdenUI.MenuBar.prototype.hide=function(){this.element.hide()},EdenUI.MenuBar.prototype.show=function(){this.element.show()},EdenUI.MenuBar.reset=function(){$(".jseden-title").html("CONSTRUIT")},EdenUI.MenuBar.saveTitle=function(a){eden.root.lookup("jseden_project_title").assign(a,eden.root.scope,Symbol.jsAgent)},EdenUI.Dialogs={},EdenUI.Dialogs.MergeError=function(a,b,c){var d=new diff_match_patch,e=d.diff_main(a,b);d.diff_cleanupSemantic(e);var f=d.diff_prettyHtml(e),g=$('
'+f+"
");g.dialog({resizable:!0,height:"auto",width:600,modal:!0,buttons:{"Use Mine":function(){c&&c("old"),$(this).dialog("close")},"Use New":function(){c&&c("new"),$(this).dialog("close")},Merge:function(){c&&c("merge"),$(this).dialog("close")}}})},EdenUI.Notifications=function(a,b){function c(a,b){if(b){var c=("runtime"==b.type?"Runtime error":"Syntax error")+" in "+a.name+":"+(b.line!=-1?b.line:"")+" -> "+b.messageText(),e="'+a.name+":"+(b.line!=-1?b.line+1:"")+" "+b.messageText();if(!a.owned||"syntax"!=b.type){console.error(c);var f=$('
'+e+"
\n\n");f.on("click",function(){var a="";if(!b.statement||"definition"!=b.statement.type&&"assignment"!=b.statement.type||(a+=" Symbol: "+b.statement.lvalue.name+"\n"),b.lastsymbol&&(a+=" Related Symbol: "+b.lastsymbol+"\n"),String(b.extra).search("SyntaxError")>=0)a+=" JavaScript: "+b.javascriptSource()+"\n",f.html(e+"\n"+a);else if(a+=" Source:
\n",f.html(e+"\n"+a),b.statement){var c=new Eden.AST(b.edenSource(),(void 0),Symbol.jsAgent),d=new EdenUI.Highlight(f.find(".error-source").get(0));d.highlight(c,-1,-1)}}),d.notification("error",f)}}}var d=this;this.notificationCount=0,this.notificationCountElement=b,this.notificationCountElement.hide(),this.notificationPanel=a,this.notificationPanel.html('
'),this.notificationPanel.on("click",".close-button",function(){d.notificationPanel.hide()}).on("click",".clear-button",function(){d.notificationPanel.find("#errors-dialog").html("")}),this.notificationPanel.hide(),this.notificationContent=this.notificationPanel.find("#errors-dialog"),Eden.Peer.listenTo("user",void 0,function(a,b){d.notification("net",$('
User \'"+b+"' connected to you.
Watch Broadcast Collaborate
"))}),Eden.Peer.listenTo("share",void 0,function(a,b){d.notification("net",$('
Your model is being shared...
'))}),Eden.Peer.listenTo("disconnect",void 0,function(a,b){b?d.notification("net",$('
User \''+b+"' disconnected.
")):d.notification("net",$('
P2P User disconnected.
'))}),Eden.Peer.listenTo("error",void 0,function(a){d.notification("error",$('
P2P: '+a+"
"))}),Eden.Fragment&&(Eden.Fragment.listenTo("error",void 0,c),eden.listenTo("error",void 0,c),Eden.Fragment.listenTo("warning",void 0,function(a,b){if(b){var c=(("runtime"==b.type?"Runtime warning":"Syntax warning")+" in "+a.name+":"+(b.line!=-1?b.line:"")+" -> "+b.messageText(),"'+a.name+":"+(b.line!=-1?b.line+1:"")+" "+b.messageText());if(!a.owned||"syntax"!=b.type){var e=$('
'+c+"
\n\n");e.on("click",function(){var a="";if(!b.statement||"definition"!=b.statement.type&&"assignment"!=b.statement.type||(a+=" Symbol: "+b.statement.lvalue.name+"\n"),b.lastsymbol&&(a+=" Related Symbol: "+b.lastsymbol+"\n"),String(b.extra).search("SyntaxError")>=0)a+=" JavaScript: "+b.javascriptSource()+"\n",e.html(c+"\n"+a);else if(a+=" Source:
\n",e.html(c+"\n"+a),b.statement){var d=new Eden.AST(b.edenSource(),(void 0),Symbol.jsAgent),f=new EdenUI.Highlight(e.find(".error-source").get(0));f.highlight(d,-1,-1)}}),d.notification("warning",e)}}})),Eden.DB.listenTo("disconnected",this,function(){d.notification("info",$('
Disconnected from project server
'))}),Eden.DB.listenTo("error",this,function(a){d.notification("error",$('
'+a+"
"))})},EdenUI.Notifications.prototype.notification=function(a,b){this.notificationCount++,this.notificationCountElement.html(this.notificationCount),this.notificationCountElement.show();var c;if("error"==a)c=$('
'),c.append($('
'));else{var d,e="#777";switch(a){case"net":d="";break;case"comment":d="";break;case"log":d="";break;case"warning":d="",e="#f57900";break;case"info":default:d="",e="#29454B"}c=$('
'),c.append($('
'+d+"
"))}"string"==typeof b?c.append($('
'+b+"
")):c.append(b),this.notificationContent.prepend(c),this.notificationContent.prop("scrollTop",0)},EdenUI.Notifications.prototype.clearCount=function(){this.notificationCountElement.hide(),this.notificationCount=0},EdenUI.Sharebox=function(a){var b=this;this.title=void 0,this.visible=!1,this.sharebox=a,this.sharebox.html('');var c=this.sharebox.find("#projectoptions");this.markdown=new EdenUI.Markdown(""),c.get(0).appendChild(this.markdown.contents),this.sharebox.on("change","#thumbfile",function(a){var c=b.sharebox.find("#projectthumb"),d=$("#thumbfile");c.html("");var e=d.get(0),f=e.files[0],g=new FileReader;g.onload=function(a){var d=document.createElement("canvas");d.setAttribute("width","200"),d.setAttribute("height","112");var e=d.getContext("2d"),f=new Image;f.onload=function(){var a,g,h,i,j=f.width,k=f.height,l=200,m=112,n=j/k,o=l/m;no?(g=l,a=k*(g/j),h=0,i=(m-a)/2):(a=m,g=l,h=0,i=0),e.drawImage(f,h,i,g,a);var p=d.toDataURL("image/png");b.thumbdata=p,c.get(0).childNodes[0].src=p},f.src=a.target.result},g.readAsDataURL(f)}),this.sharebox.on("click",".upload",function(a){var c=b.title.textContent,d=b.markdown.intextarea.value,e=$("#listpublic").get(0).checked;return"New Project"==c?void b.sharebox.find("#projectuploadbox").html('Please give your project a name by editing the "New Project" title in the top left.'):(b.sharebox.find("#projectuploadbox").html('Saved to your projects and shared at:
Saving...
'),eden.project.thumb=b.thumbdata,eden.project.setDescription(d),console.log("SAVE",e,d),void eden.project.save(e,function(a){if(a){var c="?load="+eden.project.id+"&vid="+eden.project.vid+"&r="+eden.project.readPassword;window.history.replaceState({id:eden.project.id,vid:eden.project.vid},"",c),b.sharebox.find(".projecturl").html('
'+window.location.href+'
');var d=document.createRange();d.selectNodeContents(b.sharebox.find(".projecturl").get(0));var e=window.getSelection();e.removeAllRanges(),e.addRange(d)}else b.sharebox.find(".projecturl").html("Save failed, not logged in.")}))}),this.sharebox.on("click",".fork",function(a){var c=b.title.textContent,d=b.markdown.intextarea.value,e=$("#listpublic").get(0).checked;return"New Project"==c?void b.sharebox.find("#projectuploadbox").html('Please give your project a name by editing the "New Project" title in the top left.'):(b.sharebox.find("#projectuploadbox").html('Saved to your projects and shared at:
Saving...
'),eden.project.thumb=b.thumbdata,eden.project.id&&(eden.project.parentid=eden.project.id),eden.project.id=void 0,eden.project.vid=void 0,eden.project.setDescription(d),console.log("FORK",e,d),void eden.project.save(e,function(a){if(a){var c="?load="+eden.project.id+"&vid="+eden.project.vid;window.history.replaceState({id:eden.project.id,vid:eden.project.vid},"",c),b.sharebox.find(".projecturl").html('
'+window.location.href+'
');var d=document.createRange();d.selectNodeContents(b.sharebox.find(".projecturl").get(0));var e=window.getSelection();e.removeAllRanges(),e.addRange(d)}else b.sharebox.find(".projecturl").html("Save failed, not logged in.")}))})},EdenUI.Sharebox.prototype.show=function(){this.visible||this.update(),this.visible=!0},EdenUI.Sharebox.prototype.hide=function(){this.visible=!1},EdenUI.Sharebox.prototype.update=function(){var a=this;void 0===a.title&&(a.title=$(document).find(".jseden-title").get(0));var b=a.title?a.title.textContent:eden.root.lookup("jseden_project_title").value();Eden.DB.isLoggedIn()?(eden.project.authorid!=Eden.DB.userid&&eden.project.authorid!=-1?a.sharebox.find("#projectuploadbox").html('
List publically
Thumbnail:
'):a.sharebox.find("#projectuploadbox").html('
List publically
'),a.sharebox.find("#projectoptions").show()):(a.sharebox.find("#projectuploadbox").html('
'),a.sharebox.find("#projectoptions").hide());var c=this.sharebox.find("#projectthumb");this.thumbdata=void 0,this.thumbimg=$(""),this.thumbimg.get(0).style.border="1px solid #aaa",this.thumbimg.get(0).style.marginRight="10px",c.append(this.thumbimg),eden.project.thumb?(a.thumbdata=eden.project.thumb,a.thumbimg.get(0).src=eden.project.thumb):a.thumbdata=void 0, +void 0===eden.project.id&&(eden.project.tags=(eden.project.title.toLowerCase()+" "+(Eden.DB.isLoggedIn()?Eden.DB.username.toLowerCase():"")).split(" ")),a.markdown.setValue(eden.project.getDescription()),a.projectsource=eden.project.generate();var d="data:application/octet-stream,"+encodeURIComponent(a.projectsource);a.sharebox.find(".downloadurl").html('File')},EdenUI.SearchBox=function(a){var b=this;this.element=a,a.on("click",".menubar-search-result",function(a){var c=a.currentTarget.getAttribute("data-id");c&&""!=c?b.updateSymbolDetails(a.currentTarget,c):script&&""!=script}),a.on("click",".edit-result",function(a){}),a.on("click",".script-goto",function(a){var c=a.currentTarget.parentNode.parentNode.parentNode.getAttribute("data-id");b.element.hide(),Eden.Selectors.goto("@external "+c)}),a.on("click",".script-import",function(a){var c=a.currentTarget.parentNode.parentNode.parentNode.getAttribute("data-id");Eden.Selectors.query(c,void 0,{minimum:1,options:{external:!0,index:!0}},function(d){c&&""!=c&&(a.currentTarget.parentNode.parentNode.parentNode.setAttribute("data-imported","true"),b.updateSymbolDetails(a.currentTarget.parentNode.parentNode.parentNode,c))})})},EdenUI.SearchBox.prototype.updateSymbolDetails=function(a,b){console.log("Update details",b);var c=(a.getAttribute("data-imported"),a.getAttribute("data-remote"));Eden.Selectors.query("@history "+b,"id,path,source,type,value,active,tags,rawcomment,historic",{minimum:1,options:{external:!0}},function(b){if(0==b.length)return void console.log("No result");b=b[0];var d=(b[0],b[1]),e=b[2],f=b[3],g=b[4],h=b[5],i=(b[6],b[7]),j=b[8];i&&(i=new Eden.AST.DoxyComment(i));var k=$(a).find(".doxy-search-details");null!==k&&0!=k.length||(k=$('
'),a.appendChild(k.get(0))),k=k.get(0),"assignment"!=f&&"definition"!=f||(symstr=e,""==a.firstChild.className?a.firstChild.innerHTML=EdenUI.Highlight.html(symstr):a.childNodes[1].innerHTML=EdenUI.Highlight.html(symstr));var l="";if(j?l="":"true"==c?(l+="

",l+='

'):l='

',i){var m=i.pretty();m&&m.length>0&&(l+=m)}h?(l+="

",l+="Path: "+d+"
",l+="Current Value: "+Eden.edenCodeForValue(g),l+="

"):(l+="

",l+="Path: "+d+"",l+="

"),k.innerHTML=l})},EdenUI.SearchBox.prototype.makeStatementResult=function(a){var b,c="",d="",e="",f=!0;a.executed==-1&&(d=" historic");var g=a.getOrigin();"script"==a.type?(g&&g.remote?(e+=' data-remote="true"',a.indexed&&(e+=' data-imported="true"'),c=''):c='',b=a.doxyComment&&a.doxyComment.getProperty("title")?a.doxyComment.getProperty("title")[0]:a.name?"action "+a.name:a.getInnerSource()):"when"==a.type?(a.enabled&&(c=''),b=a.prefix.trim()):(a.lvalue&&eden.root.symbols[a.lvalue.name]&&eden.root.symbols[a.lvalue.name].origin&&eden.root.symbols[a.lvalue.name].origin.id==a.id&&(c=''),a.getSource()||console.error("NO SOURCE",a),b=a.getSource().split("\n")[0]),f&&(b.length>55&&(b=b.substr(0,55)+"..."),b=EdenUI.Highlight.html(b));var h="";if(a.doxyComment){var i=a.doxyComment.brief();i&&i.length>0&&(h='

'+i+"

")}var j=$('");return j},EdenUI.SearchBox.prototype.makeScriptResult=function(a){},EdenUI.SearchBox.prototype.updateSearch=function(a){if(a&&""!=a){this.element.show();var b=this;Eden.Selectors.query(a,void 0,{minimum:1,options:{external:!0}},function(a){function c(){var d=$('');e.append(d),d.on("click",function(){e.html("");for(var d=0;fg);f++){d++;var h;h=a[f]instanceof Symbol?b.makeSymbolResult(a[f]):b.makeStatementResult(a[f]),e.append(h)}f
'),e=$('');d.append(e),b.element.append(d);var f=0,g=8,h=0;for(f=0;f=g)break;h++;var i;i=b.makeStatementResult(a[f]),e.append(i)}f=q.ast.script.end)return q.history.push(q.ast.stream.code),q.historyindex=q.history.length,window.localStorage&&window.localStorage.setItem("console_history",JSON.stringify(q.history)),$(q.outdiv).find(".fake-caret").remove(),q.$codearea.append($('
'+q.outdiv.innerHTML+"
")),q.ast.execute(EdenUI.ScriptBox.consoleAgent,function(){void 0!==q.ast.lastresult&&(console.log("Result",q.ast.lastresult),q.$codearea.append($('
'+EdenUI.Highlight.html(Eden.edenCodeForValue(q.ast.lastresult))+"
")))}),q.inputhider.scrollTop=q.inputhider.scrollHeight,q.setSource(""),void a.preventDefault();if(a.altKey)187==a.keyCode||61==a.keyCode?a.preventDefault():189==a.keyCode||173==a.keyCode?a.preventDefault():48==a.keyCode&&a.preventDefault();else if(a.ctrlKey||17==a.keyCode||16==a.keyCode){if(a.ctrlKey)if(a.shiftKey){if(37==a.keyCode||38==a.keyCode||39==a.keyCode||40==a.keyCode||36==a.keyCode||35==a.keyCode)return q.setCaretToFakeCaret(),void q.outdiv.focus()}else 38===a.keyCode?onPrevious():40===a.keyCode?onNext():86===a.keyCode||65===a.keyCode&&(a.preventDefault(),q.outdiv.focus())}else if(9==a.keyCode){a.preventDefault();var b=q.intextarea.selectionStart,c=q.intextarea.selectionEnd;q.intextarea.value=q.intextarea.value.substring(0,b)+"\t"+q.intextarea.value.substring(c),q.intextarea.selectionStart=q.intextarea.selectionEnd=b+1,q.rebuild()}else if(37==a.keyCode||38==a.keyCode||39==a.keyCode||40==a.keyCode||36==a.keyCode||35==a.keyCode){if(a.shiftKey)return q.setCaretToFakeCaret(),void q.outdiv.focus();38==a.keyCode?q.historyindex>0&&(q.historyindex--,q.setSource(q.history[q.historyindex]),a.preventDefault()):40==a.keyCode&&(q.historyindex=0?changeClass(a.currentTarget,"stuck",!1):changeClass(a.currentTarget,"stuck",!0)}function o(a){if(q.dragline==-1&&(void 0===q.outdiv||a.currentTarget!==q.outdiv.parentNode)){var b=parseInt(a.currentTarget.getAttribute("data-statement"));q.moveTo(b)}}function p(a){var b=a.currentTarget.parentNode.parentNode,c=parseInt(b.getAttribute("data-statement"));b.removeChild(q.valuedivs[c][0]),delete q.valuedivs[c]}this.changeCB=void 0,this.outer=a,this.savecb=void 0,this.contents=$(this.outer),this.contents.html('
'),this.currentstatement=void 0,this.statements={},this.$codearea=this.contents.find(".scriptbox-codearea"),this.codearea=this.$codearea.get(0),this.intextarea=this.contents.find(".hidden-textarea").get(0),this.inputhider=this.contents.find(".scriptbox-inputhider").get(0),this.outdiv=this.contents.find(".scriptbox-output").get(0),this.$codearea.sortable({revert:100,handle:".grippy",distance:10,axis:"y",scroll:!1}),this.infobox=this.contents.find(".info-bar").get(0),this.outputbox=this.contents.find(".scriptbox-outputbox").get(0),this.suggestions=this.contents.find(".eden_suggestions"),this.suggestions.hide(),$(this.infobox).hide(),this.highlighter=new EdenUI.Highlight(this.outdiv),this.enable(),this.ast=void 0,this.refreshentire=!0,this.dirty=!0,this.rebuildtimer=void 0,this.rebuildtimeout=10,this.currentlineno=1,this.currentcharno=0,this.dragint=!1,this.dragline=-1,this.dragvalue=0,this.draglast=0,this.history=void 0,window.localStorage?this.history=JSON.parse(window.localStorage.getItem("console_history"))||[]:this.history=[],this.historyindex=this.history.length;var q=this;this.contents.on("input",".hidden-textarea",c).on("keydown",".hidden-textarea",d).on("keyup",".hidden-textarea",f).on("paste",".hidden-textarea",e).on("keydown",".scriptbox-output",g).on("keyup",".scriptbox-output",i).on("paste",".scriptbox-output",h).on("blur",".hidden-textarea",j).on("focus",".hidden-textarea",k).on("mouseup",".scriptbox-output",l).on("click",".scriptbox-gutter",m).on("click",".scriptbox-sticky",n).on("click",".scriptbox-valueclose",p).on("mousedown",".scriptbox-statement",o),this.setSource(""),setInterval(function(){for(var a in q.valuedivs){var b=Eden.Statement.statements[a];if(b){var c=EdenUI.htmlForStatement(b,30,30);b.isActive();q.valuedivs[a].innerHTML='
'+c+"
"}}},200)},EdenUI.ScriptBox.consoleAgent={local:!1,name:"*Console"},EdenUI.ScriptBox.prototype.focus=function(){if(this.outdiv.focus(),document.activeElement===this.outdiv){var a=this.intextarea.value.length,b=this.currentlineno;this.intextarea.focus(),this.intextarea.selectionEnd=a,this.intextarea.selectionStart=a,this.ast&&(this.highlighter.highlight(this.ast,b,a),this.updateLineCachedHighlight())}},EdenUI.ScriptBox.prototype.setCaretToFakeCaret=function(){var a=$(this.outdiv).find(".fake-caret").get(0),b=document.createRange(),c=window.getSelection();a.nextSibling&&(a=a.nextSibling),b.setStart(a,0),b.collapse(!0),c.removeAllRanges(),c.addRange(b),$(this.outdiv).remove(".fake-caret")},EdenUI.ScriptBox.prototype.setChangeCB=function(a){this.savecb=a},EdenUI.ScriptBox.prototype.hideInfoBox=function(){$(this.infobox).hide("fast")},EdenUI.ScriptBox.prototype.showInfoBox=function(a,b,c,d){console.log("SHOW INFO BOX "+d),"warning"==c?this.infobox.innerHTML="
"+d+"
":"error"==c&&(this.infobox.innerHTML="
"+d+"
");var e=$(this.infobox);e.css("top",""+b+"px"),e.css("left",""+a+"px"),$(this.infobox).show()},EdenUI.ScriptBox.prototype.disable=function(){if(this.outdiv){changeClass(this.outdiv,"goto",!1),this.valuedivs[this.currentstatement]=this.outdiv;var a=EdenUI.htmlForStatement(Eden.Statement.statements[this.currentstatement],30,30);this.valuedivs[this.currentstatement].innerHTML='
'+a+"
",changeClass(this.outdiv.parentNode,"readonly",!0),this.ast}},EdenUI.ScriptBox.prototype.enable=function(){this.outdiv&&(this.outdiv.contentEditable=!0,changeClass(this.outdiv.parentNode,"readonly",!1),this.ast&&this.highlighter.highlight(this.ast,-1,-1))},EdenUI.ScriptBox.prototype.setSource=function(a){this.intextarea.value=a,this.ast=new Eden.AST(a,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),this.highlightContent(this.ast,-1,0),this.intextarea.focus(),this.ast.script&&0==this.ast.script.errors.length?changeClass(this.outdiv.parentNode,"error",!1):""==a?changeClass(this.outdiv.parentNode,"error",!1):changeClass(this.outdiv.parentNode,"error",!0),this.outdiv.contentEditable=!0},EdenUI.ScriptBox.prototype.updateLineHighlight=function(){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.ast=new Eden.AST(this.intextarea.value,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),this.highlighter.ast=this.ast,this.runScript(a),this.highlightContent(this.ast,a,b),this.ast.script&&0==this.ast.script.errors.length?changeClass(this.outdiv.parentNode,"error",!1):changeClass(this.outdiv.parentNode,"error",!0)},EdenUI.ScriptBox.prototype.updateLineCachedHighlight=function(){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.highlightContent(this.ast,a,b)},EdenUI.ScriptBox.prototype.updateEntireHighlight=function(a){this.ast=new Eden.AST(this.intextarea.value,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),this.highlighter.ast=this.ast;var b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd),a&&this.runScript(0),this.highlightContent(this.ast,-1,b),this.ast.script&&0==this.ast.script.errors.length||console.log("indicated error")},EdenUI.ScriptBox.prototype.highlightContent=function(a,b,c){if(this.highlighter.highlight(a,b,c),a.mainDoxyComment&&(b==-1||b>=1&&b<=a.mainDoxyComment.endline)){var d=a.mainDoxyComment.content.match(/@[a-z]+.*\n/gi);if(d)for(var e=0;e=0){d[e].substring(0,f),d[e].substr(f).trim()}}}document.activeElement!==this.intextarea&&$(this.outdiv).find(".fake-caret").addClass("fake-blur-caret");var g=this;$(this.outdiv).find(".eden-number").draggable({helper:function(a){return $("
")},axis:"x",distance:5,drag:function(a,b){var c;if(g.dragint?c=Math.round(g.dragvalue+(b.position.left-g.dragstart)/2):(c=g.dragvalue+.005*(b.position.left-g.dragstart),c=c.toFixed(4)),c!=g.draglast){g.draglast=c,a.target.innerHTML=""+c;var d=a.target.parentNode.textContent;"\n"==d.charAt(d.length-1)&&(d=d.slice(0,-1)),g.replaceLine(g.dragline,d),g.ast=new Eden.AST(g.intextarea.value,(void 0),EdenUI.ScriptBox.consoleAgent,{noindex:!0}),g.highlighter.ast=g.ast,g.highlightContent(g.ast,g.dragline,-1),Eden.Statement.statements[g.currentstatement].setSource(g.intextarea.value,g.ast)}},start:function(a,b){g.edited=!0,g.dragline=g.findElementLineNumber(a.target),g.dragstart=b.position.left;var c=a.target.textContent;c.indexOf(".")==-1?(g.dragvalue=parseInt(c),g.dragint=!0):(g.dragvalue=parseFloat(c),g.dragint=!1),g.draglast=g.dragvalue,$(a.target).addClass("eden-select"),$(g.outdiv).css("cursor","ew-resize")},stop:function(a,b){$(a.target).removeClass("eden-select"),$(g.outdiv).css("cursor","text"),g.dragline=-1},cursor:"move",cursorAt:{top:-5,left:-5}}).click(function(){$(this).draggable({disabled:!0})}).blur(function(){$(this).draggable({disabled:!1})})},EdenUI.ScriptBox.prototype.clear=function(){this.$codearea.html(""),this.setSource("")},EdenUI.ScriptBox.prototype.getLineNumber=function(a){var b=a.value.substr(0,a.selectionStart).split("\n");return this.currentlineno=b.length,this.currentcharno=b[b.length-1].length,this.currentlineno},EdenUI.ScriptBox.prototype.doRebuild=function(){this.refreshentire?(this.updateEntireHighlight(),this.refreshentire=!1):this.updateLineHighlight()},EdenUI.ScriptBox.prototype.runScript=function(a){},EdenUI.ScriptBox.prototype.rebuild=function(){clearTimeout(this.rebuildtimer);var a=this;this.rebuildtimer=setTimeout(function(){a.doRebuild()},this.rebuildinterval)},EdenUI.ScriptBox.prototype.findElementLineNumber=function(a){for(var b=a;b.parentNode!==this.outdiv;)b=b.parentNode;for(var c=0;c
\t
\t\t
State
\t\t\t
\t
\t\t
Script Input
\t\t\t
\t
'),$("#jseden-main").append(this.element),this.consoleele=this.element.find(".explore-console-code"),this.expscripts=this.element.find(".explore-script"),this.expstate=this.element.find(".explore-state"),this.element.resizable({handles:"w",stop:function(a,b){eden.root.lookup("jseden_explorer_width").assign(b.element[0].clientWidth+2,eden.root.scope,Symbol.localJSAgent)}}),eden.root.lookup("jseden_explorer_width").assign(this.element.get(0).clientWidth+2,eden.root.scope,Symbol.localJSAgent),this.console=new EdenUI.ScriptBox(this.consoleele.get(0),{nobuttons:!0}),this.state=new EdenUI.ExplorerState(this.expstate),this.element.on("click",".clear-button",function(b){a.console.clear()}),this.element.on("click",".explore-tab",function(b){var c=b.currentTarget.getAttribute("data-name"),d=a.element.find(".explore-tab-current");d.removeClass("explore-tab-current"),d.addClass("explore-tab-notcurrent"),changeClass(b.currentTarget,"explore-tab-current",!0),changeClass(b.currentTarget,"explore-tab-notcurrent",!1),"state"==c?(a.expstate.css("display","flex"),a.expscripts.css("display","none")):"scripts"==c&&(a.expstate.css("display","none"),a.expscripts.css("display","flex"))});var b=eden.root.lookup("jseden_explorer_enabled"),c=b.value();c?a.state.show():(this.enabled=!1,this.element.hide(),a.state.hide()),b.addJSObserver("explorer",function(b,c){a.enabled=c,c?eden.root.lookup("jseden_explorer_visible").value()&&(a.element.show(),a.state.show()):(a.element.hide(),a.state.hide(),a.capture=!1)});var d=eden.root.lookup("jseden_explorer_visible"),e=d.value();e?a.state.show():(this.element.hide(),a.state.hide()),d.addJSObserver("explorer",function(b,c){c&&a.enabled?(a.element.show(),a.state.show(),eden.root.lookup("jseden_explorer_width").assign(a.element.get(0).clientWidth+2,eden.root.scope,Symbol.localJSAgent)):(a.element.hide(),a.state.capture=!1,a.state.clear(),a.state.hide(),eden.root.lookup("jseden_explorer_width").assign(0,eden.root.scope,Symbol.localJSAgent))});var f=eden.root.lookup("jseden_explorer_zoom"),g=f.value();f.addJSObserver("explorer",function(b,c){if("number"==typeof c&&c>0){var d=10*c;a.state.results.css("font-size",""+d+"pt")}}),void 0===g&&f.assign(1,eden.root.scope,Symbol.defaultAgent)},EdenUI.Explorer.MAXHIGHLIGHTLENGTH=1e3,EdenUI.Explorer.prototype.showConsole=function(){},EdenUI.Explorer.prototype.hideConsole=function(){},EdenUI.ExplorerState=function(a){var b=this;this.outer=a,this.controls=$('
\t\t\t\t\t\t\t
'),this.results=$('
'),this.outer.append(this.controls),this.outer.append(this.results),this.searchbox=this.controls.find(".explorerfilter"),this.watchobs={},this.capture=!1,this.delay=100,this.delay2=20,this.timeout=void 0,this.timeout2=void 0,this.mode="tree",this.index={},this.todo={},this.filter=void 0,this.listener=function(a,c){var d=a.name;!b.capture||c==Symbol.EXPIRED&&void 0!==b.watchobs[d]||void 0!==b.filter&&!b.filter[d]?(b.todo[d]=!0,void 0===b.timeout2&&(b.timeout2=setTimeout(function(){b.timeout2=void 0;var a=b.todo;b.todo={};for(var c in b.index)if(a[c]){var d=eden.root.symbols[c];if(void 0===d){for(var e=0;e
'+d+'
'),m=l.find(".symvalue").get(0);b.updateEntry(k,m),void 0===b.index[d]&&(b.index[d]=[]),b.index[d].push(m),c.appendChild(l.get(0))}$(c).append(b.makeAgentEntry(h.last_modified_by))}});var c=eden.root.lookup("jseden_explorer_search"),d=c.value();d&&this.searchbox.val(searchval),c.addJSObserver("explorer",function(a,c){void 0!==c&&"*JavaScript"!=a.origin.name&&b.searchbox.val(c)}),this.searchbox.on("keyup",function(a){void 0===c.definition&&c.assign(a.target.value,eden.root.scope,Symbol.localJSAgent)});var e=eden.root.lookup("jseden_explorer_watch"),f=e.value();Array.isArray(f)&&(this.clear(),this.watch(f)),e.addJSObserver("explorer",function(a,c){Array.isArray(c)&&(b.capture?b.filter=void 0:b.clear(),b.watch(c))});var g=eden.root.lookup("jseden_explorer_capture");g.addJSObserver("explorer",function(a,c){c?(b.record(),b.controls.find(".capture").addClass("active")):(b.capture=!1,b.controls.find(".capture").removeClass("active"))}),g.value()&&b.record();var h=eden.root.lookup("jseden_explorer_clear");h.addJSObserver("explorer",function(a,c){c&&b.clear()})},EdenUI.ExplorerState.prototype.show=function(){eden.root.addGlobal(this.listener)},EdenUI.ExplorerState.prototype.hide=function(){eden.root.removeGlobal(this.listener)},EdenUI.ExplorerState.prototype.triggerUpdate=function(){if(void 0===this.timeout){var a=this;this.timeout=setTimeout(function(){a.index={},a.timeout=void 0,"list"==a.mode?a.updateList():"tree"==a.mode?a.updateTree():"graph"==a.mode&&a.updateGraph()},this.delay)}},EdenUI.ExplorerState.prototype.updateList=function(){},EdenUI.ExplorerState.prototype.makeAgentEntry=function(a){var b=a.name;if(b.startsWith("*Console"))return $('
console
');if(b.startsWith("*When")){var c=b.split(":"),d=c[1].split("/");return d=d[d.length-1],c=d+":"+c[2],$('
when '+c+"
")}if(b.startsWith("*Action")){var c=b.split(":"),d=c[1].split("/");return d=d[d.length-1],c=d+":"+c[2],$('
action '+c+"
")}if("/"==b.charAt(0)){if(a.eden_definition&&a.eden_definition.startsWith("proc"))return $('
proc '+b+"
")}else if("*"!=b.charAt(0))return $('
'+b+"
")},EdenUI.ExplorerState.prototype.removeEntry=function(a,b){b.innerHTML='DELETED',delete this.watchobs[a],this.triggerUpdate()},EdenUI.ExplorerState.prototype.updateEntry=function(a,b,c){if(a){var d,e,f=a.value();if(a.eden_definition&&a.eden_definition.startsWith("func"))e='func';else{if(c){var g=Eden.edenCodeForValue(f,void 0,2);d=g.lengthis':"=";e=h+" "+d}b.innerHTML=e}},EdenUI.ExplorerState.prototype.makeEntry=function(a,b,c){var d=eden.root.symbols[a],e=$('
'+a+'
'),f=e.find(".symvalue").get(0);this.updateEntry(d,f),void 0===this.index[a]&&(this.index[a]=[]),this.index[a].push(f);var g=0;if(b)for(var h in b)g++,e.append(this.makeEntry(h,b[h],c));return e},EdenUI.ExplorerState.prototype.updateTree=function(){var a=this.capture?Eden.Query.dependencyTree(this.watchobs):this.watchobs;this.results.html("");for(var b in a)this.results.append(this.makeEntry(b,this.capture?a[b]:void 0,this.capture))},EdenUI.ExplorerState.prototype.watch=function(a){this.capture,void 0===this.filter&&a.length>0&&(this.filter={});for(var b=0;b\t\t\t'),this.scripts=$('
'),this.outer.append(this.controls),this.outer.append(this.scripts)},EdenUI.ExplorerScripts.prototype.buildScriptTree=function(a){for(var b={},c=0;c
'+c+"
");this.makeEntry(d,b[c]),a.append(d)}},EdenUI.ExplorerScripts.prototype.update=function(){this.scripts.html("");var a=Eden.Selectors.query(">> script:has-name","id"),b=this.buildScriptTree(a),c=[],d=[];for(var e in Eden.Selectors.cache)d.push(e),c.push(Eden.Selectors.cache[e]);a=Eden.Selectors.queryWithin(c,">> script:has-name","id"),a.push.apply(a,d);var f={External:this.buildScriptTree(a)};this.makeEntry(this.scripts,b),this.makeEntry(this.scripts,f)},EdenUI.Markdown=function(a){this.contents=document.createElement("div"),this.contents.className="markdown-inputhider",this.intextarea=document.createElement("textarea"),this.intextarea.autofocus=!0,this.intextarea.tabIndex=1,this.intextarea.className="hidden-textarea2",this.intextarea.value=a,this.contents.appendChild(this.intextarea),this.codearea=document.createElement("div"),this.codearea.className="markdown-inputCodeArea",this.contents.appendChild(this.codearea),this.outdiv=document.createElement("div"),this.outdiv.contentEditable=!0,this.outdiv.className="markdown-outputcontent",this.outdiv.spellcheck=!1,this.outdiv.tabIndex=2,this.codearea.appendChild(this.outdiv),this.highlighter=new EdenUI.Highlight(this.outdiv,{start:"MARKDOWN",styles:EdenUI.Markdown.styles,clearmodes:{SECTION_TITLE:!0,SECTION_TITLE2:!0,SECTION_TITLE_H1:!0,SECTION_TITLE_H2:!0,COMMENT_BOLD:!0,COMMENT_CODE:!0,COMMENT_ICON:!0,COMMENT_EMPH:!0,COMMENT_ITALIC:!0,END_COMMENT_TAG:!0,COMMENT_TAG:!0,COMMENT_LINK:!0,COMMENT_LINK_END:!0},brline:!0});new EdenUI.ScriptArea.Keyboard(this),new EdenUI.ScriptArea.Mouse(this);this.updateLineCachedHighlight()},EdenUI.Highlight.prototype.MARKDOWN=function(){"#"==this.token&&(this.stream.position-2<=0||"\n"==this.stream.code.charAt(this.stream.position-2))?(this.classes.push("hidden-comment"),this.mode="SECTION_TITLE",this.lineelement.className=this.styles["comment-line"]):"##"==this.token&&(this.stream.position-3<=0||"\n"==this.stream.code.charAt(this.stream.position-3))?(this.classes.push("hidden-comment"),this.mode="SECTION_TITLE2",this.lineelement.className=this.styles["comment-line"]):this.COMMENT()},EdenUI.Markdown.styles={comment:"","hidden-comment":"markdown-comment-hidden",operator:"eden-operator",observable:"eden-observable",storage:"eden-storage",number:"eden-number",string:"eden-string",constant:"eden-constant",string:"eden-string",keyword:"eden-keyword",javascript:"eden-javascript",selector:"eden-selector",selector2:"eden-selector2",selector3:"eden-selector3",function:"eden-function", +type:"eden-type",special:"eden-special",backticks:"eden-backticks",doxycomment:"eden-doxycomment",pathblock:"eden-pathblock","comment-h1":"markdown-comment-h1","comment-h2":"markdown-comment-h2","comment-h3":"eden-comment-h3","horizontal-line":"eden-section-line","comment-line":"eden-comment-line","comment-emph":"eden-comment-emph","comment-bold":"eden-comment-bold","script-line":"markdown-comment-line",doxytag:"markdown-tag","comment-query":"eden-comment-query","block-comment":"eden-blockcomment","comment-ul":"eden-comment-ul","comment-blockquote":"eden-comment-blockquote",script:"eden-script"},EdenUI.Markdown.prototype.getLineNumber=function(){var a=this.intextarea.value.substr(0,this.intextarea.selectionStart).split("\n");return this.currentlineno=a.length,this.currentcharno=a[a.length-1].length,this.currentlineno},EdenUI.Markdown.prototype.hideInfoBox=function(){},EdenUI.Markdown.prototype.disableGotoMode=function(){},EdenUI.Markdown.prototype.rebuild=function(){this.updateLineCachedHighlight()},EdenUI.Markdown.prototype.updateLineCachedHighlight=function(){var a=new Eden.AST(this.intextarea.value,(void 0),{},{noparse:!0,noindex:!0}),b=-1,c=-1;document.activeElement===this.intextarea&&(c=this.intextarea.selectionEnd,b=this.getLineNumber(this.intextarea)),this.highlighter.highlight(a,-1,c)},EdenUI.Markdown.prototype.setValue=function(a){this.intextarea.value=a,this.updateLineCachedHighlight()},EdenUI.Markdown.prototype.moveCaret=function(){this.updateLineCachedHighlight()},EdenUI.Markdown.prototype.checkScroll=function(){},EdenUI.Markdown.prototype.enableGotoMode=function(){},EdenUI.Markdown.prototype.focusText=function(){var a=getCaretCharacterOffsetWithin(this.outdiv),b=getStartCaretCharacterOffsetWithin(this.outdiv);this.intextarea.focus(),this.intextarea.selectionEnd=a,this.intextarea.selectionStart=b},EdenUI.Markdown.prototype.focusOutput=function(){this.setCaretToFakeCaret(),this.outdiv.focus()},EdenUI.Markdown.prototype.setCaretToFakeCaret=function(){var a=$(this.outdiv).find(".fake-caret").get(0);if(a){var b=document.createRange(),c=window.getSelection();a.nextSibling&&(a=a.nextSibling),b.setStart(a,0),b.collapse(!0),c.removeAllRanges(),c.addRange(b),$(this.outdiv).remove(".fake-caret")}},EdenUI.Markdown.html=function(a,b,c){var d=document.createElement("div"),e=new EdenUI.Highlight(d,{start:"MARKDOWN",styles:EdenUI.Markdown.styles,clearmodes:{SECTION_TITLE:!0,SECTION_TITLE2:!0,SECTION_TITLE_H1:!0,SECTION_TITLE_H2:!0,COMMENT_BOLD:!0,COMMENT_CODE:!0,COMMENT_ICON:!0,COMMENT_EMPH:!0,COMMENT_ITALIC:!0,END_COMMENT_TAG:!0,COMMENT_TAG:!0,COMMENT_LINK:!0,COMMENT_LINK_END:!0},brline:!0});if(EdenUI.Markdown.styles["hidden-comment"]="eden-comment-hidden",EdenUI.Markdown.styles["script-line"]="markdown-comment-line2",e.ast={stream:new EdenStream(a)},e.highlight(e.ast,-1,-1,void 0),EdenUI.Markdown.styles["hidden-comment"]="markdown-comment-hidden",EdenUI.Markdown.styles["script-line"]="markdown-comment-line",b)return d.childNodes[0].innerHTML;for(var f="",g=0;g
'+f+"
":f},EdenUI.ProjectDetails=function(a,b){var c=this;this.projectid=a,this.meta=void 0,this.newtab=b;var d=mobilecheck();this.obscurer=$(''),this.obscurer.on("click",function(a){a.target===a.currentTarget&&c.remove()}),d?this.dialog=$(''):this.dialog=$(''),this.obscurer.append(this.dialog),document.body.appendChild(this.obscurer.get(0)),Eden.DB.getMeta(a,function(b){if(console.log("DETAILS META",b),null!==b[0].image){var d=$('');c.dialog.append(d)}console.log(b[0].projectMetaData);var e=null!==b[0].projectMetaData?JSON.parse(b[0].projectMetaData):{},f=document.createElement("div");f.className="markdown";var g=new showdown.Converter,h=e&&e.description?e.description.replace(/\@author[^\n]*/g,"").replace(/\s(#[a-zA-Z0-9]+)/g,' $1'):"",i=b[0].ownername;if(e&&e.description){var j=new Eden.AST.DoxyComment(e.description,0,0),k=j.getProperty("author");if(k&&k.length>0){if(i=k[0]+(k.length>1?" et al.":""),k.length>1){h+="\n\n__Authors:__";for(var l=0;l\t\t\t'+o.toFixed(1)+'by:'+i+'\t\t\t, '+get_time_diff(new Date(n[0],n[1]-1,n[2],n[3],n[4],n[5]).getTime()/1e3)+"\t\t"),q=$('
');c.dialog.append(q),c.dialog.append(p),q.on("click",".projectdetails-star",function(b){if(0!=Eden.DB.isLoggedIn()){for(var c=b.currentTarget.parentNode,d=0,e=0;e<5;e++)c.childNodes[e].className="projectdetails-star"+(d>0?"":" selected"),c.childNodes[e].innerHTML="",c.childNodes[e]===b.currentTarget&&(d=e+1);Eden.DB.rate(a,d)}});var r=q[0];if(o)for(var s=Math.floor(o),l=0;l<5;l++)r.childNodes[l].className="projectdetails-star"+(l>=s?"":" average"),r.childNodes[l].innerHTML="";var t=b[0].myrating;if(t)for(var l=0;l<5;l++)r.childNodes[l].className="projectdetails-star"+(l>=t?"":" selected"),r.childNodes[l].innerHTML="";var u;u=b[0].owner==Eden.DB.userid?$('

'):$('

'),u.on("click",".openproject",function(){c.remove(),c.newtab?window.open(window.location.origin+window.location.pathname+"?load="+a):($(".loadmodal").show(),Eden.Project.load(a))}),u.on("click",".deleteproject",function(){confirm("Are you sure you want to delete this project?")&&(c.remove(),Eden.DB.remove(a))}),u.on("click",".restoreproject",function(){c.remove(),eden.root.lookup("jseden_project_mode").assign("restore",eden.root.scope,Symbol.defaultAgent),Eden.Project.load(a)}),u.on("click",".followproject",function(b){Eden.DB.follow(a,function(a){a&&b.currentTarget.parentNode.removeChild(b.currentTarget)})}),u.append($('')),c.dialog.append(u),Eden.DB.search(":parent("+a+")",1,1,void 0,function(b){if(b.length>0){var d=document.createElement("div");d.className="projectdetails-forks";for(var e=0;e0){var d=document.createElement("div");d.style.borderTop="1px solid #aaa",d.style.height="10px",c.dialog.get(0).appendChild(d)}for(var e=0;e",f.appendChild(g);var i=document.createElement("div");i.style.padding="0",i.style.marginBottom="3px",i.className="markdown",f.appendChild(i),f.className="feedback-result",i.innerHTML=b.makeHtml(a[e].comment),c.dialog.get(0).appendChild(f)}})})})},EdenUI.ProjectDetails.prototype.remove=function(){document.body.removeChild(this.obscurer.get(0))},EdenUI.ProjectDetails.searchProjects=function(a,b,c,d,e,f){var g=c?c:7,h=1;a.on("click",".more",function(c){a.find(".more").remove(),h++,Eden.DB.search(b,h,g,f,function(c){EdenUI.ProjectDetails._searchProjects(b,a,!b.startsWith(":me"),c,g,h,e)}),c.stopPropagation()}),b||(b=""),Eden.DB.search(b,1,g,f,function(c){EdenUI.ProjectDetails._searchProjects(b,a,!b.startsWith(":me"),c,g,h,e),d&&d(c)})},EdenUI.ProjectDetails._searchProjects=function(a,b,c,d,e,f,g){var h=e?e:7;if(void 0!==d){for(var i=mobilecheck()?120:200,j=0;j0?s[0]:l.ownername}else k=l.ownername;else k=get_time_diff(new Date(m[0],m[1]-1,m[2],m[3],m[4],m[5]).getTime()/1e3),null===l.publicVersion&&(p=!0);var t;t=null!==o?$('
'+n+'
'+k+"
"):$('
'+n+'
'+k+"
"),b.append(t),t.click(function(a){var b=a.currentTarget.getAttribute("data-pid");console.log("Load project: "+b),new EdenUI.ProjectDetails(b,g)});var u=null!==l.overallRating?l.overallRating/l.numRatings:0,v=$('
');t.append(v);var w=v.get(0);if(u)for(var x=Math.floor(u),y=0;y<5;y++)w.childNodes[y].className="projectdetails-star"+(y>=x?"":" average")}d.length==h&&b.append($('
'))}},EdenUI.ProjectDetails.localProjects=function(a,b,c){if(void 0!==b)for(var d=0;d0?j[0]:f.author}else e=f.author;var k;k=null!==h?$('
'+g+'
'+e+"
"):$('
'+g+'
'+e+"
"),a.append(k),k.click(function(a){var b=a.currentTarget.getAttribute("data-path");console.log("Load project: "+b),Eden.Project.newFromExisting(b,function(){})});var l=f.rating;if(l){var m=$('
\t\t\t\t\t\t
');k.append(m);var n=m.get(0);if(l)for(var o=Math.floor(l),p=0;p<5;p++)n.childNodes[p].className="projectdetails-star"+(p>=o?"":" average")}}},EdenUI.Feedback=function(){function a(a,b){if(b)f.odialog.style.display="initial",f.clear(),f.updateComments(""),clearInterval(f.interval),f.interval=setInterval(function(){f.updateComments("")},5e3);else{f.odialog.style.display="none",clearInterval(f.interval);var c;f.interval=setInterval(function(){Eden.DB.searchComments(eden.project,"",1,10,c,function(a){if(void 0===c&&a.length>0)return void(c=a[0].commentID);for(var b=0;b0&&(c=a[0].commentID)})},1e4)}}var b=document.createElement("div");b.className="feedback-icon noselect",b.innerHTML="",document.getElementById("jseden-views").appendChild(b),this.odialog=document.createElement("div"),this.odialog.className="feedback-dialog",this.odialog.style.display="none",document.getElementById("jseden-views").appendChild(this.odialog),this.dialog=document.createElement("div"),this.dialog.className="feedback-scroller",this.odialog.appendChild(this.dialog);var c=document.createElement("div");c.className="feedback-title",c.innerHTML='',this.dialog.appendChild(c);var d=eden.root.lookup("jseden_feedback_visible"),e=eden.root.lookup("jseden_feedback_width"),f=this;b.addEventListener("click",function(a){void 0===d.definition&&d.assign(!0,eden.root.scope,Symbol.hciAgent)});var g=c.childNodes[2];g.addEventListener("click",function(a){void 0===d.definition&&d.assign(!1,eden.root.scope,Symbol.hciAgent)}),e.assign(420,eden.root.scope,Symbol.defaultAgent),d.addJSObserver("feedback",a),a(d,d.value());var h=new EdenUI.Markdown(""),i=document.createElement("div");i.className="feedback-input",i.appendChild(h.contents);var j=document.createElement("div");j.className="feedback-buttons";var k=document.createElement("div");k.textContent="Sign-in to post a comment...",k.style.display="none",k.className="feedback-signinmsg",this.dialog.appendChild(k),Eden.DB.isLoggedIn()||(i.style.display="none",j.style.display="none",k.style.display="block"),this.dialog.appendChild(i),this.dialog.appendChild(j),this.results=document.createElement("div"),this.dialog.appendChild(this.results),this.results.addEventListener("click",function(a){"feedback-delete"==a.srcElement.className?(console.log("delete",a.srcElement.getAttribute("data-id")),Eden.DB.removeComment(a.srcElement.getAttribute("data-id")),f.results.removeChild(a.srcElement.parentNode.parentNode)):"eden-hl-play"==a.srcElement.className&&(console.log("PLAY COMMENT",a.srcElement.getAttribute("data-src")),eden.execute2(a.srcElement.getAttribute("data-src")))});var l=document.createElement("button");l.className="script-button",l.textContent="Comment",j.appendChild(l),l.addEventListener("click",function(){Eden.DB.postComment(eden.project,h.intextarea.value),h.setValue(""),f.updateComments("")}),this.cache=[],setInterval(function(){f.updateTimes()},2e4),Eden.DB.listenTo("login",this,function(a){a&&(i.style.display="block",j.style.display="block",k.style.display="none")})},EdenUI.Feedback.prototype.clear=function(){for(this.cache=[];this.results.lastChild;)this.results.removeChild(this.results.lastChild)},EdenUI.Feedback.prototype.updateTimes=function(){for(var a=0;a0?this.cache[0].commentID:void 0,e=this.results.firstChild;Eden.DB.searchComments(eden.project,a,1,100,d,function(a){if(a)for(var f=0;f':""),g.appendChild(h);var j=document.createElement("div");j.style.padding="0",j.style.marginBottom="3px",j.className="markdown",g.appendChild(j),g.className="feedback-result"+(d?" newitem":""),j.innerHTML=c.makeHtml(a[f].comment),e?b.results.insertBefore(g,e):b.results.appendChild(g),$(j).find("code").each(function(a,b){"PRE"==b.parentNode.nodeName&&(b.innerHTML=EdenUI.Highlight.html(b.textContent,!1,!0))})}b.cache=a.concat(b.cache)})}; \ No newline at end of file diff --git a/plugins/jseden-plugins.min.js b/plugins/jseden-plugins.min.js index de9508f8b..6e87d7f65 100644 --- a/plugins/jseden-plugins.min.js +++ b/plugins/jseden-plugins.min.js @@ -1,7 +1,7 @@ function getCaretCharacterOffsetWithin(a){var b,c=0,d=a.ownerDocument||a.document,e=d.defaultView||d.parentWindow;if("undefined"!=typeof e.getSelection){if(b=e.getSelection(),b.rangeCount>0){var f=e.getSelection().getRangeAt(0),g=f.cloneRange();g.selectNodeContents(a),g.setEnd(f.endContainer,f.endOffset),c=g.toString().length}}else if((b=d.selection)&&"Control"!=b.type){var h=b.createRange(),i=d.body.createTextRange();i.moveToElementText(a),i.setEndPoint("EndToEnd",h),c=i.text.length}return c}function getStartCaretCharacterOffsetWithin(a){var b,c=0,d=a.ownerDocument||a.document,e=d.defaultView||d.parentWindow;if("undefined"!=typeof e.getSelection){if(b=e.getSelection(),b.rangeCount>0){var f=e.getSelection().getRangeAt(0),g=f.cloneRange();g.selectNodeContents(a),g.setEnd(f.startContainer,f.startOffset),c=g.toString().length}}else if((b=d.selection)&&"Control"!=b.type){var h=b.createRange(),i=d.body.createTextRange();i.moveToElementText(a),i.setEndPoint("EndToEnd",h),c=i.text.length}return c}function get_time_diff(a){var b=1e3*a,c=Date.now(),d=new Date,e=6e4*d.getTimezoneOffset();if(b-=e,isNaN(b))return"";if(b5)return new Date(b).toDateString();var i="";if(g>0)i+=g,i+=g>1?" days ago":" day ago";else if(h.getUTCHours()>0){var j=h.getUTCHours();i+=j,i+=j>1?" hours ago":" hour ago"}else{var k=h.getUTCMinutes();if(k>0)i+=k,i+=k>1?" minutes ago":" minute ago";else{var l=h.getUTCSeconds();i+=l,i+=" seconds ago"}}return i}function changeClassString(a,b,c){var d=a.split(" "),e=d.indexOf(b);if(e==-1){if(c)return d.push(b),d.join(" ")}else if(!c)return d.splice(e,1),d.join(" ");return a}function changeClass(a,b,c){if(a){var d=changeClassString(a.className,b,c);d!=a.className&&(a.className=d)}}function makeCurlyBrace(a,b,c,d,e,f){var g=a-c,h=b-d,i=Math.sqrt(g*g+h*h);g/=i,h/=i;var j=a+f*e*h,k=b-f*e*g,l=a-.25*i*g+(1-f)*e*h,m=b-.25*i*h-(1-f)*e*g,n=a-.5*i*g+e*h,o=b-.5*i*h-e*g,p=c+f*e*h,q=d-f*e*g,r=a-.75*i*g+(1-f)*e*h,s=b-.75*i*h-(1-f)*e*g;return"M "+a+" "+b+" Q "+j+" "+k+" "+l+" "+m+" T "+n+" "+o+" M "+c+" "+d+" Q "+p+" "+q+" "+r+" "+s+" T "+n+" "+o}function EdenScriptGutter(a,b,c){function d(){console.log("GUTTER HOLD"),i=void 0;for(var a=0;a');var h="http://www.w3.org/2000/svg";this.brace=document.createElementNS(h,"svg"),this.brace.style.position="absolute",this.brace.style.display="none",this.brace.setAttribute("width","22"),this.brace.style.left="10px",this.bracepath=document.createElementNS(h,"path"),this.bracepath.setAttribute("style","stroke: #444; fill: none; stroke-width: 3px"),this.brace.appendChild(this.bracepath),this.gutter=this.$gutter.get(0),a.insertBefore(this.gutter,a.firstChild),a.insertBefore(this.brace,a.firstChild),this.ast=void 0,this.lines=[],this.errors=[],this.agents={},this.hovering=!1,this.ctx=void 0,this.edits=void 0;var i,j,k=!1,l=0,m=!1,n=!1;this.curline=-1,this.textwidth=getTextWidth("M","14px/20px Roboto Mono,monospace"),g.startHover=e,g.endHover=f,this.$gutter.on("mousedown",".eden-gutter-item",function(a){if(!this.edits&&!g.ast.hasErrors()){var b=parseInt(a.target.getAttribute("data-line"));j=a.shiftKey,l=b,m=!!g.lines[b]&&g.lines[b].selected,k=a.shiftKey,n=g.lines[b]&&g.lines[b].live;var c=g.ast.getStatementByLine(b);if(c){var e=c.getRange();if(g.lines[b].live&&!j)if(g.lines[b].selected)for(var f=0;f"+b+"";case"undefined":return"@";case"string":return""+b+"";case"number":return""+b+"";default:return b}}function _formatFramerVal(a){var b=Eden.prettyPrintValue("",a,200,!1,!1);switch(typeof a){case"boolean":return""+b+"";case"undefined":return"@";case"string":return""+b+"";case"number":return""+b+"";default:return b}}CSSUtil={},CSSUtil.setStyle=function(a,b){function c(a,b){return"-"+b.toLowerCase()}var d=a.style;if(void 0===b)d.cssText="";else if("object"==typeof b){var e=/([A-Z])/g,f=/^\w*[A-Z]\w*$/,g="";for(var h in b)if("string"==typeof b[h]){var i;i=f.test(h)?h.replace(e,c):h,g=g+i+": "+b[h]+";\n"}d.cssText=g}else d.cssText=b},CSSUtil.getStyle=function(a){for(var b=document.styleSheets,c=b.length-1;c>=0;c--)for(var d=b[c].cssRules,e=d.length-1;e>=0;e--)if(d[e].type==CSSRule.STYLE_RULE&&d[e].selectorText==a)return d[e].style;var f=document.getElementById("javascript-injected-styles");if(null===f){var g=document.getElementsByTagName("body")[0];f=document.createElement("style"),f.id="javascript-injected-styles",g.appendChild(f)}var h=f.sheet;return h.insertRule(a+"{ }",h.cssRules.length),h.cssRules[0].style},EdenUI.plugins.ScriptInput=function(a,b){EdenUI.plugins.ScriptInput.title=Language.ui.input_window.title,EdenUI.plugins.ScriptInput.description=Language.ui.input_window.description;var c=this;$(document.body).delegate(null,"drop",function(b){if(void 0!==b.originalEvent.dataTransfer){var c=b.originalEvent.dataTransfer.getData("selector");if(!c||""==c)return console.log(b.originalEvent.dataTransfer.files),void b.preventDefault();var d=(c.sp,c.replace(/[^a-zA-Z0-9]+/g,""));eden.root.lookup("view_"+d+"_tabs").assign([c],eden.root.scope,Symbol.hciAgent),a.createView(d,"ScriptInput"),eden.root.lookup("view_"+d+"_current").assign(0,eden.root.scope,Symbol.hciAgent)}}).delegate(null,"dragover",function(a){a.preventDefault()}),this.createCommon=function(a,b,c,d){function e(a,b){b?(M.style.display="flex",I.parentNode.style.top="35px"):(M.style.display="none",I.parentNode.style.top="0")}function f(a,b){b?(N.style.display="flex",O.codearea.style.top="30px"):(N.style.display="none",O.codearea.style.top="0")}function g(a,b){O.setReadonly(b)}function h(a,b){"number"==typeof b&&b>=0&&b=0?T.push(d[g]):T.push(new Eden.Fragment(b[f]))}R=-2,h(aa,aa.value())}}function j(b){""==b&&(b="*");var c=eden.root.lookup("view_"+a+"_query").value();void 0===c&&(c=".type(script).name");var d=Eden.Selectors.query(c,"path,name,remote,executed,type");O.outdiv.innerHTML="";for(var e=0;e
'+f+"
"+g+"");O.outdiv.appendChild(i.get(0))}}function k(){if(R>=0){var a='',b=T[R];b&&b.scratch&&!b.edited?a+='':b&&b.scratch&&(a+=''),L.html(a)}else L.html("")}function l(a,b,c,d,e){var f=document.createElement("div");f.style.left=""+160*e+"px";var g="agent-tab noselect";g+=d?" agent-tab-current handle":" agent-tab-notcurrent";var h=T[b].getTitle();h.length>18&&(h="..."+h.slice(-15));var i;i=T[b]&&T[b].ast?T[b].ast.errors&&T[b].ast.errors.length>0?"tab-icon errored":T[b].originast&&T[b].originast.executed?"tab-icon executed":"tab-icon":"tab-icon noagent";var j="";T[b].remote?j="":void 0===T[b].origin?j="":T[b].locked&&(j=""),f.className=g,f.innerHTML=""+j+""+h+"",f.draggable=!0,f.setAttribute("data-index",b),a.appendChild(f)}function m(){for(;M.firstChild;)M.removeChild(M.firstChild);var a=aa.value(),b=document.createElement("div");if(b.className="agent-tab-more",b.innerHTML="",M.appendChild(b),T.length>3&&0!=a){var c=document.createElement("div");c.className="agent-tableft noselect",M.appendChild(c)}var d=document.createElement("div");d.className="agent-tab-container",M.appendChild(d),a>ea+(fa-1)&&(ea=a-(fa-1)),a3&&a!=T.length-1){var h=document.createElement("div");h.className="agent-tabright noselect",M.appendChild(h)}var i=document.createElement("div");i.className="script-input-windowcontrols",i.innerHTML="",M.appendChild(i)}function n(b){return"view_"+a+"_"+b}function o(){R>=0&&T[R]&&(T[R].originast?(console.log("ONRUN",T[R].originast),T[R].ast.executeStatement(T[R].originast,0,T[R])):T[R].ast.execute(T[R]),m())}function p(){aa.assign(-1,eden.root.scope,Symbol.localJSAgent)}function q(a){var b=a.currentTarget.getAttribute("data-index");aa.assign(parseInt(b),eden.root.scope,Symbol.hciAgent),O.intextarea.focus()}function r(a){var b=parseInt(a.currentTarget.parentNode.getAttribute("data-index"));if(b>=0&&b=c.length&&aa.assign(d-1,eden.root.scope,Symbol.localJSAgent)}a.stopPropagation()}function s(){var a=R;a--,a>=0&&aa.assign(a,eden.root.scope,Symbol.hciAgent)}function t(){var a=R;a++,a=0&&(d.splice(e,1),e--,e<0&&(e=0),e
\t
\t\t
\t\t
\t
'),I=H.find(".inputhider").get(0),J=H.find(".info-bar").get(0),K=H.find(".agent-tabs"),L=H.find(".control-bar"),M=K.get(0),N=L.get(0);$(J).hide();var O=new EdenUI.ScriptArea;I.appendChild(O.contents);var P=0,Q=void 0;I.addEventListener("scroll",function(a){void 0!==Q&&clearTimeout(Q),document.activeElement!==O.outdiv&&(Q=setTimeout(function(){Q=void 0;var a=I.scrollTop;a=Math.floor((a-50)/20),a<0&&(a=0),Math.abs(a-P)>=50&&(console.log("FORCE RE HIGHLIGHT",a),O.highlighter.setScrollTop(a),P=a,O.updateCachedHighlight(),O.gutter.clear())},100))});var R=-1,S=[],T=[],U="view_"+a+"_current",V="view_"+a+"_showtabs",W="view_"+a+"_showbuttons",X="view_"+a+"_tabs",Y="view_"+a+"_zoom",Z="view_"+a+"_readonly",_=eden.root.lookup(X),aa=(eden.root.lookup(Y),eden.root.lookup(U)),ba=eden.root.lookup(V),ca=eden.root.lookup(W),da=eden.root.lookup(Z),ea=0,fa=3,ga=1;void 0===ba.value()&&void 0===ba.definition&&ba.assign(!0,eden.root.scope,Symbol.defaultAgent),ba.addJSObserver("scriptview_"+a,e),e(ba,ba.value()),void 0===ca.value()&&void 0===ca.definition&&ca.assign(!0,eden.root.scope,Symbol.defaultAgent),ca.addJSObserver("scriptview_"+a,f),f(ca,ca.value()),da.addJSObserver("scriptview_"+a,g),g(da,da.value()),aa.addJSObserver("scriptview_"+a,h),_.addJSObserver("scriptview_"+a,i),i(_,_.value()),void 0===_.value()&&void 0===_.definition&&_.assign([],eden.root.scope,Symbol.defaultAgent),void 0===aa.value()&&void 0===aa.definition&&aa.assign(-1,eden.root.scope,Symbol.defaultAgent),Eden.Fragment.listenTo("changed",O,function(a){a===T[R]&&(m(),k(),O.refresh())}),Eden.Fragment.listenTo("locked",O,function(a){a===T[R]&&(console.log("LOCKED",a),h(aa,aa.value()))}),Eden.Fragment.listenTo("unlocked",O,function(a){a===T[R]&&h(aa,aa.value())}),Eden.Fragment.listenTo("errored",O,function(a){}),Eden.Fragment.listenTo("status",O,function(a){a===T[R]&&(m(),k())}),Eden.Fragment.listenTo("gotoline",O,function(a,b){for(var c=0;c').html(h.contents).dialog({appendTo:"#jseden-views",title:d,width:600,height:i,minHeight:203,minWidth:300,classes:{"ui-dialog":"input-dialog ui-front no-print"},resizeStop:h.resize,draggable:!1}),$dialog.parent().draggable({handle:".handle",cancel:".agent-tab-notcurrent",stop:function(a,b){var c=eden.root;c.beginAutocalcOff(),f(g,"x").assign(b.position.left,eden.root.scope,Symbol.hciAgent),f(g,"y").assign(b.position.top,eden.root.scope,Symbol.hciAgent),c.endAutocalcOff()},start:function(a,b){if(f(g,"x").eden_definition||f(g,"y").definition)return!1}}),h.confirmClose=!1,h},this.createEmbedded=function(a,b,d){var e=c.createCommon(a,b,d,!0);return e},a.views.ScriptInput={dialog:this.createDialog,embed:this.createEmbedded,title:Language.ui.input_window.title,category:a.viewCategories.interpretation,menuPriority:0},a.history=this.history,b()},EdenUI.plugins.ScriptInput.getRequiredHeight=function(a,b){return b?55+20*a+20:45+20*a+20},EdenUI.plugins.ScriptInput.dialogs={},EdenUI.plugins.ScriptInput.dialogs.newAgent=function(a,b){var c=$('
'),d=$('
Create Tab:

'),e=d.find(".searchbox").get(0),f=d.find(".namebox").get(0);d.on("click",".button-cancel",function(){a.get(0).removeChild(c.get(0)),b(!1)}),d.on("click",".button-search",function(){a.get(0).removeChild(c.get(0)),b(!0,e.value)}),d.on("click",".button-new",function(){eden.project.addAction(f.value),a.get(0).removeChild(c.get(0)),b(!0,"."+f.value)}),c.append(d),a.append(c)},EdenUI.plugins.ScriptInput.dialogs.localChanges=function(a,b,c){EdenUI.plugins.ScriptInput.dialogs.hide&&EdenUI.plugins.ScriptInput.dialogs.hide();var d=$('
'),e=$('
You have local changes to '+c.name+', use these?

');e.on("click",".button-ok",function(){a.get(0).removeChild(d.get(0)),EdenUI.plugins.ScriptInput.dialogs.hide=void 0,b(!0)}).on("click",".button-cancel",function(){a.get(0).removeChild(d.get(0)),EdenUI.plugins.ScriptInput.dialogs.hide=void 0,b(!1)}),d.append(e),a.append(d),EdenUI.plugins.ScriptInput.dialogs.hide=function(){EdenUI.plugins.ScriptInput.dialogs.hide=void 0,a.get(0).removeChild(d.get(0)),b(!1)}},EdenUI.plugins.ScriptInput.dialogs.uploadFailed=function(a,b){var c=$('
'),d=$('
Upload Failed! Try again...

');d.on("click",".button-upload",function(){a.get(0).removeChild(c.get(0)),b(!0)}).on("click",".button-cancel",function(){a.get(0).removeChild(c.get(0)),b(!1)}),c.append(d),a.append(c)},EdenUI.plugins.ScriptInput.dialogs.uploadAgent=function(a,b){var c=$('
'),d=$('
Upload agent. Give an optional version name:

Public

'),e=d.find(".tagname"),f=d.find(".makepublic"),g=e.get(0).nextSibling,h=!0;d.on("input blur",".script-subdialog-text",function(){var a=e.get(0).value;console.log(a),""==a?(h=!0,g.className="addnew"):/^[a-z][a-z0-9]+$/i.test(a)?(g.className="addnew",h=!0):(g.className="invalid",h=!1)}).on("click",".button-upload",function(){h&&(a.get(0).removeChild(c.get(0)),b(!0,e.get(0).value,f.get(0).checked))}).on("click",".button-cancel",function(){a.get(0).removeChild(c.get(0)),b(!1)}),c.append(d),a.append(c)},EdenUI.plugins.ScriptInput.dialogs.showHistory=function(a,b,c){function d(){for(var a=j.get(0);a.firstChild;)a.removeChild(a.firstChild);g=void 0}function e(a){if(c.history[a])for(var b=c.history[a].length-1;b>=0;b--){var d=$('
');l==b&&(d.addClass("current"),d.addClass("original"),g=d),d.get(0).setAttribute("data-index",""+b);var e=$('
'),f=$('
'),h=$('
');f.html(get_time_diff(c.history[a][b].time)),f.get(0).title=c.history[a][b].time,c.history[a][b].bookmark&&e.addClass("bookmarked"),c.history[a][b].title?h.html(c.history[a][b].title):h.html("[Autosave]"),d.append(e),d.append(h),d.append(f),j.append(d)}}function f(a){if(Eden.DB.getVersions(c.name,function(b){if(null!=b)for(var c=0;c');b[c].saveID==m&&(d.addClass("original"),l==-1&&(d.addClass("current"),g=d)),d.get(0).setAttribute("data-version",""+b[c].saveID);var f="script-history-stored";f+=0==b[c].public?" private":b[c].mine?" mine":" public";var h=$('
'),i=b[c].date.split(/[- :]/),k=$('
'+get_time_diff(new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5]).getTime()/1e3)+"
"),n=b[c].tag;null==b[c].tag&&(n=b[c].saveID);var o=$('
'+n+" ("+b[c].saveID+") by "+b[c].name+"
");d.append(h),d.append(o),d.append(k),j.append(d),b[c].saveID==m&&e(a)}}),c.history.origin){var b=$('
');"origin"==m&&(b.addClass("original"),l==-1&&(b.addClass("current"),g=b)),b.get(0).setAttribute("data-version","origin");var d="script-history-bookmark",f=$('
'),h="origin";c.meta&&c.meta.file&&(h=c.meta.file);var i=$('
'+h+"
");b.append(f),b.append(i),j.append(b),"origin"==m&&e("origin")}}var g,h=$('
'),i=$('
Agent History:
'),j=i.find(".script-history-list"),k=!0,l=c.index,m=c.meta.saveID;f(c.meta.saveID),i.on("input",".script-history-content",function(a){var b=parseInt(a.target.parentNode.getAttribute("data-index"));c.history[c.meta.saveID][b].title=a.target.textContent,c.saveHistory(),c.makeSnapshot(b)}).on("click",".script-history-item",function(a){var b=a.currentTarget.getAttribute("data-version");if(b)"origin"!=b&&(b=parseInt(b)),m=b,d(),l=-1,f(m);else{var c=parseInt(a.currentTarget.getAttribute("data-index"));l=c,g&&g.removeClass("current"),g=$(a.currentTarget),g.addClass("current")}}).on("click",".script-history-bookmark",function(a){var b=parseInt(a.target.parentNode.getAttribute("data-index"));void 0===c.history[c.meta.saveID][b].bookmark?c.history[c.meta.saveID][b].bookmark=!0:c.history[c.meta.saveID][b].bookmark=!c.history[c.meta.saveID][b].bookmark,c.saveHistory(),c.history[c.meta.saveID][b].bookmark?a.target.className="script-history-bookmark bookmarked":a.target.className="script-history-bookmark"}).on("click",".button-ok",function(){k&&(a.get(0).removeChild(h.get(0)),console.log("Rollback to: "+l+"@"+m),b(!0,l,m))}).on("click",".button-cancel",function(){a.get(0).removeChild(h.get(0)),b(!1)}),h.append(i),a.append(h)},EdenUI.plugins.ScriptInput.dialogs.browseAgents=function(a,b,c){function d(a,b,d){Eden.DB.getDirectory(d,function(e){if(void 0!==e){var f=[];for(var g in e)f.push(g);f.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())});for(var h=0;h'),m=$('
'),n=$('
'),o=$('
');(function(a,b,d,e,f){Eden.DB.getMeta(b,function(b,f){if(f){var g="";if(f.date){var h=f.date.split(/[- :]/);g=get_time_diff(new Date(h[0],h[1]-1,h[2],h[3],h[4],h[5]).getTime()/1e3)}var i=f.title;if("Script View"!=i&&void 0!==i||(i=""),a.html(d+' '+i+''+g+""),f.remote&&f.defaultID==-1&&f.latestID==-1)e.html(" ");else{var j=$('');e.append(j),c.indexOf(b)>=0&&(j.get(0).checked=!0)}}else a.html(d),e.html(" ")})}).call(this,n,j,k,o,m),Eden.Agent.agents[j]&&l.addClass("loaded"),l.get(0).setAttribute("data-path",j),l.get(0).setAttribute("data-depth",""+(b+1)),l.append(m),l.append(o),l.append(n),void 0===a||void 0===a.nextSibling?i.append(l):i.get(0).insertBefore(l.get(0),a.nextSibling)}}})}function e(a){for(var b=parseInt(a.getAttribute("data-depth")),c=a.nextSibling;c;){var d=parseInt(c.getAttribute("data-depth"));if(!(d>b))break;var e=c.nextSibling;i.get(0).removeChild(c),c=e}}function f(){a.append(g),i.scrollTop(j)}var g=$('
'),h=$('
'+Language.ui.input_window.browse_agents+':
'),i=h.find(".script-agents-list"),j=0,k={};return d(void 0,0,""),h.on("click",".script-agents-item",function(a){}).on("click",".script-agents-expand",function(a){var b=a.currentTarget.parentNode.getAttribute("data-path"),c=parseInt(a.currentTarget.parentNode.getAttribute("data-depth"));a.currentTarget.className.indexOf("expanded")<0?(d(a.currentTarget.parentNode,c,b),changeClass(a.currentTarget,"expanded",!0)):(e(a.currentTarget.parentNode),changeClass(a.currentTarget,"expanded",!1))}).on("change",".script-agents-cbcont input",function(a){var b=a.currentTarget.parentNode.parentNode.getAttribute("data-path");a.currentTarget.checked?k[b]=!0:k[b]=!1}).on("click",".button-add",function(){j=i.scrollTop(),a.get(0).removeChild(g.get(0)),b(!0,k)}).on("click",".button-cancel",function(){j=i.scrollTop(),a.get(0).removeChild(g.get(0)),b(!1)}),g.append(h),{show:f}},EdenScriptGutter.prototype.clear=function(){for(this.ast=void 0,this.lines=[],this.curline=-1,this.hideBrace();this.gutter.firstChild;)this.gutter.removeChild(this.gutter.firstChild)},EdenScriptGutter.prototype.setBaseAST=function(a,b){for(;this.gutter.firstChild;)this.gutter.removeChild(this.gutter.firstChild);this.ast=a,this.errors=b,this.lines=[],this.edits=void 0,this.hideBrace()},EdenScriptGutter.prototype.executeSelected=function(){if(void 0!==this.ast)for(var a=0;a0)){if(this.curline>=0){var c=this.ast.getStatementByLine(this.curline); -if(c){var d=c.getRange(),e=Math.floor((d[1]-d[0])/2)+d[0];b||(changeClass(this.gutter.childNodes[e],"play",!1),changeClass(this.gutter.childNodes[e],"current",!1))}}this.curline=a-1;var c=this.ast.getStatementByLine(a-1);if(c){c.getRange||console.error("NO GETRANGE",c);var d=c.getRange();if(d[0]0?(j.errors[0].line==a+1?(c+=" error",e="",i=j.errors[0].messageText(),h=a):"runtime"==j.errors[0].type&&(c+=" error",e="",i=j.errors[0].messageText()),this.lines[a].errored=!0,g=!0):(d.errors.length>0&&d.errors[0].line==a+1&&(this.lines[a].errored=!0,c+=" error",e="",i=d.errors[0].messageText()),this.lines[a].errored&&(g=!0,this.lines[a].errored=!1),j.warning&&(c+=" warning",e="",g=!0,j.warning&&(i=j.warning.messageText())),1==j.executed?(c+=" executed",g=!0,this.lines[a].executed=!0):2==j.executed?(c+=" guarded",g=!0,this.lines[a].executed=!0):3==j.executed&&(c+=" errorblock",g=!0)),this.lines&&this.lines[a]&&(this.lines[a].executed&&j.executed<=0&&(g=!0,this.lines[a].executed=!1),this.lines[a].selected&&(c+=" select"),this.lines[a].live&&(c+=" live"))):(this.errors&&this.errors.length>0&&this.errors[0].line==a+1?this.lines[a].errored||(c+=" error",e="",i=this.errors[0].messageText(),h=a,this.lines[a].errored=!0,g=!0):this.lines[a].errored&&(g=!0,this.lines[a].errored=!1,i=""),this.lines[a].executed&&(g=!0,this.lines[a].executed=!0)),f)if(""==e){var k=document.createElement("div");k.className=c,k.innerHTML="",k.setAttribute("data-line",""+a),this.gutter.replaceChild(k,this.gutter.childNodes[a])}else this.gutter.childNodes[a].className=c,this.gutter.childNodes[a].innerHTML=e;else g&&(this.gutter.childNodes[a].className.indexOf("hover")>=0&&(c+=" hover"),this.gutter.childNodes[a].className.indexOf("play")>=0&&(c+=" play"),this.gutter.childNodes[a].className.indexOf("current")>=0&&(c+=" current"),this.gutter.childNodes[a].innerHTML=e,this.gutter.childNodes[a].className=c,i&&(this.gutter.childNodes[a].title=i))},EdenScriptGutter.prototype.generate=function(a,b){if(this.ast=a,!this.edits){var c=!1,d=a.getNumberOfLines()+1;if(d>this.lineelements.childNodes.length&&(d=this.lineelements.childNodes.length),d!=this.gutter.childNodes.length){for(this.hideBrace();this.gutter.firstChild;)this.gutter.removeChild(this.gutter.firstChild);for(var e=0;e0?this.hideBrace():this.hovering||this.selectLine(b)}},EdenUI.ScriptArea=function(){this.contents=document.createElement("div"),this.intextarea=document.createElement("textarea"),this.intextarea.autofocus=!0,this.intextarea.tabIndex=1,this.intextarea.className="hidden-textarea2",this.contents.appendChild(this.intextarea),this.codearea=document.createElement("div"),this.codearea.className="inputCodeArea",this.contents.appendChild(this.codearea),this.outdiv=document.createElement("div"),this.outdiv.contenteditable=!0,this.outdiv.className="outputcontent",this.outdiv.spellcheck=!1,this.outdiv.tabIndex=2,this.codearea.appendChild(this.outdiv),this.fragment=void 0,this.readonly=!1,this.alwaysreadonly=!1,this.currentlineno=-1,this.currentcharno=-1,this.gotomode=!1,this.highlighter=new EdenUI.Highlight(this.outdiv),this.gutter=new EdenScriptGutter(this.codearea,this.infobox,this.outdiv),this.details=new EdenUI.ScriptArea.Details(this),this.cachedhlopt=void 0,this.disablehl=!1,this.highlighter.setScrollTop(0);var a=this;this.gutterinterval=setInterval(function(){if(void 0!==a.fragment&&void 0!==a.fragment.ast){a.gutter.generate(a.fragment.ast.script,a.currentlineno);for(var b in a.highlighter.metrics)if(a.currentlineno!=b){var c=a.highlighter.metrics[b];if(c.query)for(var d=0;d0?f:"value");g=1==g.length?g[0]:g.length>1?g.join(", "):"",c.qelements[d].setAttribute("data-result",g)}c.squery&&a.highlightContent(b,a.intextarea.selectionEnd)}}},300);new EdenUI.ScriptArea.Keyboard(this),new EdenUI.ScriptArea.Mouse(this);this.rebuildinterval=400},EdenUI.ScriptArea.prototype.setReadonly=function(a){this.alwaysreadonly=a,a===!0?(this.readonly=!0,this.outdiv.contentEditable=!1):(this.readonly=!!this.fragment&&this.fragment.locked,this.outdiv.contentEditable=!this.readonly,"comment"==a&&this.updateEntireHighlight())},EdenUI.ScriptArea.prototype.setFragment=function(a){if(this.fragment&&this.fragment!==a&&(this.fragment.unlock(),this.currentlineno=-1),this.details.hide(),this.fragment=a,void 0===a)return this.gutter.clear(),changeClass(this.outdiv,"browser",!0),this.outdiv.contentEditable=!1,void(this.readonly=!0);var b=this;a.reset(function(){changeClass(b.outdiv,"browser",!1),b.intextarea.value=a.getSource(),a.ast&&(b.highlightContent(-1,0),b.intextarea.focus(),b.checkScroll(),b.gutter.setBaseAST(a.ast.script)),a.locked?(b.readonly=!0,b.outdiv.contentEditable=!1):(b.readonly=b.alwaysreadonly===!0,b.outdiv.contentEditable=!b.readonly)})},EdenUI.ScriptArea.prototype.refresh=function(){this.intextarea.value=this.fragment.getSource(),this.fragment.ast&&this.highlightContent(-1,0)},EdenUI.ScriptArea.prototype.updateSource=function(a,b){this.fragment.setSource(a),this.gutter.errors=this.fragment.ast.errors,this.highlighter.ast=this.fragment.ast},EdenUI.ScriptArea.prototype.updateLineHighlight=function(){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.updateSource(this.intextarea.value,a),this.runScript(a),this.highlightContent(a,b)},EdenUI.ScriptArea.prototype.runScript=function(a){if(this.gutter.lines[a-1]&&this.gutter.lines[a-1].live&&!this.fragment.ast.hasErrors()){var b=this.fragment.ast.script.getStatementByLine(a-1);this.fragment.ast.executeStatement(b,a,this.fragment)}},EdenUI.ScriptArea.prototype.hideInfoBox=function(){},EdenUI.ScriptArea.prototype.updateLineCachedHighlight=function(){if(this.fragment){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.highlightContent(a,b)}},EdenUI.ScriptArea.prototype.updateEntireHighlight=function(a,b){if(void 0!==this.fragment){this.cachedhlopt=b,this.updateSource(this.intextarea.value,-1);var c=-1;document.activeElement===this.intextarea&&(c=this.intextarea.selectionEnd),a&&runScript(0),this.highlightContent(-1,c,b)}},EdenUI.ScriptArea.prototype.updateCachedHighlight=function(a){var b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd),this.highlightContent(-1,b,a?a:this.cachedhlopt)},EdenUI.ScriptArea.prototype.findElementLineNumber=function(a){for(var b=a;b.parentNode!==this.outdiv;)b=b.parentNode;var c=parseInt(b.getAttribute("data-line"));return c},EdenUI.ScriptArea.prototype.replaceLine=function(a,b){var c=this.intextarea.value.split("\n");c[a]=b,this.intextarea.value=c.join("\n")},EdenUI.ScriptArea.prototype.focusOutput=function(){this.setCaretToFakeCaret(),this.outdiv.focus()},EdenUI.ScriptArea.prototype.focusText=function(){if(!this.readonly){var a=getCaretCharacterOffsetWithin(this.outdiv),b=getStartCaretCharacterOffsetWithin(this.outdiv);this.intextarea.focus(),this.intextarea.selectionEnd=a,this.intextarea.selectionStart=b,b!=a&&(this.refreshentire=!0)}},EdenUI.ScriptArea.prototype.toggleHighlighting=function(){this.disablehl=!this.disablehl,this.updateEntireHighlight(),this.gutter.clear()},EdenUI.ScriptArea.prototype.highlightContent=function(a,b,c){if(this.fragment){var d=this.fragment.ast;if(d){if(void 0===c&&this.disablehl&&(c={}),this.disablehl&&(c.disabled=!0),this.highlighter.highlight(d,a,b,c),document.activeElement!==this.intextarea&&$(this.outdiv).find(".fake-caret").addClass("fake-blur-caret"),"comment"==this.alwaysreadonly)for(var e=$(this.outdiv).find(".eden-comment-line"),f=0;f")},axis:"x",distance:5,drag:function(b,c){if(!a.readonly){var d;if(a.dragint?d=Math.round(a.dragvalue+(c.position.left-a.dragstart)/2):(d=a.dragvalue+.005*(c.position.left-a.dragstart),d=d.toFixed(4)),d!=a.draglast){a.draglast=d,b.target.innerHTML=""+d;var e=b.target.parentNode.textContent;"\n"==e.charAt(e.length-1)&&(e=e.slice(0,-1)),a.replaceLine(a.dragline,e),a.updateSource(a.intextarea.value,a.dragline),a.runScript(a.dragline+1),a.highlightContent(a.dragline,-1)}}},start:function(b,c){if(!a.readonly){a.edited=!0,a.dragline=a.findElementLineNumber(b.target),a.dragstart=c.position.left;var d=b.target.textContent;d.indexOf(".")==-1?(a.dragvalue=parseInt(d),a.dragint=!0):(a.dragvalue=parseFloat(d),a.dragint=!1),a.draglast=a.dragvalue,$(b.target).addClass("eden-select"),$(a.outdiv).css("cursor","ew-resize")}},stop:function(b,c){a.readonly||($(b.target).removeClass("eden-select"),$(a.outdiv).css("cursor","text"),a.dragline=-1)},cursor:"move",cursorAt:{top:-5,left:-5}}).click(function(){$(this).draggable({disabled:!0})}).blur(function(){$(this).draggable({disabled:!1})})},EdenUI.ScriptArea.prototype.getLineNumber=function(){var a=this.intextarea.value.substr(0,this.intextarea.selectionStart).split("\n");return this.currentlineno=a.length,this.currentcharno=a[a.length-1].length,this.currentlineno},EdenUI.ScriptArea.prototype.gotoLine=function(a){var b=this.intextarea.value.split("\n");b.length=a+1;var c=b.join("\n").length;this.intextarea.focus(),this.intextarea.selectionEnd=c,this.intextarea.selectionStart=c,this.updateLineCachedHighlight()},EdenUI.ScriptArea.prototype.checkScroll=function(){return},EdenUI.ScriptArea.prototype.setCaretToFakeCaret=function(){var a=$(this.outdiv).find(".fake-caret").get(0);if(a){var b=document.createRange(),c=window.getSelection();a.nextSibling&&(a=a.nextSibling),b.setStart(a,0),b.collapse(!0),c.removeAllRanges(),c.addRange(b),$(this.outdiv).remove(".fake-caret")}},EdenUI.ScriptArea.prototype.makeDiff=function(){var a={},b=this.fragment.diff(),c=0;for(var d in b.remove)if(!b.remove[d].consecutive){var e=parseInt(d),f=0,g=20;do g+=20,f++;while(b.remove[e+f]&&b.remove[e+f].consecutive);a[b.remove[d].nline+c]=g}this.gutter.setDiffs(b),this.cachedhlopt={spacing:a},this.updateCachedHighlight()},EdenUI.ScriptArea.prototype.doRebuild=function(){this.makeNumbersDrag()},EdenUI.ScriptArea.prototype.delayRebuild=function(){var a=this;clearTimeout(this.rebuildtimer),this.rebuildtimer=setTimeout(function(){a.doRebuild()},this.rebuildinterval)},EdenUI.ScriptArea.prototype.rebuild=function(){this.gutter.edits?(this.updateSource(this.intextarea.value,-1),this.gutter.ast=this.fragment.ast,this.makeDiff()):(this.edited=!0,this.refreshentire?(this.updateEntireHighlight(),this.refreshentire=!1):this.updateLineHighlight(),this.checkScroll(),this.dirty=!1)},EdenUI.ScriptArea.prototype.enableGotoMode=function(){this.gotomode||(this.outdiv.contentEditable=!1,changeClass(this.outdiv,"goto",!0),this.gotomode=!0)},EdenUI.ScriptArea.prototype.disableGotoMode=function(){this.gotomode&&(this.outdiv.contentEditable=!0,changeClass(this.outdiv,"goto",!1),this.gotomode=!1)},EdenUI.ScriptArea.prototype.insertTab=function(){var a=this.intextarea.selectionStart,b=this.intextarea.selectionEnd;this.intextarea.value=this.intextarea.value.substring(0,a)+"\t"+this.intextarea.value.substring(b),this.intextarea.selectionStart=this.intextarea.selectionEnd=a+1,this.rebuild()},EdenUI.ScriptArea.Details=function(a){this.scriptarea=a,this.contents=document.createElement("div"),this.contents.className="script-details",this.contents.addEventListener("keyup",function(a){var b=a.target.parentNode.getAttribute("data-name"),c=a.target.value;console.log("CHANGE PROP",b,c)}),this.visible=!1},EdenUI.ScriptArea.Details.prototype.addProperty=function(a,b,c,d){var e=document.createElement("div");e.className="script-details-prop",e.setAttribute("data-name",a);var f=document.createElement("div");f.className="script-details-label",f.textContent=b,e.appendChild(f);var g=document.createElement("input");g.className="script-details-value",g.value=c?c:"",g.setAttribute("type","text"),d&&d.readonly&&(g.className+=" script-details-readonly",g.setAttribute("readonly","true")),e.appendChild(g);var h=document.createElement("div");return h.className="script-details-status",d&&d.readonly?h.innerHTML="":h.innerHTML="",e.appendChild(h),this.contents.appendChild(e),e},EdenUI.ScriptArea.Details.prototype.clear=function(){for(;this.contents.lastChild;)this.contents.removeChild(this.contents.lastChild)},EdenUI.ScriptArea.Details.prototype.addButtons=function(){var a=document.createElement("div");a.className="script-details-buttons";var b=document.createElement("button");b.className="script-button",b.innerHTML='Close',a.appendChild(b),this.contents.appendChild(a)},EdenUI.ScriptArea.Details.prototype.show=function(){this.clear(),this.addProperty("name","Name",this.scriptarea.fragment.name),this.addProperty("selector","Path",this.scriptarea.fragment.selector,{readonly:!0}),this.scriptarea.fragment.originast&&this.addProperty("id","Full Name",Eden.Selectors.getID(this.scriptarea.fragment.originast),{readonly:!0});var a=this.scriptarea.fragment.doxy;if(a){this.addProperty("desc","Description",a.stripped()),this.addProperty("tags","Tags",a.getHashTags().join(" "));var b=a.getControls();for(var c in b)this.addProperty(c,c.substring(1),b[c])}this.addButtons(),this.scriptarea.codearea.appendChild(this.contents),changeClass(this.scriptarea.outdiv,"blur",!0),this.visible=!0},EdenUI.ScriptArea.Details.prototype.hide=function(){this.visible&&(this.scriptarea.codearea.removeChild(this.contents),this.visible=!1,changeClass(this.scriptarea.outdiv,"blur",!1))},EdenUI.ScriptArea.Details.prototype.toggle=function(){this.visible?this.hide():this.show()},EdenUI.ScriptArea.Keyboard=function(a){function b(a){var b=a.key;return a.shiftKey&&(b="Shift-"+b),a.altKey&&(b="Alt-"+b),(a.ctrlKey||a.metaKey)&&(b="Ctrl-"+b),b}function c(c){var d=b(c);switch(d){case"Tab":c.preventDefault(),a.insertTab();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Home":case"End":a.moveCaret();break;case"Ctrl-a":a.selectAll(),c.preventDefault();break;case"Ctrl-h":a.toggleHighlighting(),c.preventDefault();break;case"Ctrl-Shift-ArrowLeft":case"Ctrl-Shift-ArrowRight":case"Ctrl-Shift-ArrowUp":case"Ctrl-Shift-ArrowDown":case"Ctrl-Shift-Home":case"Ctrl-Shift-End":case"Shift-ArrowLeft":case"Shift-ArrowRight":case"Shift-ArrowUp":case"Shift-ArrowDown":case"Shift-Home":case"Shift-End":a.focusOutput();break;case"Backspace":a.refreshentire=10==a.intextarea.value.charCodeAt(a.intextarea.selectionStart-1);break;case"Enter":a.refreshentire=!0;break;case"Ctrl-Control":a.enableGotoMode()}}function d(b){a.refreshentire=!0}function e(c){var d=b(c);switch(c.ctrlKey||a.disableGotoMode(),d){case"Ctrl-Control":a.disableGotoMode();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Home":case"End":a.updateLineCachedHighlight(),a.gutter&&a.gutter.selectLine(a.currentlineno),a.checkScroll()}}function f(b){"INPUT"!=b.target.nodeName&&"textarea"!=b.target.nodeName&&(!b.shiftKey||37!=b.keyCode&&38!=b.keyCode&&39!=b.keyCode&&40!=b.keyCode&&35!=b.keyCode&&36!=b.keyCode)&&"Control"!=b.key&&"Shift"!=b.key&&"c"!=b.key&&a.focusText()}function g(b){a.intextarea.focus(),setTimeout(function(){a.updateEntireHighlight()},0)}function h(b){"INPUT"!=b.target.nodeName&&"textarea"!=b.target.nodeName&&(17!=b.keyCode&&91!=b.keyCode&&92!=b.keyCode||a.disableGotoMode())}function i(b){$(a.outdiv).find(".fake-caret").remove()}function j(b){a.dirty=!0,a.rebuild()}function k(a){}a.intextarea.addEventListener("input",j),a.intextarea.addEventListener("keydown",c),a.intextarea.addEventListener("keyup",e),a.intextarea.addEventListener("paste",d),a.outdiv.addEventListener("keydown",f),a.outdiv.addEventListener("keyup",h),a.outdiv.addEventListener("paste",g),a.intextarea.addEventListener("blur",i),a.intextarea.addEventListener("focus",k)},EdenUI.ScriptArea.Mouse=function(a){function b(b){a.readonly}function c(b){if("INPUT"!=b.target.nodeName&&"textarea"!=b.target.nodeName&&(a.hideInfoBox(),!a.readonly&&0!=b.target.isContentEditable))if(a.gotomode){var c=b.target;if(""==c.className&&"SPAN"==c.parentNode.nodeName&&(c=c.parentNode),"eden-selector"==c.className||"eden-selector2"==c.className){a.disableGotoMode();var d=c.parentNode.textContent;Eden.Selectors.goto(d)}else if("eden-observable"==c.className){var e=c.getAttribute("data-observable");Eden.Selectors.goto(e+":active")}b.preventDefault()}else if(document.activeElement===a.outdiv){var f=getCaretCharacterOffsetWithin(a.outdiv),g=getStartCaretCharacterOffsetWithin(a.outdiv);if(g!=f)a.refreshentire=!0;else{a.intextarea.focus(),a.intextarea.selectionEnd=f,a.intextarea.selectionStart=f;a.currentlineno;a.updateLineCachedHighlight()}}}a.outdiv.addEventListener("mouseup",c),a.outdiv.addEventListener("mousedown",b)},EdenUI.plugins.PluginManager=function(a,b){this.createDialog=function(b,c){var d,e,f,g=$('
'),h=function(b){return a.plugins[b]?"(loaded)":"(not loaded)"};pluginNames=Object.keys(EdenUI.plugins).sort(function(b,c){var d=a.plugins[b],e=a.plugins[c];return d&&!e?1:e&&!d?-1:b
'+d.title+"
";void 0!==d.originalAuthor&&(k=k+""),void 0!==d.author&&(f=void 0===d.originalAuthor?"By ":"Built on by ",k=k+""),k=k+'",$(k).click(function(b){return function(){var c=$(this);a.loadPlugin(b,function(){a.plugins[b]&&(c.find(".pluginlist-loaded").html(h(b)),c.addClass("pluginmanager-loaded",100)),a.menu.updateViewsMenu()})}}(e)).appendTo(g)}var l=$('
');l.append(g),$dialog=$('
').html(l).dialog({title:c,width:310,height:400,minHeight:120,minWidth:230,dialogClass:"unpadded-dialog"})},a.views.PluginManager={dialog:this.createDialog,title:"Plug-in Manager",category:a.viewCategories.environment,name:"plugins"},b()},EdenUI.plugins.PluginManager.title="Plug-in Manager",EdenUI.plugins.PluginManager.description="Provides the ability to load plug-ins.",EdenUI.plugins.Canvas2D=function(a,b){var c=this;this.defaultFontSizePx=13.3,this.defaultLineHeight=1.75*this.defaultFontSizePx,this.defaultLineWidth=2;var d=600,e=500;canvases={},contents={};var f,g,h,i={},j=40,k=!1,l=!1;Object.defineProperty(this,"mouseIdleTimeout",{set:function(a){clearInterval(g),g=setInterval(function(){if(k)l=!1,k=!1;else if(!l){var a=root.lookup("mouseFollow").value();root.lookup("mouseVelocity").assign(new Point(0,0),root.scope,Symbol.hciAgent,a),l=!0,h=void 0}},a/2),f=a},get:function(){return f},enumerable:!0}),this.mouseVelocitySampleTime=100,this.mouseVelocityDampening=.3,this.mouseIdleTimeout=300;var m=function(a,b){var c;for(c in b)if("false"!=b[c][0].getAttribute("data-garbage"))for(var d=b[c],e=0;em?(e=j,d=i*(e/h),f=0,g=(k-d)/2):(d=k,e=j,f=0,g=0);var n=document.createElement("canvas");n.setAttribute("width","200"),n.setAttribute("height","112");var o=n.getContext("2d");o.drawImage(b,f,g,e,d);var p;try{p=n.toDataURL("image/png")}catch(q){}a&&a(p)},this.drawPicture=function(a){var b=canvases[a];if(void 0!==b&&!b.drawingQueued&&(b.drawingQueued=!0,!b.drawingInProgress)){var d=function(){b.drawingInProgress=!0,b.drawingQueued=!1;var e=i[a],f={},g="view_"+a+"_content",h=root.lookup(g),k=h.value(),l=b.getContext("2d"),n=contents[a],o=0;if(void 0!==n){var p=root.lookup("view_"+a+"_background_colour").value();void 0===p&&(p="white"),l.setTransform(1,0,0,1,0,0),c.setFillStyle(l,p),n.style.backgroundColor=p,l.fillRect(0,0,b.width,b.height);var q;for(q in e)e[q][0].setAttribute("data-garbage",!0);if(Array.isArray(k)){var r=root.lookup("view_"+a+"_scale").value();"number"!=typeof r&&(r=1);var s=root.lookup("view_"+a+"_zoom").value();"number"!=typeof s&&(s=1);var t,u,v=r*s;r<0?(l.scale(-v,v),v=-v,u=-r,t=!0):(1!=v&&l.scale(v,v),u=r,t=!1);var w=root.lookup("view_"+a+"_offset").value();if(w instanceof Point)if(t){var x=b.height/v-w.y;l.translate(w.x,-x),w=new Point(w.x,x)}else l.translate(w.x,w.y);else w=new Point(0,0);c.configureContextDefaults(l,u);for(var y=[k],z=[0],A=[],B="";y.length>0;){var C=y.pop(),D=z.pop();for(D>0&&C[D-1]instanceof EdenUI.plugins.Canvas2D.Transform&&(l.restore(),A.pop(),B=A.join(" "));D=d;i-=c){var j=(Math.round(i*b)-.5)/b;h.moveTo(j,e),h.lineTo(j,g),h.stroke()}for(var k=0==a.y?c:0;k<=g;k+=c){var l=(Math.round(k*b)-.5)/b;h.moveTo(d,l),h.lineTo(f,l),h.stroke()}for(var k=-c;k>=e;k-=c){var l=(Math.round(k*b)-.5)/b;h.moveTo(d,l),h.lineTo(f,l),h.stroke()}},this.configureContextDefaults=function(a,b){a.lineJoin="bevel",a.miterLimit=429496656,a.lineWidth=this.defaultLineWidth/b},this.configureContext=function(a,b,c,d){if("object"!=typeof d)return!0;if(d.visible===!1)return!1;if(Array.isArray(d.dashes)&&(a.setLineDash(d.dashes),"dashOffset"in d&&(a.lineDashOffset=d.dashOffset)),"cap"in d&&(a.lineCap=d.cap),"join"in d&&(a.lineJoin=d.join),"miterLimit"in d&&(a.miterLimit=d.miterLimit),"lineWidth"in d&&(a.lineWidth=d.lineWidth/b),"opacity"in d&&(a.globalAlpha=d.opacity),"object"==typeof d.shadow)if(a.shadowColor=d.shadow.colour,d.shadow.scale){var e=c*b;a.shadowBlur=d.shadow.blur*e,a.shadowOffsetX=d.shadow.xOffset*e,a.shadowOffsetY=d.shadow.yOffset*e}else a.shadowBlur=d.shadow.blur*c,a.shadowOffsetX=d.shadow.xOffset*c,a.shadowOffsetY=d.shadow.yOffset*c;return!0},this.setFillStyle=function(a,b){if(b instanceof CanvasImage){var c=a.createPattern(b.image,"repeat");a.fillStyle=c}else b instanceof EdenUI.plugins.Canvas2D.FillStyle?a.fillStyle=b.getColour(a):a.fillStyle=b},this.initZoneFromDrawingOpts=function(b,c){var d;if(b instanceof Object&&b.zone!==!1){if(d=b.name,void 0===d&&b.zone===!0)return root.currentObservableName();if(a.eden.isValidIdentifier(d)){var e=root.lookup(d+"_click");void 0===e.value()&&e.assign(!1,root.scope,root.lookup(c))}return d}},this.initZoneFromName=function(b,c){if(a.eden.isValidIdentifier(b)){var d=root.lookup(b+"_click");void 0===d.value()&&d.assign(!1,root.scope,root.lookup(c))}return b},this.findDrawableHit=function(a,b,c,d,e){var f=root.lookup("view_"+a+"_content").value(),g=canvases[a];if(g){var h=g.getContext("2d"),i=root.lookup("view_"+a+"_scale").value();return this.findDrawableHitInList(f,h,i,b,c,d,e)}},this.findDrawableHitInList=function(a,b,c,d,e,f,g){if(Array.isArray(a)){var h,i;f?(h=0,i=1):(h=a.length-1,i=-1);for(var j=h;f?j=0;j+=i){var k=a[j];if("object"==typeof k)if(Array.isArray(k)){var l=this.findDrawableHitInList(k,b,c,d,e,f,g);if(l)return l}else{var m=k.isHit;if(void 0!==m){if(!g&&void 0===k.name)continue;b.save();var n=k.isHit(b,c,d,e);if(b.restore(),n===!0)return k}else if(k.inverse){var o=k.inverse(d,e),l=this.findDrawableHitInList(k.items,b,c,o.x,o.y,f,g);if(void 0!==l)return l}}}}},this.findAllDrawablesHit=function(a,b,c,d){var e=root.lookup("view_"+a+"_content").value(),f=canvases[a],g=f.getContext("2d"),h=root.lookup("view_"+a+"_scale").value();return this.findAllDrawablesHitInList(e,g,h,b,c,d)},this.findAllDrawablesHitInList=function(a,b,c,d,e,f){if(!Array.isArray(a))return[];for(var g=[],h=0;h0&&(g=g.concat(m))}}}return g};var n={leftButton:!1,middleButton:!1,rightButton:!1,button4:!1,button5:!1,buttonCount:0,insideCanvas:!1,capturing:!1};this.createCommon=function(b,f){function g(){c.drawPicture(s)}function j(a){return"view_"+b+"_"+a}function l(){var b,d,e=x.value(),f=y.value(),g=e*f,h=z.value();h instanceof Point?(b=h.x,d=h.y):(b=0,d=0);var i=A.value();void 0!==i?(i=Math.ceil((A.value()+b)*g),t.width=i):f>1?t.width=Math.ceil(C.value()*f):t.width=Math.floor(C.value());var j;void 0!==B.value()?j=Math.ceil((B.value()+d)*g):f>1?j=Math.ceil(D.value()*f):(j=D.value(),void 0!==i&&i>Math.floor(C.value())&&(j-=a.scrollBarSize),j=Math.floor(j-1)),t.height=j,t.rescale=!0,c.drawPicture(s)}function m(){E?(E=!1,t.rescale=!0,c.drawPicture(s),H||(H=!0,setTimeout(m,1e3))):(l(),H=!1)}function o(a){var b=root.lookup("mouseFollow").value();root.beginAutocalcOff(),n.insideCanvas=!0;var d;switch(a.button){case 0:n.leftButton=!0,root.lookup("mousePressed").assign(!0,root.scope,Symbol.hciAgent,b),d="Left";break;case 1:n.middleButton=!0,d="Middle";break;case 2:n.rightButton=!0,d="Right";break;case 3:n.button4=!0,d="Button4";break;case 4:n.button5=!0,d="Button5";break;default:d="Unknown"}n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5;var e="|";if(n.leftButton&&(e+="Left|"),n.middleButton&&(e+="Middle|"),n.rightButton&&(e+="Right|"),n.button4&&(e+="Button4|"),n.button5&&(e+="Button5|"),root.lookup("mouseButtons").assign(e,root.scope,Symbol.hciAgent,b),root.lookup("mouseButton").assign(d+" down",root.scope,Symbol.hciAgent,b),1==n.buttonCount){var f=root.lookup("mousePosition").value();root.lookup("mouseDownView").assign(s,root.scope,Symbol.hciAgent,b),root.lookup("mouseDown").assign(f,root.scope,Symbol.hciAgent,b);var g=root.lookup("view_"+s+"_scale").value(),h=root.lookup("view_"+s+"_zoom").value(),i=g*h,j=$(this).offset(),k=(a.pageX-Math.round(j.left))/i,l=(a.pageY-Math.round(j.top))/i,m=root.lookup("view_"+s+"_offset").value();m instanceof Point&&(k-=m.x,l-=m.y);var o,p=c.findDrawableHit(s,k,l,!1,!1);o=void 0===p?void 0:p.name;var q=root.lookup("mouseZone"),r=q.value();o!==r&&q.assign(o,root.scope,Symbol.hciAgent,b),root.lookup("mouseDownZone").assign(o,root.scope,Symbol.hciAgent,b)}root.endAutocalcOff()}var p,q,r={name:"*Default"},s=b,t=canvases[b];void 0===t?(p=$('
'),p.html(''),q=p.find(".canvashtml-canvas"),t=q[0],canvases[b]=t,contents[b]=p[0],i[b]={},t.drawingQueued=!1,t.drawingInProgress=!1,t.rescale=!1):(p=$("#"+b+"-canvascontent"),q=p.find(".canvashtml-canvas"));var u=[j("content"),j("background_colour"),j("scale"),j("zoom"),j("offset"),j("canvas_right"),j("canvas_bottom"),"mousePosition","mouseButton","mouseButtons","mouseCapture","mouseCaptured","mouseDown","mouseDownView","mouseFollow","mousePressed","mouseUp","mouseWheel","mouseWheelEnabled","mouseWheelVelocity","mouseView","mouseZone","mouseVelocity"];t.setAttribute("data-observables",u.join(","));var v=root.lookup("view_"+s+"_content"); -v.addJSObserver("repaintView",g);var w=root.lookup("view_"+s+"_background_colour");void 0===w.value()&&w.assign("white",root.scope,r),w.addJSObserver("refreshView",g);var x=root.lookup("view_"+s+"_scale"),y=root.lookup("view_"+s+"_zoom"),z=root.lookup("view_"+s+"_offset"),A=root.lookup("view_"+s+"_canvas_right"),B=root.lookup("view_"+s+"_canvas_bottom"),C=root.lookup("view_"+s+"_width"),D=root.lookup("view_"+s+"_height"),E=!1,F=x.value();void 0===F&&(x.assign(1,root.scope,r),F=1),x.addJSObserver("refreshView",l);var G=y.value();void 0===G&&(y.assign(1,root.scope,r),G=1);var H=!1;y.addJSObserver("refreshView",function(a,b){Math.round(100*b);E=!0,m()});var I,J,K=z.value();K instanceof Point?(I=K.x,J=K.y):(z.assign(new Point(0,0),root.scope,r),I=0,J=0),z.addJSObserver("refreshView",l),void 0==A.value()&&A.assign(void 0,root.scope,r),A.addJSObserver("repaintView",l),void 0==B.value()&&B.assign(void 0,root.scope,r),B.addJSObserver("repaintView",l);var L=A.value();L=void 0===L?d:L*F+I;var M=B.value();M=void 0===M?e:M*F+J;var N=root.lookup("view_"+s+"_grid_visible");void 0===N.value()&&N.assign(!1,root.scope,r),N.addJSObserver("refreshView",g);var O=root.lookup("view_"+s+"_grid_spacing");return void 0===O.value()&&O.assign(20,root.scope,r),O.addJSObserver("refreshView",g),q.on("mousedown",o),q.on("mouseup",function(b){var c=root.lookup("mouseFollow").value();root.beginAutocalcOff(),n.insideCanvas=!0;var d;switch(navigator.platform.toUpperCase().indexOf("MAC")>=0&&b.ctrlKey&&(b.button=2),b.button){case 0:n.leftButton=!1,root.lookup("mousePressed").assign(!1,root.scope,Symbol.hciAgent,c),d="Left";break;case 1:n.middleButton=!1,d="Middle";break;case 2:n.rightButton=!1,d="Right";break;case 3:n.button4=!1,d="Button4";break;case 4:n.button5=!1,d="Button5";break;default:d="Unknown"}if(n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5,root.lookup("mouseButton").assign(d+" up",root.scope,Symbol.hciAgent,c),0==n.buttonCount){var e=root.lookup("mousePosition").value();root.lookup("mouseButtons").assign("",root.scope,Symbol.hciAgent,c),root.lookup("mouseUp").assign(e,root.scope,Symbol.hciAgent,c),a.plugins.Canvas2D.endClick()}else{var f="|";n.leftButton&&(f+="Left|"),n.middleButton&&(f+="Middle|"),n.rightButton&&(f+="Right|"),n.button4&&(f+="Button4|"),n.button5&&(f+="Button5|"),root.lookup("mouseButtons").assign(f,root.scope,Symbol.hciAgent,c)}root.endAutocalcOff()}).on("contextmenu",function(a){navigator.platform.toUpperCase().indexOf("MAC")>=0&&a.ctrlKey&&(a.button=2,o(a)),root.lookup("mouseContextMenuEnabled").value()||(a.preventDefault(),a.stopPropagation())}).on("click",function(a){root.lookup("mouseCapture").value()&&this.requestPointerLock()}).on("dblclick",function(a){var b=root.lookup("mouseFollow").value(),c=root.lookup("mouseDoubleClicks"),d=c.value();c.assign(d+1,root.scope,Symbol.hciAgent,b)}).on("wheel",function(a){var b,d=a.originalEvent,e=D.value();b=d.deltaMode==WheelEvent.DOM_DELTA_LINE?c.defaultLineHeight:d.deltaMode==WheelEvent.DOM_DELTA_PAGE?0!=d.deltaX?C.value():e:1;var f=root.lookup("mouseFollow").value();if(0!=d.deltaY&&a.ctrlKey&&!a.altKey&&!a.metaKey&&!a.shiftKey){a.preventDefault(),a.stopPropagation(),root.beginAutocalcOff();var g=-d.deltaY*b;if(root.lookup("touchPinchEnabled").value()){var h=root.lookup("touchPinch"),i=h.value();i+=g,h.assign(i,root.scope,Symbol.hciAgent,f)}else{var j=y.value();j=j*(e+2*g)/e,j<.05&&(j=.05),y.assign(j,root.scope,Symbol.hciAgent,f)}return void root.endAutocalcOff()}if(root.lookup("mouseWheelEnabled").value()){if(root.beginAutocalcOff(),0!==d.deltaY&&(!a.ctrlKey||a.altKey||a.metaKey||a.shiftKey)){a.preventDefault(),a.stopPropagation();var k=root.lookup("mouseWheel"),l=k.value(),g=d.deltaY*b;l+=g,k.assign(l,root.scope,Symbol.hciAgent,f),root.lookup("mouseWheelVelocity").assign(g,root.scope,Symbol.hciAgent,f)}if(0!==d.deltaX){a.preventDefault(),a.stopPropagation();var m=root.lookup("touchPanX"),n=m.value(),o=d.deltaX*b;n+=o,m.assign(n,root.scope,Symbol.hciAgent,f),root.lookup("touchPanXSpeed").assign(o,root.scope,Symbol.hciAgent,f)}root.endAutocalcOff()}}).on("mouseout",function(a){n.insideCanvas=!1;var b=root.lookup("mouseFollow").value();root.lookup("mouseZone").assign(void 0,root.scope,Symbol.hciAgent,b)}).on("mouseenter",function(a){if(!n.insideCanvas){n.insideCanvas=!0;var b;0==n.buttonCount?b="":(b="|",n.leftButton&&(b+="Left|"),n.middleButton&&(b+="Middle|"),n.rightButton&&(b+="Right|"),n.button4&&(b+="Button4|"),n.button5&&(b+="Button5|"));var c=root.lookup("mouseButtons"),d=c.value();if(b!=d){var e=root.lookup("mouseFollow").value();root.beginAutocalcOff(),c.assign(b,root.scope,Symbol.hciAgent,e),root.lookup("mouseButton").assign("Enter window",root.scope,Symbol.hciAgent,e);var f=root.lookup("mousePressed");f.value()!=n.leftButton&&f.assign(n.leftButton,root.scope,Symbol.hciAgent,e),""==d&&""!=b&&(root.lookup("mouseDown").assign(void 0,root.scope,Symbol.hciAgent,e),root.lookup("mouseDownView").assign(void 0,root.scope,Symbol.hciAgent,e)),root.endAutocalcOff()}}}).on("mousemove",function(a){k=!0;var b=root.lookup("mouseFollow").value();root.beginAutocalcOff();var d,e,f,g,i=root.lookup("mouseView"),j=root.lookup("mousePosition"),l=i.value(),m=j.value();m&&(f=m.x,g=m.y);var o=root.lookup("view_"+s+"_scale").value(),p=root.lookup("view_"+s+"_zoom").value(),q=o*p;if(n.capturing){var r=a.originalEvent;d=f+r.movementX/q,e=g+r.movementY/q}else{var t=$(this).offset();d=(a.pageX-Math.round(t.left))/q,e=(a.pageY-Math.round(t.top))/q;var u=root.lookup("view_"+s+"_offset").value();u instanceof Point&&(d-=u.x,e-=u.y)}i.assign(s,root.scope,Symbol.hciAgent,b);var v=new Point(d,e);j.assign(v,root.scope,Symbol.hciAgent,b);var w,x=Date.now();if(l==s&&void 0!==h){if(w=x-h,w>=c.mouseVelocitySampleTime){var y=root.lookup("mouseVelocity"),z=y.value(),A=1e3*(d-f)/w,B=1e3*(e-g)/w;if(z){var C=c.mouseVelocityDampening,D=z.x;(A>0&&D>0||A<0&&D<0)&&(A=C*D+(1-C)*A);var E=z.y;(B>0&&E>0||B<0&&E<0)&&(B=C*E+(1-C)*B)}A=Math.ceil(A*q)/q,B=Math.ceil(B*q)/q;var F=new Point(A,B);y.assign(F,root.scope,Symbol.hciAgent,b),h=x}}else h=x;var G,H=c.findDrawableHit(s,d,e,!1,!1);G=void 0===H?void 0:H.name;var I=root.lookup("mouseZone"),J=I.value();G!==J&&I.assign(G,root.scope,Symbol.hciAgent,b),root.endAutocalcOff()}).on("keyup",function(a){var b=a.which,c=!1;if(a.altKey&&!a.shiftKey&&!a.ctrlKey){var d=root.lookup("view_"+s+"_zoom"),e=d.value();61==b||187==b?(e=1.25*e,c=!0):173==b||189==b?(e/=1.25,c=!0):48==b&&(e=1,c=!0),d.assign(e,root.scope,Symbol.hciAgent)}c&&(a.preventDefault(),a.stopPropagation())}),{initialWidth:L,initialHeight:M,code_entry:p,offsetSym:z,zoomSym:y,widthSym:A,heightSym:B,scaleSym:x}},this.createEmbedded=function(b,d,e){var f=b;eden.execute2("view_"+f+"_content is "+e+";");var g=c.createCommon(b,d),h=(g.initialWidth,g.initialHeight,g.code_entry),i=g.offsetSym,j=g.zoomSym,k=g.widthSym,l=g.heightSym,m=g.scaleSym,n={code_entry:h,contents:h,destroy:function(){delete canvases[f],delete contents[f]},resize:function(b,d){var e,g,h=i.value();h instanceof Point?(e=h.x,g=h.y):(e=0,g=0);var n,o,p=j.value(),q=document.getElementById(f+"-canvas"),r=!1,s=k.value();if(void 0===s?(n=p>1?Math.ceil(b*p):Math.floor(b),q.width!=n&&(q.width=n,r=!0)):s=Math.ceil(s*m.value()*p+e),void 0===l.value()){if(p>1)o=Math.ceil(d*p);else{o=d,void 0!==s&&s>o&&(o-=a.scrollBarSize);var o=Math.floor(o-1)}o!=q.height&&(q.height=o,r=!0)}r&&c.drawPicture(f)}};return n},this.createDialog=function(b,d){var e,f=b.slice(0,-7),g=c.createCommon(f,d),h=g.initialWidth,j=g.initialHeight,k=g.code_entry,l=g.offsetSym,m=g.zoomSym,n=g.widthSym,o=g.heightSym,p=g.scaleSym;return $('
').html(k).dialog({appendTo:"#jseden-views",title:d,width:h+a.scrollBarSize,height:j+a.titleBarHeight,minHeight:120,minWidth:230,classes:{"ui-dialog":"canvas-dialog unpadded-dialog ui-front"}}),e={confirmClose:!0,destroy:function(){var a=i[f];for(var b in a)for(var c=a[b],d=0;d1?Math.ceil(b*k):Math.floor(b),q.width!=i&&(q.width=i,r=!0)):s=Math.ceil(s*p.value()*k+e),void 0===o.value()){if(k>1)j=Math.ceil(d*k);else{j=d,void 0!==s&&s>j&&(j-=a.scrollBarSize);var j=Math.floor(j-1)}j!=q.height&&(q.height=j,r=!0)}r&&c.drawPicture(f)}},c.drawPicture(f),e},root.lookup("mouseDownZone").addJSObserver("recordClick",function(a,b){if(eden.isValidIdentifier(b)){var c=root.lookup(b+"_click");c.value()===!1&&c.assign(!0,root.scope,Symbol.hciAgent,!0)}}),this.endClick=function(){var a=root.lookup("mouseDownZone").value();if(eden.isValidIdentifier(a)){var b=root.lookup(a+"_click");b.value()===!0&&b.assign(!1,root.scope,Symbol.hciAgent,!0)}},this.canvasNameFromElement=function(a){for(;a;){var b=a.id;if("-canvascontent"==b.slice(-14))return b.slice(0,-14);a=a.parentElement}return null},document.addEventListener("mouseup",function(b){var c=root.lookup("mouseFollow").value();if(root.beginAutocalcOff(),!n.insideCanvas){var d;switch(b.button){case 0:n.leftButton=!1,d="Left";break;case 1:n.middleButton=!1,d="Middle";break;case 2:n.rightButton=!1,d="Right";break;case 3:n.button4=!1,d="Button4";break;case 4:n.button5=!1,d="Button5";break;default:d="Unknown"}n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5;var e=root.lookup("mouseButtons");if(0==n.buttonCount&&""!=e.value()){var f=root.lookup("mousePressed"),g=f.value();root.lookup("mouseButton").assign(d+" up",root.scope,Symbol.hciAgent,c),e.assign("",root.scope,Symbol.hciAgent,c),root.lookup("mousePosition").assign(void 0,root.scope,Symbol.hciAgent,c),g&&f.assign(!1,root.scope,Symbol.hciAgent,c),root.lookup("mouseUp").assign(void 0,root.scope,Symbol.hciAgent,c),root.lookup("mouseView").assign(void 0,root.scope,Symbol.hciAgent,c),a.plugins.Canvas2D.endClick()}}root.endAutocalcOff()}),document.addEventListener("mousedown",function(a){if(!n.insideCanvas){switch(a.button){case 0:n.leftButton=!0;break;case 1:n.middleButton=!0;break;case 2:n.rightButton=!0;break;case 3:n.button4=!0;break;case 4:n.button5=!0}n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5}}),document.addEventListener("pointerlockchange",function(a){var b=null!==document.pointerLockElement;n.capturing=b;var c=root.lookup("mouseFollow").value();root.lookup("mouseCaptured").assign(b,root.scope,void 0,c)}),a.views.Canvas2D={dialog:this.createDialog,embedded:this.createEmbedded,title:"Canvas 2D",category:a.viewCategories.visualization,holdsContent:!0};var o;o="/index-dev.html"==document.location.pathname.slice(-15)?"canvas.js-e":"jseden-canvas.min.js-e",Eden.Selectors.execute("plugins > canvas > canvas",function(){eden.root.lookup("plugins_canvas_loaded").assign(!0,eden.root.scope),b&&b()})},EdenUI.plugins.Canvas2D.FillStyle=function(){},EdenUI.plugins.Canvas2D.Transform=function(){},EdenUI.plugins.Canvas2D.Transform.CSSInfo=function(a,b,c){this.css=a,this.scaleX=b,this.scaleY=c},EdenUI.plugins.Canvas2D.title="Canvas 2D",EdenUI.plugins.Canvas2D.description="Provides the ability to draw two-dimensional shapes, images, text and user interface controls using EDEN dependencies.",EdenUI.plugins.Page=function(a,b){function c(a){if(!a)return"";if("title"!=a[0])return"";var b,c=$("
"),d=$("
");a[6]&&c.css("height",""+a[6]+"px"),b=a[1]?$(""+a[1]+""):$('');var e=$("
"+a[2]+"");return d.append(b),d.append(e),c.append(d),void 0!==a[3],c}function d(a){if(!a)return"";if("header"!=a[0])return"";switch(a[3]){case 0:return $("

"+a[1]+"

");case 1:return $("")}}function e(a){var b=typeof a;switch(b){case"string":return a;case"number":return""+a+"px";default:return""}}function f(a,b){for(var c=0;c]*(?:"[^"]*")*(?:'[^']*')*)*)?(?:\/|(?:>((?:[^<]*(?:<(?!\/jseden\1>))*)*)<\/jseden\1))>/g,function(a,d,e,f,h,i,j){return void 0===h&&(h=""),b.push(h),c.push(g(e,f)),"\0\0"});var d=a.split("\0\0");if(1==d.length)return a;for(var e=$("
"),f=0;f"+d[f]+"
")),void 0===c[f].tagType){var h=b[f].split("\n").length;void 0===c[f].lines&&(c[f].lines=h),void 0===c[f].width&&(c[f].width="50%"),void 0===c[f].box&&(c[f].box=!0);var i=l(["script",c[f].static,[b[f]],c[f].name,c[f].box,c[f].lines,!1,c[f].float,c[f].width]);e.append(i)}else if(c[f])if("canvas"==c[f].tagType){var j=n(["canvas",c[f].name,c[f].source,c[f].width,c[f].height,c[f].float,c[f].box]);e.append(j)}else if("veden"==c[f].tagType){var k=m(["veden",c[f].name,c[f].width,c[f].height,c[f].float,b[f]]);e.append(k)}return e.append($("
"+d[d.length-1]+"
")),e.get(0)}function i(a){if(a&&"element"==a[0]){var b,c=a[1],d=a[2],e=a[3],g=a[4],i=a[5],k=a[6],l=(a[7],a[8],a[9],a[10],a[11],a[12]),m=a[13];switch(c){case"div":case"span":case"button":case"img":case"p":case"ul":case"ol":case"li":case"br":case"pre":case"h1":case"h2":case"h3":case"a":case"input":b=document.createElement(c);break;default:return void console.error("Invalid element type: "+c)}if(d&&(b.id=d),e&&(b.className=e),g&&"string"==typeof g){var n=h(g);"string"==typeof n?b.innerHTML=n:b.appendChild(n)}return g&&g instanceof Array&&j(b,g),i&&"string"==typeof i&&(b.cssText=i),i&&i instanceof Array&&f(b,i),k&&d&&(b.onclick=function(a){var b=eden.root.lookup(d+"_click");console.log("ELEMENT CLICK"),b.assign(!0,eden.root.scope)}),"img"==c&&l&&(b.src=l),"a"==c&&m&&(b.href=m),b}}function j(a,b){if("string"==typeof b[0]){var c=i(b);return void(c&&a.appendChild(c))}for(var d=0;d([\s\S]*?)<\/jseden>/g,function(a,b,d,e,f){return console.log("ATTRIBS: "+b),c.push(d),"\0\0"});var d=b.split("\0\0");if(1==d.length)return $("
"+b+"
");for(var e=$("
"+d[f]+"
"));var g=c[f].split("\n").length,h=l(["script",!1,[c[f]],void 0,!0,g,!1,!1,"50%"]);e.append(h)}return e.append($("
"+d[d.length-1]+"
")),e}function l(b){if(b&&"script"==b[0]){var c=b[1],d=b[2],e=b[3],f=b[4],g=b[5],h=b[6],i=b[7],j=b[8];if(void 0===e&&(e="embedded"+B,B++),c){var k;k=f?$("
"):$("
");var l,m=new EdenUI.Highlight(k.get(0));l=d instanceof Array?EdenUI.plugins.ScriptInput.buildScriptFromList(d):d;var n=new Eden.AST(l);m.highlight(n,-1,-1),i&&"none"!=i&&k.css("float",i),"50%"!=j&&("number"==typeof j?k.width(j):k.css("width",j));var o=EdenUI.plugins.ScriptInput.getRequiredHeight(g,!0);return k.height(o),k}var p;z[e]?(p=z[e],p.update(d)):(p=a.views.ScriptInput.embed(e,e,d,h),z[e]=p);var q;q=f?$("
"):$("
");var o=EdenUI.plugins.ScriptInput.getRequiredHeight(g,!0);return q.height(o),i&&"none"!=i&&q.css("float",i),"50%"!=j&&("number"==typeof j?q.width(j):q.css("width",j)),p.contents.appendTo(q),q.resizable(),q}}function m(b){if(b&&"veden"==b[0]){var c,d=b[1],e=b[2],f=b[3],g=b[4],h=b[5];A[d]?c=A[d]:(c=a.views.Veden.embed(d,d,h),A[d]=c);var i;return i=$("
"),i.height(f),g&&"none"!=g&&i.css("float",g),"50%"!=e&&("number"==typeof e?i.width(e):i.css("width",e)),c.contents.appendTo(i),i.resizable(),i}}function n(b){var c,d=b[6],f=b[3],g=b[4];if(c=d?$("
"):$("
"),f&&c.css("width",e(f)),g&&c.css("height",e(g)),void 0===y[b[1]]){var h=a.views.Canvas2D.embedded(b[1],b[1],b[2]);y[b[1]]=h,c.append(h.code_entry),x.push(function(){h.resize(b[3],b[4])})}else y[b[1]].code_entry.appendTo(c),x.push(function(){y[b[1]].resize(b[3],b[4])});return"none"!=b[5]&&c.css("float",b[5]),c}function o(a){var b;if(b=a[1]?$("
    "):$("
      "),a[2]&&a[2]instanceof Array)for(var c=0;c"+a[2][c]+"");b.append(d)}return b}function p(a,b){if(!a)return"";if(!(a instanceof Array))return"";for(var c=$("
      "),e=0;e"));break;case"list":c.append(o(a[e]))}return c}function q(a,b){if(void 0!==b&&b instanceof Array){for(var c in y)y[c].code_entry.detach();for(var d in z)z[d].contents.detach();w.html(""),j(w.get(0),b);for(var e=0;e");$("#jseden-views").append(w).addClass("page-body");var x=[],y={},z={},A={},B=0,C=["top","bottom","left","right","width","height","background","position","color","border","font","fontSize","fontFamily","fontWeight","borderBottom","borderLeft","borderRight","borderTop","overflow","padding","paddingTop","paddingLeft","paddingRight","paddingBottom","margin","marginLeft","marginRight","marginTop","marginBottom","textShadow"];r(t,v),t.addJSObserver("pageGenerator",r),u.addJSObserver("pageGenerator",q),Eden.Selectors.execute("plugins > page > page",function(){eden.root.lookup("plugins_page_loaded").assign(!0,eden.root.scope),b&&b()})},EdenUI.plugins.Page.title="Page",EdenUI.plugins.Page.description="Generate web content from scripts.";var edenfunctions={};EdenUI.plugins.SymbolViewer=function(a,b){var c=this;this.instances=[];var d=0,e=function(a,b){var c='\t\t\t
      \t\t\t\t \t\t\t\tEdit Listed
      \t\t\t\t';return c+='\t\t\t
      \t\t\t
      '};this.createDialog=function(b,f,g){function h(){var b=q.value();return o.val().startsWith("select: ")?a.regExpFromStr("","",!1,b):a.regExpFromStr(o,"",!1,b)}function i(a,b){n.search(p.value,h()),"regexp"==b?o.attr("placeholder","search regular expression"):"simple"==b?o.attr("placeholder","simple search"):o.attr("placeholder","search")}var k=b.slice(0,-7),l=root.lookup("createView"),m=$('
      ');m.html(e(b,g));var n=new EdenUI.plugins.SymbolViewer.SymbolList(a.eden.root,m.find(".symbollist-results")[0],g);$dialog=$('
      ').append(m).dialog({appendTo:"#jseden-views",title:f,width:360,height:400,minHeight:200,minWidth:200,classes:{"ui-dialog":"symbollist-dialog ui-front"}}),c.instances.push(n),d++,1==d&&a.eden.root.addGlobal(j),m.find(".symbollist-search-box-outer > .symbollist-edit").click(function(){var b="edit_"+k;if(p.value.startsWith("select: ")){a.createView(b,"ScriptInput",void 0);var c=eden.root.lookup("view_"+b+"_tabs").value();Array.isArray(c)||(c=[]),c.push(p.value.substring(8)),eden.root.lookup("view_"+b+"_tabs").assign(c,eden.root.scope,Symbol.hciAgent),eden.root.lookup("view_"+b+"_current").assign(c.length-1,eden.root.scope,Symbol.hciAgent)}});var o=m.find(".symbollist-search-box-outer > .symbollist-search"),p=o[0],q=root.lookup("view_"+k+"_search_language");i(q,q.value()),q.addJSObserver("refreshView",i);var r=root.lookup("view_"+k+"_search_string"),s=function(a,b){void 0!==b&&(b!==p.value&&(p.value=b),n.search(b,h()))},t=r.value();void 0===t?(r.assign("",root.scope,l),n.search("",new RegExp(""))):s(r,t),r.addJSObserver("refreshView",s),o.keyup(function(){r.assign(p.value,root.scope,Symbol.hciAgent)});var u={destroy:function(){var b=c.instances.indexOf(n);c.instances.splice(b,1),d--,0==d&&a.eden.root.removeGlobal(j)}};return u},this.createObservableDialog=function(a,b){return c.createDialog(a,b,"obs")},this.createFunctionDialog=function(a,b){return c.createDialog(a,b,"func")},this.createAgentDialog=function(a,b){return c.createDialog(a,b,"agent")},this.createSymbolDialog=function(a,b){return c.createDialog(a,b,"all")};var f={},g={},h=!1;this.isCreationPending=function(a){return a in g},this.delay=40;var i=function(){for(x in c.instances){var a,b,d,e=c.instances[x];void 0===EdenUI.plugins.SymbolViewer.inlineEditorSymbol&&(a=$(e.symresults),b=a.parent(),d=a.scrollTop(),a.detach());for(var i in g){var j=g[i];e.filter?e.filter.indexOf(i)>=0&&e.addSymbol(j,i):e.addSymbol(j,i)}for(var i in f)e.updateSymbol(i);void 0===EdenUI.plugins.SymbolViewer.inlineEditorSymbol&&(a.appendTo(b),a.scrollTop(d))}f={},g={},h=!1},j=function(a,b){var d=a.name;if(1==b)g[d]=a;else{if(d in g)return;f[d]=a}h||(h=!0,setTimeout(i,c.delay))};a.views.ObservableList={dialog:this.createObservableDialog,title:"Observable List",category:a.viewCategories.comprehension,menuPriority:0},a.views.FunctionList={dialog:this.createFunctionDialog,title:"Function List",category:a.viewCategories.comprehension,menuPriority:0},a.views.AgentList={dialog:this.createAgentDialog,title:"Agent List",category:a.viewCategories.comprehension,menuPriority:0},a.views.SymbolList={dialog:this.createSymbolDialog,title:"Symbol List",category:a.viewCategories.comprehension,menuPriority:1},eden.root.lookup("plugins_symbolviewer_loaded").assign(!0,eden.root.scope),b()},EdenUI.plugins.SymbolViewer.title="Symbol Viewer",EdenUI.plugins.SymbolViewer.description="Provide various views of the symbol table.",EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0,EdenUI.plugins.SymbolViewer.SymbolList=function(a,b,c){this.root=a,this.regExp=new RegExp(""),this.type=c,this.category="all",this.customCategory=!1,this.subtypes="all",this.symresults=b,this.symbols={},this.filter=void 0},EdenUI.plugins.SymbolViewer.SymbolList.prototype.search=function(a,b,c,d){if("undefined"!=typeof a)if(a.startsWith("select: ")){var e=Eden.Selectors.query(a.substr(8),"symbol");console.log(e),this.filter=e,this.regExp=b,this.regExp=b,void 0!==d&&(this.subtypes=d),EdenUI.closeTooltip(),this.symresults.innerHTML="",this.symbols={};for(var f=0;f'),d&&this.element.addClass("symbollist-"+d+"-result"),c){case"func":this.update=this.updateFunction;break;case"agent":this.update=this.updateProcedure;break;case"obs":this.update=this.updateObservable}var f=this,g=!1;this.element.click(function(){EdenUI.plugins.SymbolViewer.inlineEditorSymbol||g||(g=!0,setTimeout(function(){if(!EdenUI.plugins.SymbolViewer.inlineEditorSymbol&&g){g=!1;"edit_"+f.name;Eden.Selectors.goto("> :not(ACTIVE) >> "+a.name)}},350))}),"obs"==c&&this.element.dblclick(function(){function a(){var a=l.get(0).value,b=o.value;";"!=b.slice(-1)&&(b+=";"),eden.execute2(f.name+" "+a+" "+b),e(),EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0}function c(b){var c=b.which;13==c?a():27==c&&(e(),EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0)}if(g=!1,EdenUI.plugins.SymbolViewer.inlineEditorSymbol!==f){var d=f.symbol.cache.value;if(void 0!==f.symbol.definition||"boolean"!=typeof d){EdenUI.plugins.SymbolViewer.inlineEditorSymbol=f,f.element.addClass("symbollist-inline-editor");var h=f.element.find(".result_value"),i=f.element.find(".result_separator");h.html("");var j,k;void 0!==f.symbol.definition?(j=f.symbol.getSource().replace(new RegExp("^\\s*"+b+"\\s+is\\s+"),""),k="is"):(j=Eden.edenCodeForValue(d),k="=");var l=$("");"="==k?(l.append(''),l.append('')):(l.append(''),l.append('')),i.html(" "),i.append(l);var m=Eden.htmlEscape(j,!0),n=$(''),o=n.get(0);n.on("keyup",c),n.on("blur",function(){setTimeout(function(){l.is(document.activeElement)||(e(),setTimeout(function(){EdenUI.plugins.SymbolViewer.inlineEditorSymbol===f&&(EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0)},500))},0)}),l.on("keydown",c),l.on("blur",function(){setTimeout(function(){n.is(document.activeElement)||(e(),setTimeout(function(){EdenUI.plugins.SymbolViewer.inlineEditorSymbol===f&&(EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0)},500))},0)}),h.append(n);var p=f.element.find(".symbollist-result-inner");p.length>0&&(p.get(0).onmouseenter=void 0),EdenUI.closeTooltip(),o.focus(),o.select();var q=j.slice(0,1);'"'!=q&&"'"!=q&&"["!=q&&"{"!=q||(o.selectionStart=1,o.selectionEnd=j.length-1)}else d===!0?f.symbol.assign(!1,eden.root.scope,Symbol.hciAgent,!0):f.symbol.assign(!0,eden.root.scope,Symbol.hciAgent,!0)}}),this.update()},EdenUI.plugins.SymbolViewer.Symbol.prototype.updateFunction=function(){var a,b,c=this.symbol.getSource();if(a=void 0===this.symbol.definition||/^func\s/.test(c)?this.name:""+this.name+"",void 0!=edenfunctions.functions&&void 0!==edenfunctions.functions[this.name]){this.details=edenfunctions.functions[this.name];var d=Object.keys(this.details.parameters||{});b="( "+d.join(", ")+" )"}else b="";var e=""+a+""+b;if(void 0!==this.symbol.definition&&!/^func\s/.test(this.symbol.eden_definition)){var f=Eden.htmlEscape(c,!1,!0);f=Eden.htmlEscape("
      "+f+";
      "),e=""+e+""}this.element.html(e)},EdenUI.plugins.SymbolViewer.Symbol.prototype.updateObservable=function(){var a,b=this.symbol.value(),c=_formatVal(b);a=void 0!==this.symbol.definition?""+this.name+"":this.name;var d=""+a+" = "+c+"";if(void 0!==this.symbol.definition){var e=Eden.htmlEscape(this.symbol.getSource(),!1,!0);e=Eden.htmlEscape("
      "+e+";
      "),d=""+d+""}this.element.html(d)},EdenUI.plugins.SymbolViewer.Symbol.prototype.updateProcedure=function(){var a,b,c=this.symbol.getSource();if(a=void 0===this.symbol.definition||/^proc\s/.test(c)?this.name:""+this.name+"",void 0!=edenfunctions.functions&&void 0!==edenfunctions.procedures[this.name]){this.details=edenfunctions.procedures[this.name];var d=Object.keys(this.details.parameters||{});b="( "+d.join(", ")+" )"}else b="";var e=""+a+""+b;if(void 0!==this.symbol.definition&&!/^proc\s/.test(c)){var f=Eden.htmlEscape(c,!1,!0);f=Eden.htmlEscape("
      "+f+";
      "),e=""+e+""}this.element.html(e)};var edenfunctions={};EdenUI.plugins.VersionViewer=function(a,b){var c=this;this.instances=[];var d=0,e=function(a,b){var c='
      ';return c};this.createDialog=function(b,f,g){var h=b.slice(0,-7),i=(root.lookup("createView"),$('
      '));i.html(e(b,g)),$dialog=$('
      ').append(i).dialog({appendTo:"#jseden-views",title:f,width:360,height:400,minHeight:200,minWidth:200,classes:{"ui-dialog":"versionviewer-dialog ui-front"}});var j=(root.lookup("view_"+h+"_search_string"),function(){var a=URLUtil.getParameterByName("load");$.get(Eden.DB.remoteURL+"/project/versions",{projectID:a},function(b){var c=i.find(".version-viewer-list").html(""),d=$("VidDateParentDiff");c.append(d),$(b).each(function(b,d){var e=$(''+d.saveID+""+d.date+""+d.parentDiff+"");c.append(e)})})});j();var k={destroy:function(){var b=c.instances.indexOf(symbollist);c.instances.splice(b,1),d--,0==d&&a.eden.root.removeGlobal(symbolChanged)}};return k},this.createVersionListDialog=function(a,b){return c.createDialog(a,b,"all")},a.views.VersionList={dialog:this.createVersionListDialog,title:"Version List",category:a.viewCategories.history,menuPriority:1},eden.root.lookup("plugins_VersionViewer_loaded").assign(!0,eden.root.scope),b()},EdenUI.plugins.VersionViewer.title="Version Viewer",EdenUI.plugins.VersionViewer.description="Show version details for a specified project.",EdenUI.plugins.VersionViewer.inlineEditorSymbol=void 0,EdenUI.plugins.ExternalHTMLContent=function(a,b){function c(){d=!1}var d=!1,e=!1;this.createDialog=function(b,f){function g(a,b){void 0===b?n.src="plugins/external-html-content/undefined-url.html?view="+encodeURI(j):n.src="plugins/external-html-content/redirect.html?view="+encodeURI(j)+"&url="+encodeURI(b)}function h(a,b){b?(r.value()&&l.addClass("external-html-content-pinned"),p.css("display","block")):(l.removeClass("external-html-content-pinned"),p.css("display","none")); -}function i(a,b){q.value()&&l.toggleClass("external-html-content-pinned",b)}e||(""==document.location.hash&&window.history.pushState({},"","#noNavigateAway"),window.addEventListener("popstate",function(){""==document.location.hash&&(d?window.history.forward(1):a.modalDialog("Leave Environment?","

      Leaving this page will discard the current script. Your work will not be saved.

      Are you sure you want to close JS-EDEN?

      ",["Close JS-EDEN","Return to Construal"],1,function(a){0==a?(doingNavigateAway=!0,window.history.back(1)):window.history.forward(1)}))}),e=!0);var j=b.slice(0,-7),k=root.lookup("createView"),l=$(''),m=root.lookup("_view_"+j+"_url"),n=l[0];g(m,m.value()),m.addJSObserver("refreshView",g);var o=$('
      ').html(l).dialog({title:f,width:600,height:450,minHeight:120,minWidth:230,dialogClass:"external-html-content"}),p=$('
      ');o.append(p);var q=root.lookup("_view_"+j+"_toolbar_visible"),r=root.lookup("_view_"+j+"_toolbar_pinned");void 0===q.value()&&q.assign(!0,root.scope,k),void 0===r.value()&&r.assign(!1,root.scope,k),h(q,q.value()),q.addJSObserver("refreshView",h),r.addJSObserver("refreshView",i);var s=$('');s.on("click",function(){r.assign(!r.value(),root.scope,Symbol.hciAgent),n.focus()}),p.append(s);var t=$('');t.on("click",function(){d||setTimeout(c,1e3),d=!0,window.history.back(1),n.focus()}),p.append(t);var u=$('');u.on("click",function(){window.history.forward(1),n.focus()}),p.append(u);var v=$('');return v.on("click",function(){g(m,m.value()),n.focus()}),p.append(v),{confirmClose:!0}},a.views.ExternalHTMLContent={dialog:this.createDialog,title:"External HTML Content",category:a.viewCategories.visualization,holdsContent:!0},a.eden.include("plugins/external-html-content/external-html-content.js-e",b)},EdenUI.plugins.ExternalHTMLContent.title="External HTML Content",EdenUI.plugins.ExternalHTMLContent.description="Allows construals to display web pages created outside of JS-EDEN.",EdenUI.plugins.HTMLContent=function(a,b){this.createDialog=function(a,b){function c(a){return"view_"+e+"_"+a}function d(a,b){k.get(0).parentNode.style.background=b}var e=a.slice(0,-7),f=[c("background_colour"),c("content")],g=$('
      ');g.on("mousedown","button",function(a){var b=a.currentTarget.name,c=a.currentTarget.getAttribute("data-value");null!==c&&null!==c.charAt(0).match(/[0-9]?/)&&(c=parseInt(c)),eden.root.lookup(b).assign(null===c||c,eden.root.scope,Symbol.hciAgent)}),g.on("mouseup","button",function(a){var b=a.currentTarget.name,c=a.currentTarget.getAttribute("data-value");null===c&&eden.root.lookup(b).assign(!1,eden.root.scope,Symbol.hciAgent)}),g.on("click",function(a){var b=a.srcElement.getAttribute("data-jseden");b&&""!=b&&(console.log(b),eden.execute2(b,{name:"execute"}))});var h=root.lookup("view_"+e+"_content"),i=function(a,b){void 0===b?g.html('
      Give view_'+e+"_content a value to display HTML formatted text here.
      "):g.html(b)};i(h,h.value()),h.addJSObserver("repaintView",i);var j=root.lookup("view_"+e+"_background_colour");j.addJSObserver("changeColour",d);var k=$('
      ').html(g).dialog({appendTo:"#jseden-views",title:b,width:600,height:450,minHeight:120,minWidth:230,classes:{"ui-dialog":"htmlviews-dialog ui-front"}}),l=j.value();return l&&d(j,l),{confirmClose:!0}},a.views.HTMLContent={dialog:this.createDialog,title:"HTML Content",category:a.viewCategories.visualization,holdsContent:!0},Eden.Selectors.execute("plugins > html > html",function(){eden.root.lookup("plugins_html_loaded").assign(!0,eden.root.scope,Symbol.localJSAgent),b&&b()})},EdenUI.plugins.HTMLContent.title="HTML Content",EdenUI.plugins.HTMLContent.description="Provides construals with the ability to create windows dedicated to displaying HTML content created using EDEN code.",EdenUI.plugins.ExpressionTree=function(a,b){var c=this;this.createDialog=function(a,b){var c='
      ';$dialog=$('
      ').html(c).dialog({title:b,width:300,height:450,minHeight:120,minWidth:230})};var d=function(a,b,c,d,e){var f=function(g,h,i){if(!g.hasOwnProperty("children"))return g.name;var j,k,l,m=g.name,n=g.children;if(b.hasOwnProperty(m)&&2==n.length){j=b[m],k=j.precedence;var o=j.associativity,p=f(n[0],k,j.text),q=f(n[1],k,j.text);if("left"==o){var r=n[1].name;n[1].hasOwnProperty("children")&&2==n[1].children.length&&b.hasOwnProperty(r)&&k==b[r].precedence&&(q="("+q+")")}else{var s=n[0].name;n[0].hasOwnProperty("children")&&2==n[0].children.length&&b.hasOwnProperty(s)&&k==b[s].precedence&&(p="("+p+")")}l=j.whitespace?p+" "+j.text+" "+q:p+j.text+q}else if(a.hasOwnProperty(m))j=a[m],k=j.precedence,l=j.text+f(n[0],k,j.text);else if(c.hasOwnProperty(m))j=c[m],k=j.precedence,l=f(n[0],k,j.text)+j.text;else if(d.hasOwnProperty(m))j=d[m],this.precedence=j.precedence,l=j.code(n,i);else{k=e;for(var t=[],u=0;u"]={precedence:6,associativity:"left",text:">=",whitespace:!0},e[">="]={precedence:6,associativity:"left",text:">",whitespace:!0},e["=~"]={precedence:6,associativity:"left",text:"=~",whitespace:!0},e["!~"]={precedence:6,associativity:"left",text:"!=",whitespace:!0},e["//"]={precedence:7,associativity:"left",text:"//",whitespace:!0},e["+"]={precedence:8,associativity:"left",text:"+",whitespace:!0},e["-"]={precedence:8,associativity:"left",text:"-",whitespace:!0},e["*"]={precedence:9,associativity:"left",text:"*",whitespace:!0},e["/"]={precedence:9,associativity:"left",text:"/",whitespace:!0},e["%"]={precedence:9,associativity:"left",text:"%",whitespace:!0},e["^"]={precedence:11,associativity:"right",text:".",whitespace:!1},e["."]={precedence:14,associativity:"left",text:".",whitespace:!1};var f={};f["-"]={precedence:10,text:"-"},f["!"]={precedence:10,text:"!"},f["&"]={precedence:10,text:"&"},f.not={precedence:10,text:"!"},f["++."]={precedence:11,text:"++"},f["--."]={precedence:11,text:"--"},f["*"]={precedence:12,text:"*"};var g={};g["#"]={precedence:11,text:"#"},g[".++"]={precedence:11,text:"++"},g[".--"]={precedence:11,text:"--"};var h={},i=13;this.convertTreeToEden=d(f,e,g,h,i),h["?"]={precedence:2,code:function(a){var b=c.convertTreeToEden(a[0]),d=c.convertTreeToEden(a[1]),e=c.convertTreeToEden(a[2]);return b+"? "+d+" : "+e}},h["`...`"]={precedence:13,code:function(a){var b=c.convertTreeToEden(a[0]);return"`"+b+"`"}},h["${{...}}$"]={precedence:13,code:function(a){var b=a[0].name;return"${{ "+b+" }}$"}},h["(...)"]={precedence:13,code:function(a){for(var b=c.convertTreeToEden(a[0]),d=[],e=1;e'+c(a)+"
      "),$dialog=$('
      ').html(code_entry).dialog({title:b,width:600,height:450,minHeight:120,minWidth:230})},a.views.SymbolLookUpTable={dialog:this.createDialog,title:"Symbol Look-Up Table",category:a.viewCategories.comprehension,menuPriority:3},this.search=function(b){var c=$("#"+b+"-regexp"),e=a.regExpFromStr(c);document.getElementById(b+"-table-div").innerHTML=d(e,b)};var c=function(a){var b="",c="
      "+b+"
      "+d(new RegExp(""),a)+"
      ";return c},d=function(a,b){var c='NameTypeDefinitionCurrent ValueWatchesUpdatesBackticksLast Modified ByJavaScript Actions';tableBodyHTML="";var d,h=[],i={};for(var j in root.symbols)if(d=root.symbols[j],a.test(j)){var k,l,m;if(void 0===d.eden_definition)l="-",k="function"==typeof d.cache.value?"Function":"Observable",m=Eden.htmlEscape(Eden.edenCodeForValue(d.cache.value));else if(l=Eden.htmlEscape(d.eden_definition),0==l.indexOf("proc")){if(Eden.isitSystemAgent(j)&&!new RegExp("\\b"+j+"\\b").test(a.source))continue;k="Agent",m=""}else if(0==l.indexOf("func")){if(Eden.isitSystemFunction(j)&&!new RegExp("\\b"+j+"\\b").test(a.source))continue;k="Function",m=""}else k="Dependency",m=Eden.htmlEscape(Eden.edenCodeForValue(d.cache.value));h.push([d,j,k,l,m]),i[j]=!0}for(var n=0;n

      '+o[1]+'

      '+o[2]+'

      '+o[3]+'

      '+o[4]+'

      '+r+'

      '+u+'

      '+v+'

      '+w+'

      '+x+"

      ";/^((_view_.*)|mousePosition|mouseView)$/.test(o[1])?tableBodyHTML+=y:tableBodyHTML=y+tableBodyHTML}return""+c+tableBodyHTML+"
      "},e=function(a,b,c){var d=[];for(var e in a){var f=e.slice(1);d.push(g(f,b,c))}return d.join(", ")},f=function(a,b,c){for(var d=[],e=0;e"+a+"
      ":""+a+""};this.addSymbolToSearch=function(b,c){var d,e=document.getElementById(b+"-regexp");d="false"==a.getOptionValue("optSimpleWildcards")?e.value+"|^"+c+"$":e.value+" "+Language.ui.search.disjunction+" "+c,e.value=d,this.search(b)},this.jump=function(a){var b=location.href;location.href="#"+a,history.replaceState(null,null,b)},b()},EdenUI.plugins.SymbolLookUpTable.title="Symbol Look-Up Table",EdenUI.plugins.SymbolLookUpTable.description="Displays detailed information about symbols.",EdenUI.plugins.SymbolLookUpTable.originalAuthor="Joe Butler";var edenfunctions={};SymbolMeta=function(a){this.symbol=a,this.interestingness=0,this.significance=.5,this.index=0,this.isinteresting=!1,this.oldstr=""},SymbolMeta.DependencyComplexityRate=.4,SymbolMeta.DependencyChangeProbability=.01,SymbolMeta.SubscriberRate=.1,SymbolMeta.DecayRate=.9999,SymbolMeta.DependencyPercentage=.5,SymbolMeta.SubscriberPercentage=.5,SymbolMeta.SigDeleteRate=.1,SymbolMeta.SigInterestingRate=1.01,SymbolMeta.prototype.dependencyInterestingness=function(a){var b=0,c=0,d=.1;for(var e in this.symbol.dependencies){b++,d+=(1-d)*SymbolMeta.DependencyComplexityRate;var f=e.substr(1);void 0!==a.meta[f]&&a.meta[f].interestingness>=a.minInteresting()&&c++}return d-=b*SymbolMeta.DependencyChangeProbability,0!=b&&(d=.5*d+.5*(c/b)),d<0?0:d},SymbolMeta.prototype.subscriberInterestingness=function(a){var b=0,c=0,d=0;for(var e in this.symbol.subscribers){b++,d+=(1-d)*SymbolMeta.SubscriberRate;var f=e.substr(1);void 0!==a.meta[f]&&a.meta[f].interestingness>=a.minInteresting()&&c++}return d=1-d,0!=b&&(d=.5*d+.5*(c/b)),d},SymbolMeta.prototype.nameInterestingness=function(){var a=this.symbol.name.substr(1);return"_"==a[0]?.5:/\d/.test(a)?.9:1},SymbolMeta.prototype.frequencyInterestingness=function(){},SymbolMeta.prototype.update=function(a){var b=0;b=this.dependencyInterestingness(a)*this.subscriberInterestingness(a)*this.nameInterestingness()*this.significance,this.interestingness=b},EdenUI.plugins.ObservableMining=function(a,b){var c=this;this.meta={},this.interesting=[],this.limitInteresting=15,this.symresults=void 0,this.symbolsui=[];var d=function(a){var b='
      ';return b};this.createDialog=function(a,b){var e=(a.slice(0,-7),$("
      "));e.html(d(a)),c.symresults=e.find(".symbolframer-results")[0],$dialog=$('
      ').html(e).dialog({title:b,width:360,height:400,minHeight:200,minWidth:200,dialogClass:"unpadded-dialog"})},this.delay=100;var e=void 0,f=function(){if(void 0!==c.symresults){var a=$(c.symresults).parent();$(c.symresults).detach();for(var b=0;b=c.minInteresting())){c.interesting.length;if(c.interesting.length==c.limitInteresting){var g=c.interesting[c.interesting.length-1];g.isinteresting=!1,c.interesting.pop()}c.interesting.push(e),e.isinteresting=!0,e.significance*=SymbolMeta.SigInterestingRate,c.interesting.sort(function(a,b){return b.interestingness-a.interestingness})}}},a.eden.root.addGlobal(e),a.views.ObservableMining={dialog:this.createDialog,title:"Observable Mining",category:a.viewCategories.comprehension,menuPriority:1},$(document).tooltip(),b()},EdenUI.plugins.ObservableMining.prototype.minInteresting=function(){return this.interesting.length>0?this.interesting[this.interesting.length-1].interestingness:0},EdenUI.plugins.ObservableMining.prototype.maxInteresting=function(){return this.interesting.length>0?this.interesting[0].interestingness:0},EdenUI.plugins.ObservableMining.title="Observable Mining",EdenUI.plugins.ObservableMining.description="Automatically generate search for interesting observables",EdenUI.plugins.ObservableMining.Symbol=function(){this.symbol=void 0,this.name=void 0,this.meta=void 0,this.element=$('
      '),this.details=void 0,this.update=void 0,this.outofdate=!1,this.dodelete=!1,this.symbolChanged=void 0,this.editing=!1,this.update=this.updateObservable;var a=this;this.element.hover(function(){$(this).animate({backgroundColor:"#eaeaea"},100)},function(){$(this).animate({backgroundColor:"#fafafa"},100),1==a.editing&&(a.editing=!1,a.element.find("textarea").remove(),a.element.animate({height:"20px"},"fast"))}).click(function(){if(!a.editing){var b;b="function"==typeof a.symbol.value()&&void 0!==a.symbol.eden_definition?a.symbol.eden_definition:a.symbol.definition?a.symbol.eden_definition+";":a.name+" = "+Eden.edenCodeForValue(a.symbol.value())+";",a.element.animate({height:"60px"},{duration:200,complete:function(){var c=$('');c.val(b),c.appendTo(a.element),c.show("fast")}}),a.editing=!0}}).draggable({distance:40,axis:"x",scroll:!1,drag:function(b,c){c.position.left>150?a.dodelete=!0:a.dodelete=!1},revert:function(b,c){return!a.dodelete},stop:function(b,c){a.dodelete&&(a.meta.significance*=SymbolMeta.SigDeleteRate,a.symbolChanged(a.symbol,!1),a.element.hide("drop",{direction:"right"},"slow",function(){a.element.remove()}))}})},EdenUI.plugins.ObservableMining.Symbol.prototype.updateObservable=function(a,b){if(void 0!==this.symbol){0==b&&(b=1);var c,d=(this.meta.interestingness-a)*(1/(b-a)),e=Math.round(8+12*d),f=this.symbol.value(),g=_formatFramerVal(f);c=void 0!==this.symbol.definition?""+this.name+"":this.name;var h=""+c+" = "+g+"";if(void 0!==this.symbol.definition){var i=Eden.htmlEscape(this.symbol.eden_definition,!1,!0);i=Eden.htmlEscape("
      "+i+";
      "),h=""+h+""}var j=this.element.find(".observable");j.html(h),j.css({"font-size":e+"px"})}},EdenUI.plugins.ObservablePalette=function(a,b){function c(a){var b=a.value();return"function"!=typeof b||!/\breturn\s+([^\/;]|(\/[^\/*]))/.test(b.toString())}function d(a,b){var d=a.term,e=i[d];if(void 0===e){var f=new RegExp("^"+d);e=[];for(var g in root.symbols)f.test(g)&&c(root.symbols[g])&&e.push(g);i[d]=e}b(e)}function e(){var a=h;return h++,a}function f(b,c,d,g,h,i){function j(a){var b=a.target.value;if("hide"==b)return void h.remove(c,g,d);var e;"boolean"==b?e=!1:"number"==b?e=0:"string"==b&&(e=""),o.assign(e,Symbol.hciAgent,!0)}function k(a){pa.fadeOut(250,"linear",function(){a?(pa.html("true"),pa.css("color","green")):(pa.html("false"),pa.css("color","red")),pa.fadeIn(400,"swing",function(){y.html(a?"true":"false")})})}var l=128;g?(g.hasClass("ui-accordion")&&g.accordion("destroy"),g.html("")):(g=$('
      '),i&&g.data("editor","read-only"));var m,n=a.eden.root,o=n.lookup(c),p=o.value(),q=typeof p,r="string"==q,s=!i||r,t=o.eden_definition;if(!i&&void 0!==o.eden_definition){var u=t.match(/^\S+\s+is\s+(.*?);?$/);rhs=u[1],q="definition"}var v=$('

      '+c+"

      ");i&&g.addClass("observable-palette-dependency-value-box");var w=$('
      ');v.append(w),g.append(v);var x=Eden.prettyPrintValue("",p,l,!1,!1),y=$(""+x+"");w.append(y);var z=$("");i?z.append('"):(z.append(''),z.append(''),z.append(''),z.append('')),z.append(''),z[0].value=q,z.on("change",j),w.on("click",function(a){a.stopPropagation()}),y.on("click",function(a){y.detach(),w.append(z),z.focus()}),z.on("blur",function(a){z.detach(),w.append(y)});var A=$("
      ");if("definition"==q){var B=$('
      ');B.append(c+" is "),rhsSpan=$(''),rhsSpan.append(Eden.htmlEscape(rhs)),B.append(rhsSpan),B.append(";"),B.on("click",function(a){rhsSpan.focus(),B.addClass("focussed")}),rhsSpan.on("blur",function(a){B.removeClass("focussed")}),A.append(B);var C=$('
      ');A.append(C);var D=$('Expand');D.click(function(){H.find(".observable-palette-obs-box.ui-accordion").accordion("option","active",0)});var E=$('Collapse');E.click(function(){H.find(".observable-palette-obs-box.ui-accordion").accordion("option","active",!1)});var F=$('Hide');F.click(function(){var a=H.find(".observable-palette-obs-box");a.removeClass("observable-palette-visible"),a.slideUp()});var G=$('Show');G.click(function(){var a=H.find(".observable-palette-obs-box");a.addClass("observable-palette-visible"),a.slideDown()}),C.append(D),C.append(E),C.append(F),C.append(G);var H=$('
      ');H.sortable({connectWith:".observable-palette-column",forcePlaceholderSize:!0,handle:"h3",items:">.observable-palette-obs-box",placeholder:"observable-palette-drag-placeholder",tolerance:"pointer",receive:function(a,b){var d=b.item,e=d.data("observable");(!o.isDependentOn("/"+e)||e==c&&"read-only"!=d.data("editor"))&&b.sender.sortable("cancel"),2==H.children(".observable-palette-visible").length&&C.slideDown(),h.removeDuplicates(a.target,d)},remove:function(a,b){H.children(".observable-palette-visible").length<2&&C.slideUp()}});var I,J=0;for(var K in o.dependencies){var L=o.dependencies[K];K=K.slice(1),void 0===L.eden_definition&&(I=f(b,K,e(),void 0,h,!1),h.register(K,I),H.append(I),J++)}if(J<2&&C.hide(),m=function(a,e){var i=a.eden_definition;void 0===i?f(b,c,d,g,h,!1):y.html(Eden.prettyPrintValue("",e,l,!1,!1))},A.append(H),r){var M=f(b,c,e(),void 0,h,!0);H.append(M)}}else if("number"==q){var N,O,P;if(P=1==p||p==-1||p!=Math.floor(p)?5e-4:1,0==p)N=0,O=10;else if(p>=-1&&p<=1)N=p>0?0:-1,O=1;else if(p<0){N=2*p;var Q=Number((-p%P).toPrecision(14));0!=Q&&Q!=P&&(N=N+Q-P),O=N+2*(p-N)}else N=0,O=2*Math.ceil((p/P).toPrecision(16))*P; -var R=$(''),S=R[0];R.on("input",function(a){o.assign(parseFloat(S.value),Symbol.hciAgent,!0)});var T=$('
      '),U=$("");T.append(U);var V=$('');V.append(R),U.append(V);var W=$('');T.append(W);var X=$(''),Y=$(''),Z=Y[0];X.append(Y),W.append(X),Y.on("input",function(a){var b=a.target.value;if(""!=b){var c=parseFloat(b);S.min=b;var d=o.value();c>=0&&d0?c+Math.ceil((c/e).toPrecision(16))*e:Math.ceil((c/2/e).toPrecision(16))*e,f');W.append(ca);var da=$('
      ');ca.append(da);var ea=$('');da.append(ea);var fa=$(''),ga=fa[0];ea.append(fa),fa.on("input",function(a){var b=a.target.value;""!=b&&(S.value=b,o.assign(parseFloat(b),Symbol.hciAgent,!0))}),fa.on("focus",function(a){ba=!0,aa=a.target.value}),fa.on("blur",function(a){var b=a.target.value;if(""==b)o.assign(parseFloat(aa),Symbol.hciAgent,!0);else{var c=o.value(),d=parseFloat(S.min);c'),ia=$(''),ja=ia[0];ha.append(ia),W.append(ha),ia.on("input",function(a){S.max=a.target.value});var ka=$('');da.append(ka);var la=$(''),ma=la[0];ma.acceptedValue=P,ka.append(la),la.on("input",function(a){var b=parseFloat(ma.value);if(b>0){var c,d=Math.floor(b);if(b==d){var e=String(b).match(/(0*)$/);c=Math.pow(10,e[1].length)}else c=Math.pow(10,-((b-d).toPrecision(15).replace(/0*$/,"").length-2));b==c&&b0?(j=Math.ceil(e/2/p)*p-p,m=Number((e%p).toPrecision(14)),0!=m&&m!=p&&(j+=m)):(j=2*e,m=Number((-e%p).toPrecision(14)),0!=m&&m!=p&&(j=j+m-p)),S.min=j,Z.value=j,k=j+Math.round((o-j)/p)*p,S.max=k,ja.value=k):e>o&&(k=n+2*Math.ceil(((e-n)/p).toPrecision(16))*p,S.max=k,ja.value=k),S.value=e,ga.value=e}},A.append(T)}else if("boolean"==q){var na=$(''),oa=na[0],pa=$('');na.on("change",function(a){var b=oa.checked;o.assign(b,o.hciAgent,!0)}),m=function(a,e){e!==!0&&e!==!1||void 0!==a.eden_definition?f(b,c,d,g,h,i):(oa.checked=e,k(e))},k(p);var qa=$('');qa.append(na),qa.append(pa),A.append(qa)}else if("string"==q){var ra=$('"),sa=ra[0];ra.on("input",function(a){var b=sa.value;o.assign(b,Symbol.hciAgent,!0),sa.style.height="",sa.style.height=String(sa.scrollHeight+4)+"px"}),m=function(a,e){"string"!=typeof e||void 0!==a.eden_definition?f(b,c,d,g,h,i):(sa.value=e,sa.rows=e.split("\n").length,y.html(Eden.prettyPrintValue("",e,l,!1,!1)))},A.append($('
      ')),A.append(ra),A.append($('
      '))}else if("undefined"==q){if(A.append($('

      '+c+" is currently undefined.

      ")),!i){var ta=z.clone();ta[0].value="undefined",ta.on("change",j);var ua=$("");ua.append(ta);var va=$("
      ");va.append(ua),A.append(va)}m=function(a,e){void 0===e&&void 0===a.eden_definition||f(b,c,d,g,h,i)}}else m=function(a,e){void 0===e&&void 0===a.eden_definition||f(b,c,d,g,h,i)};return o.addJSObserver(b+"/"+c+"/"+d,m),s?(i&&A.find("input, textarea").attr("readonly","readonly"),g.append(A),g.accordion({active:"undefined"!=q&&void 0,collapsible:!0,heightStyle:"content"})):v.addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all observable-palette-static-header"),g.removeFromDialog=function(){h.remove(c,g,d)},g}function g(a,b){a.target.style.minWidth=b.size.width+"px"}var h=0,i={};root.addGlobal(function(a,b,d){if(d&&c(b)){var e=b.name.slice(1);for(var f in i)new RegExp("^"+f).test(e)&&i[f].push(e)}}),this.createDialog=function(b,c){function h(a,b){for(var c=b.data("observable"),d=b[0],e=p[c],f=0;f'),p={},q=$(''),r=q[0];q.on("keyup",function(a){13==a.which&&(j(r.value,0,!1),r.value="")}),q.autocomplete({minLength:2,source:d});var s=$('');s.click(function(){j(r.value,0,!1),r.value=""});var t=$('');t.on("click",function(a){l(r.value),r.value=""});var u=$(""),v=$(''),w=v[0];u.append(v),u.append(" Advanced");var x=root.lookup("_view_"+m+"_advanced"),y=x.value();void 0===y?(x.assign(!1,n),o.addClass("observable-palette-no-advanced")):y||o.addClass("observable-palette-no-advanced"),x.addJSObserver("repaintView",function(a,b){o.toggleClass("observable-palette-no-advanced",!b),w.checked=b}),v.on("change",function(a){x.assign(a.target.checked,n)});var z=$('
      ');z.append(q),z.append(s),z.append(t),z.append(u);var A=[],B=7,C=root.lookup("_view_"+m+"_observables"),D=C.value();Array.isArray(D)&&(D.length>0&&!Array.isArray(D[0])&&(D=[D]),D.length>B&&(B=D.length));for(var E=0;E');F.sortable({connectWith:".observable-palette-column, .observable-palette-dependencies",forcePlaceholderSize:!0,handle:"h3",items:">.observable-palette-obs-box",placeholder:"observable-palette-drag-placeholder",scroll:!1,tolerance:"pointer",receive:function(a,b){var c=a.target,d=b.item;h(c,d)}}),E')),e=($("
      "),$('
      '),$('
      '),$('
      '));d.append(e);var f=$('');d.append(f);var g={};e.on("click",".scriptgen-importex",function(a){var b=a.currentTarget.getAttribute("data-agent");g[b]?g[b]=!1:g[b]=!0,h()});var h=function(){e.html("");for(var a=c.generateScriptLines(g),b=0;b '+f[1]+"";if(f.length>2)for(var i=2;i'+(g[d]?"":"")+""+(g[d]?'## '+a.imports[b]+"":h)+"");e.append(j)}e.append($('
      '));var k=$("
      ");e.append(k);var l=a.definitions.join("\n")+"\n## When agents\n\n"+a.agents,m=new Eden.AST(l,(void 0),{name:"*JavaScript"}),n=new EdenUI.Highlight(k.get(0));n.highlight(m,-1,-1)};f.click(function(){h()}),h(),$('
      ').html(d).dialog({appendTo:"#jseden-views",title:b,width:790,height:700,minHeight:120,minWidth:230,dialogClass:"scriptgen-dialog"})};this.generateScriptLines=function(a){var b={},c=Eden.Generator.importsScript().split("\n");b.imports=c;var d=Eden.Generator.symbolScript(a).split("\n");b.definitions=d;var e=Eden.Agent.getActiveAgents(a,!1);return b.agents=e,b},this.baseConstrualSymbols={},this.changeListener=function(a,b){var d=a.last_modified_by;if(!b&&"include"!=d){var e=a.name.slice(1);void 0!==a.eden_definition&&void 0!==a.definition?c.baseConstrualSymbols[e]={eden_definition:a.eden_definition,last_modified_by:d}:c.baseConstrualSymbols[e]={cached_value:a.cached_value,last_modified_by:d}}},a.eden.listenTo("executeError",EdenUI.plugins.ScriptGenerator,function(a,b){root.removeGlobal(c.changeListener)}),this.baseConstrualURL="",a.views.ScriptGenerator={dialog:this.createDialog,title:"Script Generator",category:a.viewCategories.history},b()},EdenUI.plugins.ScriptGenerator.title="Script Generator",EdenUI.plugins.ScriptGenerator.description="Generates a definitional script that can be used to recreate the current state of the environment at a later time.",EdenUI.plugins.ScriptGenerator.originalAuthor="Joe Butler",EdenUI.plugins.ScriptGenerator.loadBaseConstrual=function(a){"ScriptGenerator"in edenUI.plugins&&root.addGlobal(edenUI.plugins.ScriptGenerator.changeListener),eden.include(a,"",{name:Symbol.getInputAgentName()},function(){"ScriptGenerator"in edenUI.plugins&&(root.removeGlobal(edenUI.plugins.ScriptGenerator.changeListener),edenUI.plugins.ScriptGenerator.baseConstrualURL=a)})},function(){"use strict";var a,b=this;a="undefined"!=typeof exports?exports:b.Springy={};var c=a.Graph=function(){this.nodeSet={},this.nodes=[],this.edges=[],this.adjacency={},this.nextNodeId=0,this.nextEdgeId=0,this.eventListeners=[]},d=a.Node=function(a,b){this.id=a,this.data=void 0!==b?b:{}},e=a.Edge=function(a,b,c,d){this.id=a,this.source=b,this.target=c,this.data=void 0!==d?d:{}};c.prototype.addNode=function(a){return a.id in this.nodeSet||this.nodes.push(a),this.nodeSet[a.id]=a,this.notify(),a},c.prototype.addNodes=function(){for(var a=0;a=0;b--)this.nodes[b].id===a.id&&this.nodes.splice(b,1);this.detachNode(a)},c.prototype.detachNode=function(a){var b=this.edges.slice();b.forEach(function(b){try{b.source.id!==a.id&&b.target.id!==a.id||this.removeEdge(b)}catch(c){}},this),this.notify()},c.prototype.removeEdge=function(a){for(var b=this.edges.length-1;b>=0;b--)this.edges[b].id===a.id&&this.edges.splice(b,1);for(var c in this.adjacency){for(var d in this.adjacency[c]){for(var e=this.adjacency[c][d],f=e.length-1;f>=0;f--)this.adjacency[c][d][f].id===a.id&&this.adjacency[c][d].splice(f,1);0==this.adjacency[c][d].length&&delete this.adjacency[c][d]}j(this.adjacency[c])&&delete this.adjacency[c]}this.notify()},c.prototype.merge=function(a){var b=[];a.nodes.forEach(function(a){b.push(this.addNode(new d(a.id,a.data)))},this),a.edges.forEach(function(a){var c=b[a.from],d=b[a.to],f=a.directed?f=a.type+"-"+c.id+"-"+d.id:c.idb.x&&(b.x=d.p.x),d.p.y>b.y&&(b.y=d.p.y)});var c=b.subtract(a).multiply(.07);return{bottomleft:a.subtract(c),topright:b.add(c)}};var h=a.Vector=function(a,b){this.x=a,this.y=b};h.random=function(){return new h(10*(Math.random()-.5),10*(Math.random()-.5))},h.prototype.add=function(a){return new h(this.x+a.x,this.y+a.y)},h.prototype.subtract=function(a){return new h(this.x-a.x,this.y-a.y)},h.prototype.multiply=function(a){return new h(this.x*a,this.y*a)},h.prototype.divide=function(a){return new h(this.x/a||0,this.y/a||0)},h.prototype.magnitude=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},h.prototype.normal=function(){return new h((-this.y),this.x)},h.prototype.normalise=function(){return this.divide(this.magnitude())},f.ForceDirected.Point=function(a,b){this.p=a,this.m=b,this.v=new h(0,0),this.a=new h(0,0)},f.ForceDirected.Point.prototype.applyForce=function(a){this.a=this.a.add(a.divide(this.m))},f.ForceDirected.Spring=function(a,b,c,d){this.point1=a,this.point2=b,this.length=c,this.k=d};var i=a.Renderer=function(a,b,c,d){this.layout=a,this.clear=b,this.drawEdge=c,this.drawNode=d,this.layout.graph.addGraphListener(this)};i.prototype.graphChanged=function(a){this.start()},i.prototype.start=function(){var a=this;this.layout.start(function(){a.clear(),a.layout.eachEdge(function(b,c){a.drawEdge(b,c.point1.p,c.point2.p)}),a.layout.eachNode(function(b,c){a.drawNode(b,c.p)})})},i.prototype.stop=function(){this.layout.stop()},Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("[object Function]"!={}.toString.call(a))throw new TypeError(a+" is not a function");for(b&&(c=b),d=0;d1||g<0||g>1)&&new Springy.Vector(a.x+f*(b.x-a.x),a.y+f*(b.y-a.y))}function c(a,c,d,e,f){var g,h={x:d.x,y:d.y},i={x:d.x+e,y:d.y},j={x:d.x,y:d.y+f},k={x:d.x+e,y:d.y+f};return(g=b(a,c,h,i))?g:(g=b(a,c,i,k))?g:(g=b(a,c,k,j))?g:!!(g=b(a,c,j,h))&&g}var d=this.graph=a.graph||new Springy.Graph,e=a.stiffness||100,f=a.repulsion||5e3,g=a.damping||.5,h=a.nodeSelected||null,i=this[0],j=i.getContext("2d"),k=this.layout=new Springy.Layout.ForceDirected(d,e,f,g),l=k.getBoundingBox(),m={bottomleft:new Springy.Vector((-2),(-2)),topright:new Springy.Vector(2,2)};Springy.requestAnimationFrame(function a(){m=k.getBoundingBox(),l={bottomleft:l.bottomleft.add(m.bottomleft.subtract(l.bottomleft).divide(10)),topright:l.topright.add(m.topright.subtract(l.topright).divide(10))},Springy.requestAnimationFrame(a)});var n=function(a){var b=l.topright.subtract(l.bottomleft),c=a.subtract(l.bottomleft).divide(b.x).x*i.width,d=a.subtract(l.bottomleft).divide(b.y).y*i.height;return new Springy.Vector(c,d)},o=function(a){var b=l.topright.subtract(l.bottomleft),c=a.x/i.width*b.x+l.bottomleft.x,d=a.y/i.height*b.y+l.bottomleft.y;return new Springy.Vector(c,d)},p=null,q=null,r=null;jQuery(i).mousedown(function(a){var b=jQuery(this).offset(),c=o({x:a.pageX-b.left,y:a.pageY-b.top});p=q=r=k.nearest(c),null!==p.node&&(r.point.m=1e4,h&&h(p.node)),s.start()}),jQuery(i).dblclick(function(a){var b=jQuery(this).offset(),c=o({x:a.pageX-b.left,y:a.pageY-b.top});p=k.nearest(c),node=p.node,node&&node.data&&node.data.ondoubleclick&&node.data.ondoubleclick()}),jQuery(i).mousemove(function(a){var b=jQuery(this).offset(),c=o({x:a.pageX-b.left,y:a.pageY-b.top});q=k.nearest(c),null!==r&&null!==r.node&&(r.point.p.x=c.x,r.point.p.y=c.y),s.start()}),jQuery(window).bind("mouseup",function(a){r=null}),Springy.Node.prototype.getWidth=function(){var a=void 0!==this.data.label?this.data.label:this.id;if(this._width&&this._width[a])return this._width[a];j.save(),j.font="16px Verdana, sans-serif";var b=j.measureText(a).width+10;return j.restore(),this._width||(this._width={}),this._width[a]=b,b},Springy.Node.prototype.getHeight=function(){return 20};var s=this.renderer=new Springy.Renderer(k,function(){var a=i.parentNode;null!==a&&(i.height=a.clientHeight,i.width=a.clientWidth),j.clearRect(0,0,i.width,i.height)},function(a,b,e){for(var f=n(b).x,g=n(b).y,h=n(e).x,i=n(e).y,k=new Springy.Vector(h-f,i-g),l=k.normal().normalise(),m=d.getEdges(a.source,a.target),o=d.getEdges(a.target,a.source),p=m.length+o.length,q=0,r=0;r'),h=$("").springy({graph:f,nodeSelected:function(a){}});g.append(h);var i=$('
      ');g.append(i);var j=$(''),k=j.get(0),l=$(''),m=l.get(0);i.append(j),i.append($("").append(l)),j.on("input",e),l.on("change",e),g.on("mouseenter",e),g.dialog({appendTo:"#jseden-views",title:d,width:600,height:450,minHeight:120,minWidth:230,dialogClass:"dependency-map-dialog"})},this.updateGraph=function(a,b){a.re=b,a.newNodes=[],a.newEdges=[];for(var c in root.symbols){var d=root.symbols[c],e=d.name;if(b.test(e)){a.newNodes.indexOf(e)==-1&&a.newNodes.push(e);var f=d.dependencies;for(var g in f){var h=f[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([h,e,!1])}f=d.dynamicDependencies;for(var g in f){var h=f[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([h,e,!0])}f=d.observees;for(var g in f){var h=f[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([h,e,!1])}var i=d.subscribers;for(var g in i){var j=i[g],h=j.name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h);var k=d.name in j.dynamicDependencies;a.newEdges.push([e,h,k])}i=d.observers;for(var g in i){var h=i[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([e,h,!1])}}}if(!arrayCompare(a.previousNodes,a.newNodes)||!arrayCompare(a.previousEdges,a.newEdges)){a.previousNodes=a.newNodes,a.previousEdges=a.newEdges,a.filterEdges(function(a){return!1}),a.filterNodes(function(a){return!1}),a.nodeObjectsStore={};for(var c in a.previousNodes){var l=a.previousNodes[c];a.nodeObjectsStore[l]=a.newNode({label:l},{color:"#6A4A3C"})}for(var g in a.previousEdges){var m=a.previousEdges[g][0],n=a.previousEdges[g][1],o={};a.previousEdges[g][2]&&(o.dashes=[10,10]),a.newEdge(a.nodeObjectsStore[m],a.nodeObjectsStore[n],o)}}},a.views.DependencyMap={dialog:this.createDialog,title:"Dependency Map",category:a.viewCategories.comprehension,menuPriority:2},b()},EdenUI.plugins.DependencyMap.title="Dependency Map",EdenUI.plugins.DependencyMap.description="Displays a diagram showing the relationships between observables.",EdenUI.plugins.DependencyMap.author="Joe Butler",EdenUI.plugins.StateTimeLine=function(a,b){var c=this;this.createDialog=function(b,e){c.ignoreRE=new RegExp("((_view.*)|(_View.*)|(_status)|(mouse.*)|(picture))"),code_entry=$('
      ').append($('')).append($('').click(function(){c.ST.states.push(d("partial"));var e=document.getElementById(b+"-regex").value;""==e&&(e="State "+c.ST.nextBlankState),$("#"+b+"-content-states").append("
      "+e+": Restore "+(new Date).toLocaleTimeString()+" Delete
      "),document.getElementById(b+"-regex").value="",a.plugins.StateTimeLine.ST.nextBlankState++})).append($('
      ')),$dialog=$('
      ').html(code_entry).dialog({title:e,width:300,height:450,minHeight:120,minWidth:230})},c.ST={},c.ST.states=[],c.ST.nextBlankState=0,this.deleteState=function(a){$(document.getElementById("stdiv"+a)).remove()},this.changeState=function(b){for(var c in root.symbols)Eden.isitSystemSymbol(root.symbols[c].name.substring(1,root.symbols[c].name.length))||a.plugins.StateTimeLine.ignoreRE.test(root.symbols[c].name.substring(1,root.symbols[c].name.length))||delete root.symbols[c];a.plugins.ScriptInput.submitEdenCode(a.plugins.StateTimeLine.ST.states[b])};var d=function(b){var c=[],d=[],e=[],f=[],g="autocalc = 1;",h="autocalc = 0;",i=root.lookup("picture").eden_definition;void 0==i?i="picture is [];":i+=";";for(var j in root.symbols){var k="@",l="",m=5,n=root.symbols[j],o=n.eden_definition;if(void 0==o&&(o=k),0==o.indexOf("proc")){if(l="(Action)",m=2,"partial"==b&&Eden.isitSystemAgent(j))continue}else if(0==o.indexOf("func")){if(l="(Function)",m=1,"partial"==b&&Eden.isitSystemFunction(j))continue}else if(l="(Observable)",m=0,"partial"==b&&Eden.isitSystemObservable(j))continue;var p=Eden.edenCodeForValue(n.cached_value);if(!a.plugins.StateTimeLine.ignoreRE.test(j))if(1==m)f.push(o);else if(0==m){if(p==k&&o==k)continue;o==k?d.push(j+" = "+p+";"):c.push(o+";")}else 2==m?e.push(o):console.log("oh dear error")}var q=[];q.push(h);for(var r=0;r

      ';return $dialog=$('
      ').html(e).dialog({title:c,width:300,height:450,minHeight:120,minWidth:230}),$("#connectBtn").click(function(){function b(b){var c=a.eden.root,d=c.lookup("definitionOf").definition(c)(b);e.send(d)}if(window.WebSocket=window.WebSocket||window.MozWebSocket,!window.WebSocket)return void console.log("WebSockets not supported");var c="ws://"+$("#sl-ipaddr").val()+":"+$("#sl-port").val()+"/",e=new WebSocket(c);eden.listenTo("executeBegin",this,function(a,b){"net"!=a&&e.send(b)}),eden.listenTo("beforeAssign",this,function(a,b,c){"net"!=c&&e.send(a.name.slice(1)+"="+Eden.edenCodeForValue(b)+";")}),$("#sl-status").html("

      Connected to: "+c+"

      "),e.onerror=function(a){$("#sl-status").html("

      Error connecting to server - please verify server is running at "+c+". For usage instructions please read the comments in the state-listener-server.js file.

      "), -d.confirmClose=!1},e.onmessage=function(a){$("#sl-status").html("

      Received: "+Eden.htmlEscape(a.data)+"

      "),eden.execute(a.data,"net","",{name:"/execute"},noop)},e.onopen=function(){d.confirmClose=!0,randomSeedSym=a.eden.root.lookup("randomSeed"),randomSeed=randomSeedSym.value(),void 0===randomSeed?randomSeedSym.assign((new Date).getTime(),eden.root.scope,void 0,!0):b("randomSeed"),b("randomGenerator")}}),d},a.views.StateListener={dialog:this.createDialog,title:"State Listener",category:a.viewCategories.extension},a.eden.include("plugins/state-listener/state-listener.js-e",b)},EdenUI.plugins.StateListener.title="State Listener",EdenUI.plugins.StateListener.description="Provides the ability to synchronize observables over the internet.",EdenUI.plugins.StateListener.author="Jonny Foss",EdenUI.plugins.NetworkRemote=function(a,b){function c(){h=!1,$("#connectBtn").attr("value","Connect"),$("#nr-ipaddr").removeAttr("disabled"),$("#nr-port").removeAttr("disabled"),$("#nr-key").removeAttr("disabled")}function d(){eden.root.lookup("network_address").assign($("#nr-ipaddr").val(),eden.root.scope),eden.root.lookup("network_port").assign($("#nr-port").val(),eden.root.scope),eden.root.lookup("network_key").assign($("#nr-key").val(),eden.root.scope),f.connect()}var e,f=this,g=!1,h=!1;Eden.Agent.importAgent("lib/dynamic","default",void 0,function(){}),f.connect=function(){function b(b){var c=a.eden.root,d=c.lookup("definitionOf").definition(c)(b);j.send(JSON.stringify({code:d}))}var c=eden.root.lookup("network_address").value(),d=eden.root.lookup("network_port").value(),g=eden.root.lookup("network_key").value();if(window.WebSocket=window.WebSocket||window.MozWebSocket,!window.WebSocket)return void console.log("WebSockets not supported");var i="ws://"+c+":"+d+"/",j=new WebSocket(i);Eden.Agent.listenTo("executeline",this,function(a,b){if(a){var c=JSON.stringify({action:"executeline",name:a.name,lineno:b});j.send(c)}}),Eden.Agent.listenTo("patch",this,function(a,b,c){if(a){var d=JSON.stringify({action:"patch",name:a.name,patch:b,lineno:c});j.send(d)}}),Eden.Agent.listenTo("owned",this,function(a,b){"net"!=b&&j.send(JSON.stringify({action:"ownership",name:a.name,owned:a.owned}))}),eden.listenTo("beforeAssign",this,function(a,b,c){"net"!=c&&(console.log("ASSIGN: "+a.name+" = "+Eden.edenCodeForValue(b)),j.send(JSON.stringify({action:"assign",symbol:a.name.slice(1),value:b})))}),$("#nr-status").html("

      Connected to: "+i+"

      "),j.onopen=function(c){j.send(g),randomSeedSym=a.eden.root.lookup("randomSeed"),randomSeed=randomSeedSym.value(),void 0===randomSeed?randomSeedSym.assign((new Date).getTime(),eden.root.scope,void 0,!0):b("randomSeed"),b("randomGenerator"),h=!0;for(var d in Eden.Agent.agents)Eden.Agent.agents[d].owned&&j.send(JSON.stringify({action:"ownership",name:d,owned:!0}));eden.root.lookup("network_connected").assign(!0,eden.root.scope)},j.onerror=function(a){h=!1,eden.root.lookup("network_connected").assign(!1,eden.root.scope),eden.root.lookup("network_error").assign(a,eden.root.scope)},j.onclose=function(){eden.root.lookup("network_connected").assign(!1,eden.root.scope)},f.sendControl=function(a,b){console.log("Send Control: "+a+"= "+b),console.log(b),j.send(JSON.stringify({action:"control",key:a,value:b}))},f.sendAssign=function(a){"net"!=a.last_modified_by&&j.send(JSON.stringify({action:"assign",symbol:a.name.slice(1),value:a.value()}))},j.onmessage=function(a){e=JSON.parse(a.data);for(var b=0;b

      ';return $dialog=$('
      ').html(f).dialog({title:b,width:300,height:450,minHeight:120,minWidth:230}),$("#connectBtn").click(function(){h?c():d()}),e},this.playCode=function(a){if(void 0===e[a])return void $("#nr-status").html("

      Replay finished

      ");var b=e[a].time/$("#nr-speedrange").val();b>1e3?($("#nr-status").html("

      Next line in "+b+" milliseconds

      "),g=!0):g&&$("#nr-status").html("

      Replaying...

      "),setTimeout(function(){eden.execute(e[a].code,"net","",{name:"/execute"},noop),f.playCode(a+1)},b)},a.views.NetworkRemote={dialog:this.createDialog,title:"Network Remote",category:a.viewCategories.extension},a.eden.include("plugins/network-remote/network-remote.js-e",b),eden.root.lookup("plugins_network_loaded").assign(!0,eden.root.scope)},EdenUI.plugins.NetworkRemote.title="Network Remote",EdenUI.plugins.NetworkRemote.description="Method of syncronizing observables via TCP, and playing back scripts",EdenUI.plugins.NetworkRemote.author="Jonny Foss",EdenUI.plugins.WindowLayoutTool=function(a,b){var c="";$.getScript("plugins/view-layout/gridster/jquery.gridster.min.js");var d=$("");$("head").append(d);var d=$("");$("head").append(d),this.name="window_name",this.createDialog=function(b,d){""==c&&(c=b);var e=[];viewlayoutstr="View Layout";var f=5*a.gridSizeY,g=3*a.gridSizeX,h=[],i=root.lookup("_views_list").value(),j=this.name;i.forEach(function(b){if(b!=j){var c=root.lookup("_view_"+b+"_x").value(),d=root.lookup("_view_"+b+"_y").value();c="undefined"!=typeof c?c:0,d="undefined"!=typeof d?d:0,h=[b,c,d,root.lookup("_view_"+b+"_width").value()+a.scrollBarSize,root.lookup("_view_"+b+"_height").value()+a.titleBarHeight,root.lookup("_view_"+b+"_title").value()],console.log(h),e.push(h)}});var k="";e.forEach(function(a,b){k+='
    1. '+a[5]+" ["+a[0]+"]
    2. "});var l='Update
        '+k+"
      ";$dialog=$('
      ').html(l).dialog({title:d,width:$(window).width()/2,height:$(window).height()/2,minHeight:120,minWidth:230}),gridster=$(".gridster ul").gridster({widget_base_dimensions:[g,f],widget_margins:[0,0],min_cols:Math.round($(window).width()/g),max_cols:Math.round($(window).width()/g),helper:"clone",resize:{enabled:!0},serialize_params:function(a,b){return{col:b.col,row:b.row,size_x:b.size_x,size_y:b.size_y,name:b.name,name:$(b.el.context).attr("data-name")}}}).data("gridster"),$(".vl-update").click(function(){var b=gridster.serialize(),c=1,d=1;b.forEach(function(a,b){a.col "+this.actions},d.prototype.toString=function(){return this.name+"("+this.parameters.join(",")+")\nDefinitions:\n"+this.definitions+"\nActions:\n"+this.actionsArr};var g=function(a,b){for(var d=new Array,e=0;e");if(2==g.length){var h="this_g"+d.length;d.push(new c(h,g[0],g[1]))}}return d},h=function(a){var b,c=new Array;a.split("(").length<2?b=a:(c=a.split("(")[1].split(")")[0].split(","),b=a.split("(")[0]);var d=document.getElementById("adm-definitions"),e=[];d.value.length>0&&(e=d.value.split("\n"));var d=document.getElementById("adm-actions"),f=d.value.split("\n"),h=g(b,f);return F(b,c,e,h),0},i=function(){for(var a=document.getElementById("adm-name"),b=a.value.split("(")[0],c=!0,d=0;d=f.templates.length&&(a=-1),a==-1)document.getElementById("adm-name").value="",document.getElementById("adm-definitions").value="",document.getElementById("adm-actions").value="";else{var b=f.templates[a];document.getElementById("adm-name").value=b.name,document.getElementById("adm-definitions").value=b.definitions.join("\n"),document.getElementById("adm-actions").value=b.actionsArr.join("\n")}f.currIndex=a},k=function(a){a>-1&&(alert("Deleting template "+f.templates[a].name),f.templates.splice(a),f.currIndex=a-1,j(f.currIndex))},l=function(a){return'
      \t\t\t
      Name:
      \t\t\t
      \t\t\t
      Definitions:
      \t\t\t
      \t\t\t
      Actions:
      \t\t\t
      \t\t
      \t\t
      \t\t\t
      \t\t
      '};this.createTemplateCreator=function(a,b){var c=$("
      ");c.html(l(a)),$dialog=$('
      ').html(c).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-add",text:"Add Template",click:function(){i()}},{id:"btn-delete",text:"Delete Template",click:function(){k(f.currIndex)}},{text:"Previous",click:function(){j(f.currIndex-1)}},{text:"Next",click:function(){j(f.currIndex+1)}}]}),input_dialog=$dialog,$("#btn-submit").css("margin-right","30px")};var m=function(a,b){var c=new Array;for(x in b){var d=b[x];c.push(d.replace(/this/g,a))}return c},n=function(a,b){var d=new Array;for(x in b){var e=b[x],f=e.guard.replace(/this/g,a),g=e.actions.replace(/this/g,a),h=e.edenVar.replace(/this/g,a);d.push(new c(h,f,g))}return d},o=function(a,b){a.value="";for(x in b)b[x].value=""},p=function(a){var b;for(x in f.templates)if(f.templates[x].name==a){b=f.templates[x];break}return b},q=function(){for(var a=document.getElementById("template-menu"),b=a.options[a.selectedIndex].value,c=p(b),d=document.getElementById("entity-name"),e=d.value,g=!0,h=0;h");c=$('
      \t\t\t\t\t
      Templates:
      \t\t\t\t\t
      \t\t\t\t\t\t\t\t\t\t\t
      \t\t\t\t\t
      Entity name:
      \t\t\t\t\t
      \t\t\t\t\t\t\t\t\t\t\t
      \t\t\t\t\t
      Parameters:
      \t\t\t\t\t
      \t\t\t\t
      '),$dialog=$('
      ').html(c).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-instantiate",text:"Instantiate",click:function(){q()}}]}),f.templateList=new EdenUI.plugins.ADM.TemplateList;for(x in f.templates){var d=f.templates[x];f.templateList.addTemplate(d.name,d.parameters)}};var s=function(a){var b,c;for(x in f.entities)if(f.entities[x].name==a){b=f.entities[x],c=x;break}if(null==b)return void alert(a+" doesn't exist to delete.");f.entities.splice(c,1);for(x in f.actionLists)if(f.actionLists[x].entityName==a){c=x,f.actionLists[x].remove();break}null!=f.actionLists&&f.actionLists.splice(c,1),null!=f.entityList&&f.entityList.removeEntity(a)},t=function(a,b,c){var d=p(a);if(null==d)return alert("no template with name "+a),-1;for(x in f.entities)if(f.entities[x].name==c)return alert("Please enter a unique entity name"),-1;if(""==b)var e=[];else if(b.indexOf(",")==-1)var e=[b];else var e=b.split(",");if(e.length!=d.parameters.length)return alert("not enough parameters to instantiate "+d),-1;for(x in e){var g=D(d.parameters[x]),h=D(e[x]);eden.executeEden(c+"_"+g+" is "+h+";")}var i=m(c,d.definitions),j=r(c,i);return j!=-1&&u(c,i,d.actionsArr),j},u=function(a,b,c){var d=n(a,c),g=new e(a,b,d);f.entities.push(g);for(x in d){var h=d[x],i=h.edenVar+" is "+h.guard+";";eden.executeEden(i)}if(null!=f.actionLists){var j=new EdenUI.plugins.ADM.ActionsList(a);f.actionLists.push(j),w(g,j)}null!=f.entityList&&f.entityList.addEntity(a,b,d)},v=function(){for(x in f.selectedActions){var b=f.selectedActions[x];if(b=D(b),945==b.charCodeAt(0))if("r"==b[2]){var c=b.split("(")[1];c=c.substring(0,c.length-1),s(c)}else if("i"==b[2]){var d=b.split("(")[1],e=b.split("(")[2].split(")")[0],c=b.split("as")[1],g=t(d,e,c);if(g==-1)break}else alert("Action on another entity must one of α_remove(entity_name), α_r, α_instantiate(template(param_value) as entity_name) or α_i");else eden.executeEden(b+";")}f.selectedActions=new Array,a.plugins.ADM.refreshHumanPerspective()};this.actionPush=function(a){f.selectedActions.push(a)},this.actionRemove=function(a){var b=new Array;for(x in f.selectedActions){var c=f.selectedActions[x];c!=a&&b.push(c)}f.selectedActions=b},this.refreshHumanPerspective=function(){for(x in f.entities){var a,b=f.entities[x];for(y in f.actionLists){var c=f.actionLists[y];if(c.entityName==b.name){a=c;break}}a.clear();var d=[];for(x in b.queuedActions){var e=b.queuedActions[x].split(";"),g=e[0];if(g.length>0){e.splice(0,1);var h=!0;e[0].length>0&&(d.push(e.join(";")),h=!1),a.addAction(g,h)}}b.queuedActions=d,w(b,a)}};var w=function(a,b){for(var c=0;c0&&(a.queuedActions.push(f.join(";")),h=!1),b.addAction(g,h)}}};this.createHumanPerspective=function(b,c){var d=$("
      ");d=$('
      '),$dialog=$('
      ').html(d).dialog({title:c,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-refresh",text:"Refresh actions",click:function(){a.plugins.ADM.refreshHumanPerspective()}},{id:"btn-step",text:"Step",click:function(){v()}}]}),f.actionLists=new Array;for(x in f.entities){var b=f.entities[x].name;f.actionLists.push(new EdenUI.plugins.ADM.ActionsList(b))}a.plugins.ADM.refreshHumanPerspective()};var z=function(){for(x in f.selectedEntities)s(f.selectedEntities[x]);alert("Entities successfully deleted."),f.selectedEntities=new Array};this.entityPush=function(a){f.selectedEntities.push(a)},this.entityRemove=function(a){var b=new Array;for(x in f.selectedEntities){var c=f.selectedEntities[x];c!=a&&b.push(c)}f.selectedEntities=b};var A=function(){return'
      '};this.createInstanceList=function(a,b){var c=$("
      ");c.html(A()),$dialog=$('
      ').html(c).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-delete-entity",text:"Delete selected",click:function(){z()}}]}),f.entityList=new EdenUI.plugins.ADM.EntityList;for(x in f.entities){var d=f.entities[x];f.entityList.addEntity(d.name,d.definitions.join("\n"),d.actionsArr.join("\n"))}};var B=function(a){var b=a.split(":")[1];return D(b.split("(")[0])},C=function(a){var b=a.split(":")[1].split("(")[1];return b.length>1?b.split(")")[0].split(","):[]},D=function(a){for(;32==a.charCodeAt(0)||9==a.charCodeAt(0);)a=a.substring(1,a.length);for(;32==a.charCodeAt(a.length-1)||9==a.charCodeAt(a.length-1);)a=E(a);return a},E=function(a){return a.substring(0,a.length-1)},F=function(a,b,c,e){for(x in f.templates)if(f.templates[x].name==a)return alert("Templates must have unique names."),-1;var h=g(a,e),i=new d(a,b,c,h);return f.templates.push(i),null!=f.templateList&&f.templateList.addTemplate(a,b),1},G=function(a){var b,c=a.split("\n"),d=new Array,e=new Array,f=new Array,g=!1,h=!1,i=!1;for(x in c){var j=c[x];if(j=D(j),""!=j)if(0==i)if("{"==j[0])i=!0,j.indexOf("name:")!=-1&&(b=B(j),d=C(j));else{var k=j.split("(")[0],l=j.split("(")[1].split(")")[0],m=E(D(j.split("as")[1])),n=t(k,l,m);if(n==-1)break}else if(1==g){var o=j.indexOf("}");o!=-1&&(j=E(j),g=!1),j.length>0&&e.push(j)}else if(1==h){var o=j.indexOf("}");o!=-1&&(j=E(j),h=!1),j.length>0&&f.push(j)}else if("}"==j[0]){i=!1;var n=F(b,d,e,f);if(b="",d=new Array,e=new Array,f=new Array,n==-1)return}else if(j.indexOf("name:")!=-1)b=B(j),d=C(j);else if(j.indexOf("definitions:")!=-1||j.indexOf("defs:")!=-1){if(g=!0,j=D(j),j.split("{").length>1){var p=D(j.split("{")[1]);p.indexOf("}")!=-1&&(p=E(p),g=!1),p.length>0&&e.push(p)}}else if(j.indexOf("actions:")!=-1&&(h=!0,j=D(j),j.split("{").length>1)){var p=D(j.split("{")[1]),o=p.indexOf("}");o!=-1&&(p=E(p),h=!1),p.length>0&&f.push(p)}}};this.createAdvancedInput=function(a,b){var c=document.createElement("textarea");c.style.boxSizing="border-box",c.style.width="100%",c.style.height="100%",$code_entry=$('
      '),$code_entry.append(c),$dialog=$('
      ').html($code_entry).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-submit-advanced",text:"Submit",click:function(){var a=c.value;G(a),c.value=""}}]}),input_dialog=$dialog,$("#btn-submit-advanced").css("margin-right","30px")},a.addViewCategory("adm","Abstract Definitive Machine"),a.views.AdmTemplateCreator={dialog:this.createTemplateCreator,title:"ADM Template Creator",category:a.viewCategories.adm},a.views.AdmInstantiator={dialog:this.createInstantiator,title:"ADM Template Instantiator",category:a.viewCategories.adm},a.views.AdmHumanPerspective={dialog:this.createHumanPerspective,title:"ADM Human Perspective",category:a.viewCategories.adm},a.views.AdmEntityList={dialog:this.createInstanceList,title:"ADM Entity List",category:a.viewCategories.adm},a.views.AdmAdvancedInput={dialog:this.createAdvancedInput,title:"ADM Advanced Input",category:a.viewCategories.adm},b()},EdenUI.plugins.ADM.TemplateList=function(){this.templateList=document.getElementById("template-menu"),this.templateList.style.minWidth="100px",this.templates=new Array},EdenUI.plugins.ADM.TemplateList.prototype.addTemplate=function(a,b){var c=new EdenUI.plugins.ADM.Template(a,b);c.element.appendTo(this.templateList),this.templates.push(c)},EdenUI.plugins.ADM.Template=function(a,b){this.template=a,this.element=$("");var c=this.showParamInput;this.element.click(function(){c(b)});var d=document.getElementById("instantiate-params");""==d.innerHTML&&c(b)},EdenUI.plugins.ADM.Template.prototype.showParamInput=function(a){var b=document.getElementById("instantiate-params");b.innerHTML="";for(x in a){var c=a[x],d=document.createElement("label");d.innerHTML=c+":",b.appendChild(d);var e=document.createElement("input");e.type="text",b.appendChild(e);var f=document.createElement("br");b.appendChild(f)}},EdenUI.plugins.ADM.ActionsList=function(a){var b=document.getElementById("human-perspective");this.actionresults=document.createElement("div"),this.actionresults.setAttribute("id","actions_"+a),this.actionresults.innerHTML="",b.appendChild(this.actionresults),this.actions=new Array,this.entityName=a},EdenUI.plugins.ADM.ActionsList.prototype.addAction=function(a,b){var c=new EdenUI.plugins.ADM.Action(a,b);c.element.appendTo(this.actionresults),this.actions.push(c)},EdenUI.plugins.ADM.ActionsList.prototype.clear=function(){this.actions=new Array,this.actionresults.innerHTML=""},EdenUI.plugins.ADM.ActionsList.prototype.remove=function(){var a=document.getElementById("human-perspective");a.removeChild(document.getElementById("actions_"+this.entityName))},EdenUI.plugins.ADM.Action=function(a,b){var a=a;this.action=a,this.element=$('
      '),this.update=this.updateAction;var c=!1;this.element.hover(function(){0==c?$(this).animate({backgroundColor:"#eaeaea"},100):$(this).animate({backgroundColor:"#66CCCC"},100)},function(){0==c?$(this).animate({backgroundColor:"white"},100):$(this).animate({backgroundColor:"#6666CC"},100)}).click(function(){0==c?(edenUI.plugins.ADM.actionPush(a),$(this).css("backgroundColor","#6666CC"),c=!0):(edenUI.plugins.ADM.actionRemove(a),$(this).css("backgroundColor","white"),c=!1)}),this.update(b)},EdenUI.plugins.ADM.Action.prototype.updateAction=function(a){var b='
    3. ';b=1==a?b+this.action+"
    4. ":b+this.action+" ... ",this.element.html(b)},EdenUI.plugins.ADM.EntityList=function(){this.entityList=document.getElementById("entity-list"),this.entities=new Array},EdenUI.plugins.ADM.EntityList.prototype.addEntity=function(a,b,c){var d=new EdenUI.plugins.ADM.Entity(a,b,c);d.element.appendTo(this.entityList),this.entities.push(d)},EdenUI.plugins.ADM.EntityList.prototype.removeEntity=function(a){var b;for(x in this.entities)if(this.entities[x].entity==a){b=x;break}this.entities.splice(b,1);var c=document.getElementById("element-"+a);this.entityList.removeChild(c)},EdenUI.plugins.ADM.EntityList.prototype.unselectAll=function(){for(x in this.entities)this.entities[x].unselect()},EdenUI.plugins.ADM.Entity=function(a,b,c){this.entity=a,this.element=$('
      ");var d='
    5. '+this.entity+"
    6. ";this.element.html(d);var b=b,c=c,e=!1;this.element.hover(function(){0==e?$(this).animate({backgroundColor:"#eaeaea"},100):$(this).animate({backgroundColor:"#66CCCC"},100)},function(){0==e?$(this).animate({backgroundColor:"white"},100):$(this).animate({backgroundColor:"#6666CC"},100)}).click(function(){if(this.innerHTML==d){var f=document.createElement("div");f.innerHTML="
      \t\t\t\t\t
      \t\t\t\t\t
      \t\t\t\t\t
      ",this.appendChild(f),edenUI.plugins.ADM.entityPush(a),$(this).css("backgroundColor","#6666CC"),e=!0}else this.innerHTML=d,edenUI.plugins.ADM.entityRemove(a),$(this).css("backgroundColor","white"),e=!1})},EdenUI.plugins.ADM.Entity.prototype.unselect=function(){var a='
    7. '+this.entity+"
    8. ";this.element.html(a)},EdenUI.plugins.ADM.title="Abstract Definitive Machine",EdenUI.plugins.ADM.description="Abstract Definitive Machine",EdenUI.plugins.ADM.author="Ruth King",EdenUI.plugins.DBView=function(a,b){this.createDialog=function(a,b){function c(){0==Array.isArray(j)&&(j=[["Value"],[[j]]]);for(var a=f.get(0);a.firstChild;)a.removeChild(a.firstChild);if(g=j[0],h=j[1],Array.isArray(g)||(h=j,g=[["List"]]),Array.isArray(h)){for(var b=$(""),c=0;c");d.html(g[c]),d.appendTo(b)}b.appendTo(f);for(var e=0;e"),c=0;c'):$(""),k.appendTo(i);var l=Array.isArray(h[e])?h[e][c]:h[e];k.html("
      "+Eden.edenCodeForValue(l)+"
      ")}i.appendTo(f)}}}function d(){f.find(".dbview-dependant").removeClass("dbview-dependant"),f.find(".dbview-dependency").removeClass("dbview-dependency")}var e=$('
      Query:
      '),f=$('
      ');f.appendTo(e);var g,h,i=e.find(".dbview-select-text").get(0),j=void 0,k=a.slice(0,-7),l=new Eden.Agent((void 0),"view/db/"+k+"/config"),m="_view_"+k+"_source";return l.declare(m),f.on("input","td",function(a){var b=a.target.cellIndex,c=a.target.parentNode.rowIndex-1;if(!(b<0||c<0)){a.target.textContent}}).on("mouseenter","td",function(a){a.target.cellIndex,a.target.parentNode.rowIndex-1}).on("mouseleave","td",function(a){d()}),e.on("input",".dbview-select-text",function(a){l.setSource("_view_"+k+"_source is "+i.value),l.execute(!0,!0)}),j=l.state[m],c(),l.on(m,function(a,b){j=b,c()}),$('
      ').html(e).dialog({title:b,width:600,height:450,minHeight:120,minWidth:230,dialogClass:"dbview-dialog"}),{confirmClose:!0}},a.views.DBView={dialog:this.createDialog,title:"Database Viewer",category:a.viewCategories.visualization},b()},EdenUI.plugins.DBView.title="DBView",EdenUI.plugins.DBView.description="Display a table showing entire database contents.",EdenUI.plugins.SpeechSynthesis=function(a,b){function c(){var a=window.speechSynthesis.paused;window.speechSynthesis.cancel(),a&&window.speechSynthesis.pause()}function d(a,b){if(f)return void(f=!1);var e,g=root.lookup("speak"),h=root.lookup("speakingList"),i=root.lookup("speakingIndex"),j=root.lookup("speaking"),k=root.lookup("speakingID"),l=root.lookup("speakingText"),m=root.lookup("speakingSpeech"),n=root.lookup("speakingCharIndex"),o=h.value(),p=i.value();if(c(),p||(p=1),""!=a){if("finished"==a){var q=l.value();"string"==typeof q&&n.assign(q.length+1,g)}else"interrupted"==a&&(f=!0);e=k.value(),eden.isValidIdentifier(e)&&root.lookup(e+"_status").assign(a,g)}if(b&&p++,n.assign(1,g),root.lookup("speakingTime").assign(0,g),Array.isArray(o)&&p<=o.length){j.value()||j.assign(!0,g);var r=o[p-1];if(!(r instanceof SpeakingWords)||r.cancelled)return void d("",!0);r.prepareUtterance();var s=r.utterance;e=r.id,k.assign(e,g),eden.isValidIdentifier(e)&&root.lookup(e+"_status").assign("speaking",g),l.assign(s.text,g),m.assign(r,g),b&&i.assign(p,g),r.hasBeenSpoken=!0,window.speechSynthesis.speak(s)}else j.assign(!1,g),k.assign("",g),l.assign("",g),m.assign(void 0,g),Array.isArray(o)&&i.assign(o.length+1,g)}function e(a,b){var c,d,e,f,g=window.speechSynthesis.getVoices();a&&(a=a.toLowerCase(),d=a.indexOf("-"),d!=-1?(e=a.slice(0,d),f=!0):(e=a,f=!1)),b&&(c=new RegExp("\\b"+b+"\\b","i"));for(var h=void 0,i=!1,j=!1,k=!1,l=!1,m=0;mb.length+1)e.assign(b.length+1,c);else if(f<=b.length){for(var g=f<1?0:f-1;g=1&&e<=128&&c.send([192+d,e-1])}b.length>16&&eden.error(new Error("MIDI programs list is too long."))}}function d(a){if(void 0===a)return p;if(Number.isInteger(a)){if(a<1||h&&a>k.length)throw new Error("No MIDI output device exists with device number "+a);return a-1}if(h&&"string"==typeof a){for(var b=0;bl.length)throw new Error("No MIDI input device exists with device number "+a);return a-1}if(h&&"string"==typeof a){for(var b=0;bw&&(x=new Array(w)),x[0]=a,B=1,C=0;else{var b,c=a.timeStamp;for(b=B-1;b>=C&&!(x[b].timeStamp<=c);b--);b==B-1?x[B]=a:x.splice(b+1,0,a),B++}D.assign(B-C)}var g=this,h=!1;Object.defineProperty(this,"initialized",{get:function(){return h},enumerable:!0});var j=[];this.addSoftwareDriver=function(a){console.log("New JavaScript MIDI driver registered."),j.push(a),h&&a()};var k=[],l=[],m=root.lookup("midiNumberOfOutputs");m.assign(0);var n=root.lookup("midiNumberOfInputs");n.assign(0);var o={};this.addSoftSynth=function(a){if(k.push(a),m.assign(k.length),console.log('Added software synthesizer "'+a.name+'".'),h){var b=k.length-1,d=o[b];void 0!==d&&c(b,d.value())}},this.addSoftInput=function(a){l.push(a),n.assign(l.length),console.log('Added software input "'+a.name+'".')};var p=0,q=0;Object.defineProperty(this,"outputNames",{get:function(){for(var a=[],b=0;b=127?127:Math.round(a):void 0},this.isValidNote=function(a){return Number.isInteger(a)&&a>=-20&&a<=107},this.loadPrograms=function(a,b){a=d(a);var c=k[a];if(!Array.isArray(b))throw new Error("MIDI programs must be given as a list.");for(var e=b.length,f=new Array(e),g=0;g=1&&h<=128))throw new Error("Item "+g+" must be an integer between 1 and 128.");f[g]=h-1}c.loadPrograms&&c.loadPrograms(f)},this.bindPrograms=function(a,b){if(!(a instanceof Symbol))throw new Error("The first argument must be a Symbol.");b=d(b),Array.isArray(a.value())||void 0!==a.definition||a.assign([1]);var e=function(a,d){return Array.isArray(d)?void(h&&c(b,d)):void eden.error(new Error("Illegal MIDI programs list: "+Eden.edenCodeForValue(d)))};e(a,a.value()),a.addJSObserver("bind",e),o[b]=a},this.getInputs=function(){return l};var r=!1,s=[],t=[];this.initialize=function(a,b){function d(a){if(a0&&j.send([144+c,e+20,g.roundValue(f)]):(f>0?(void 0!==i&&j.send([144+c,i+20,0]),h&&j.send([144+c,e+20,g.roundValue(f)])):f<0?void 0!==i&&j.send([128+c,i+20,g.roundValue(-f)]):void 0!==i&&j.send([144+c,i+20,0]),u[a]=e):void 0!==i&&j.send([144+c,i+20,0])},this.alterVelocity=function(a,b,c,e,f){var h=u[a];if(e===h&&void 0!==e){var i=k[d(b)];f>0?i.send([160+c,e+20,g.roundValue(f)]):f<0?i.send([128+c,e+20,g.roundValue(-f)]):i.send([144+c,e+20,0])}};var v={};v.volume=7,this.bindControlChange=function(a,b,c,e){function f(a,b){var d=g.roundValue(b);void 0!==d&&i.send([176+c,h,d])}if(!(a instanceof Symbol))throw new Error("The first argument must be a Symbol.");var h,i=k[d(b)];if("string"==typeof e){if(h=v[e.toLowerCase()],void 0===h)throw new Error("Unknown control name "+e)}else{if(!(Number.isInteger(e)&&e>=0&&e<=127))throw new Error("The control must be specified either as a string or as an integer between 0 and 127 inclusive.");h=e}f(a,a.value()),a.addJSObserver("bind",f)};var w=16,x=new Array(w),y=root.lookup("midiInputDevice"),z=root.lookup("midiInputTimestamp"),A=root.lookup("midiInputMessage"),B=0,C=0,D=root.lookup("midiInputMessageCount");this.startInput=function(a){if(void 0===a)for(i=0;i=2*w&&C>.8*c-1&&(x.splice(0,C),B-=C,C=0);var d,e=b.target;e&&(d=e.name),root.beginAutocalcOff(),y.assign(d,a),z.assign(b.timeStamp,a),A.assign(b.data),D.assign(B-C),root.endAutocalcOff()}},this.clearInputMessages=function(){x.length>w&&(x=new Array(w)),B=0,C=0,D.assign(0)},Eden.Agent.importAgent("plugins/midi","default",[],b)},EdenUI.plugins.MIDI.title="MIDI",EdenUI.plugins.MIDI.description="Adds musical capabilities to JS-EDEN.",EdenUI.plugins.Debugger=function(a,b){this.createDialog=function(a,b){function c(a){var b="";return"when"==a.type&&a.base&&a.base.origin?(b+="## "+a.base.origin.name,a.line&&(b+=":"+(a.line+1)),b+="\n"):a.name&&(b+="## "+a.name+"\n"),a.getSource&&(b+=a.getSource()),b}var d=(a.slice(0,-7),!1),e=void 0,f=!1,g=500,h=$('
      '),i=$('
      ');h.append(i);var j=$('
      ');h.append(j);var k={},l=1,m=function(a){var b=a.agent,e=c(b);if(k[b.id]){var h=k[b.id].html;if(k[b.id].data=a,f=!1,h){var i=new Eden.AST(e,(void 0),b),j=new EdenUI.Highlight(h.get(0).childNodes[1]);if(j.highlight(i,-1,-1),a.statement){var l=a.statement.line-b.getLine(),m=h.get(0).childNodes[1].childNodes[l+1];m?m.className="eden-line debugger-line":console.error("Missing line: "+l)}}else console.error("Missing output")}d&&setTimeout(a.next,g)};Eden.AST.debugstep_cb=m;var n=function(a){var b=a.agent;void 0!==b.id&&(o(a),console.log("WHEN ALREADY LOGGED")),b.id=l,l++;var d=$('
      ');j.append(d),k[b.id]={html:d,data:a},void 0===e&&(e=k[b.id],d.get(0).className="debugger-agent active");var f=c(b),g=new Eden.AST(f,(void 0),b),h=new EdenUI.Highlight(d.get(0).childNodes[1]);h.highlight(g,-1,-1)};Eden.AST.debug_begin_cb=n;var o=function(a){var b=a.agent;if(void 0!==b.id&&void 0!==k[b.id]){e===k[b.id]&&(f=!1,e=void 0);var d=c(b),g=k[b.id].html,h=new Eden.AST(d,(void 0),b),i=new EdenUI.Highlight(g.get(0).childNodes[1]);i.highlight(h,-1,-1),k[b.id].html.remove(),delete k[b.id],b.id=void 0}};return Eden.AST.debug_end_cb=o,Eden.AST.debug=!0,Eden.AST.debugstep=!1,$('
      ').html(h).dialog({appendTo:"#jseden-views",title:b,width:590,height:500,minHeight:120,minWidth:230,dialogClass:"debugger-dialog"}),i.on("click",".play",function(a){d=!d,d?(a.currentTarget.innerHTML="",a.currentTarget.className="debugger-button play active"):(a.currentTarget.innerHTML="",a.currentTarget.className="debugger-button play")}).on("click",".stepforward",function(a){e&&e.data.next&&(e.data.next(),e&&(e.data.next=void 0))}).on("click",".debug",function(a){Eden.AST.debugstep=!Eden.AST.debugstep,Eden.AST.debugstep?a.currentTarget.className="debugger-button debug active":a.currentTarget.className="debugger-button debug"}).on("change",".debugger-speed",function(a){g=a.currentTarget.value,console.log("Change speed: "+g)}),j.on("click",".debugger-agent",function(a){e&&(e.html.get(0).className="debugger-agent"),e=k[a.currentTarget.getAttribute("data-agent")],e.html.get(0).className="debugger-agent active"}),{destroy:function(){Eden.AST.debug=!1}}},a.views.Debugger={dialog:this.createDialog,title:"Debugger",category:a.viewCategories.history},b()},EdenUI.plugins.Debugger.title="Debugger",EdenUI.plugins.Debugger.description="",EdenUI.plugins.Debugger.originalAuthor="Nicolas Pope",EdenUI.plugins.MIDIDotJS=function(a,b){function c(){a.plugins.MIDI.addSoftwareDriver(function(b,c){function f(e){e==i.length?(g=window.MIDI,g.loadPlugin({soundfontUrl:d,onsuccess:function(){a.plugins.MIDI.addSoftSynth(h),b&&b.apply(this,c)}})):$.ajax({url:"plugins/midi/emulation/lib/MIDI.js/"+i[e],success:function(){f(e+1)}})}var g,h={};h.name="MIDI.js",h.loadPrograms=function(a){for(var b=0;b0)window.setTimeout(function(){var a=b(h);d.onmidimessage(a),c(g+1)},i);else{var j=b(h);d.onmidimessage(j),c(g+1)}}}var e=window.performance.now(),f=a.length;c(0)},a.plugins.MIDI?c():a.loadPlugin("MIDI",c)},EdenUI.plugins.MIDIFileInput.title="MIDI File Input",EdenUI.plugins.MIDIFileInput.description="Use a MIDI file to simulate MIDI file input."; \ No newline at end of file +if(c){var d=c.getRange(),e=Math.floor((d[1]-d[0])/2)+d[0];b||(changeClass(this.gutter.childNodes[e],"play",!1),changeClass(this.gutter.childNodes[e],"current",!1))}}this.curline=a-1;var c=this.ast.getStatementByLine(a-1);if(c){c.getRange||console.error("NO GETRANGE",c);var d=c.getRange();if(d[0]0?(j.errors[0].line==a+1?(c+=" error",e="",i=j.errors[0].messageText(),h=a):"runtime"==j.errors[0].type&&(c+=" error",e="",i=j.errors[0].messageText()),this.lines[a].errored=!0,g=!0):(d.errors.length>0&&d.errors[0].line==a+1&&(this.lines[a].errored=!0,c+=" error",e="",i=d.errors[0].messageText()),this.lines[a].errored&&(g=!0,this.lines[a].errored=!1),j.warning&&(c+=" warning",e="",g=!0,j.warning&&(i=j.warning.messageText())),1==j.executed?(c+=" executed",g=!0,this.lines[a].executed=!0):2==j.executed?(c+=" guarded",g=!0,this.lines[a].executed=!0):3==j.executed&&(c+=" errorblock",g=!0)),this.lines&&this.lines[a]&&(this.lines[a].executed&&j.executed<=0&&(g=!0,this.lines[a].executed=!1),this.lines[a].selected&&(c+=" select"),this.lines[a].live&&(c+=" live"))):(this.errors&&this.errors.length>0&&this.errors[0].line==a+1?this.lines[a].errored||(c+=" error",e="",i=this.errors[0].messageText(),h=a,this.lines[a].errored=!0,g=!0):this.lines[a].errored&&(g=!0,this.lines[a].errored=!1,i=""),this.lines[a].executed&&(g=!0,this.lines[a].executed=!0)),f)if(""==e){var k=document.createElement("div");k.className=c,k.innerHTML="",k.setAttribute("data-line",""+a),this.gutter.replaceChild(k,this.gutter.childNodes[a])}else this.gutter.childNodes[a].className=c,this.gutter.childNodes[a].innerHTML=e;else g&&(this.gutter.childNodes[a].className.indexOf("hover")>=0&&(c+=" hover"),this.gutter.childNodes[a].className.indexOf("play")>=0&&(c+=" play"),this.gutter.childNodes[a].className.indexOf("current")>=0&&(c+=" current"),this.gutter.childNodes[a].innerHTML=e,this.gutter.childNodes[a].className=c,i&&(this.gutter.childNodes[a].title=i))},EdenScriptGutter.prototype.generate=function(a,b){if(this.ast=a,!this.edits){var c=!1,d=a.getNumberOfLines()+1;if(d>this.lineelements.childNodes.length&&(d=this.lineelements.childNodes.length),d!=this.gutter.childNodes.length){for(this.hideBrace();this.gutter.firstChild;)this.gutter.removeChild(this.gutter.firstChild);for(var e=0;e0?this.hideBrace():this.hovering||this.selectLine(b)}},EdenUI.ScriptArea=function(){this.contents=document.createElement("div"),this.intextarea=document.createElement("textarea"),this.intextarea.autofocus=!0,this.intextarea.tabIndex=1,this.intextarea.className="hidden-textarea2",this.contents.appendChild(this.intextarea),this.codearea=document.createElement("div"),this.codearea.className="inputCodeArea",this.contents.appendChild(this.codearea),this.outdiv=document.createElement("div"),this.outdiv.contenteditable=!0,this.outdiv.className="outputcontent",this.outdiv.spellcheck=!1,this.outdiv.tabIndex=2,this.codearea.appendChild(this.outdiv),this.fragment=void 0,this.readonly=!1,this.alwaysreadonly=!1,this.currentlineno=-1,this.currentcharno=-1,this.gotomode=!1,this.highlighter=new EdenUI.Highlight(this.outdiv),this.gutter=new EdenScriptGutter(this.codearea,this.infobox,this.outdiv),this.details=new EdenUI.ScriptArea.Details(this),this.cachedhlopt=void 0,this.disablehl=!1,this.highlighter.setScrollTop(0);var a=this;this.gutterinterval=setInterval(function(){if(void 0!==a.fragment&&void 0!==a.fragment.ast){a.gutter.generate(a.fragment.ast.script,a.currentlineno);for(var b in a.highlighter.metrics)if(a.currentlineno!=b){var c=a.highlighter.metrics[b];if(c.query)for(var d=0;d0?f:"value");g=1==g.length?g[0]:g.length>1?g.join(", "):"",c.qelements[d].setAttribute("data-result",g)}c.squery&&a.highlightContent(b,a.intextarea.selectionEnd)}}},300);new EdenUI.ScriptArea.Keyboard(this),new EdenUI.ScriptArea.Mouse(this);this.rebuildinterval=400},EdenUI.ScriptArea.prototype.setReadonly=function(a){this.alwaysreadonly=a,a===!0?(this.readonly=!0,this.outdiv.contentEditable=!1):(this.readonly=!!this.fragment&&this.fragment.locked,this.outdiv.contentEditable=!this.readonly,"comment"==a&&this.updateEntireHighlight())},EdenUI.ScriptArea.prototype.setFragment=function(a){if(this.fragment&&this.fragment!==a&&(this.fragment.unlock(),this.currentlineno=-1),this.details.hide(),this.fragment=a,void 0===a)return this.gutter.clear(),changeClass(this.outdiv,"browser",!0),this.outdiv.contentEditable=!1,void(this.readonly=!0);var b=this;a.reset(function(){changeClass(b.outdiv,"browser",!1),b.intextarea.value=a.getSource(),a.ast&&(b.highlightContent(-1,0),b.intextarea.focus(),b.checkScroll(),b.gutter.setBaseAST(a.ast.script)),a.locked?(b.readonly=!0,b.outdiv.contentEditable=!1):(b.readonly=b.alwaysreadonly===!0,b.outdiv.contentEditable=!b.readonly)})},EdenUI.ScriptArea.prototype.refresh=function(){this.intextarea.value=this.fragment.getSource(),this.fragment.ast&&this.highlightContent(-1,0)},EdenUI.ScriptArea.prototype.updateSource=function(a,b){this.fragment.setSource(a),this.gutter.errors=this.fragment.ast.errors,this.highlighter.ast=this.fragment.ast},EdenUI.ScriptArea.prototype.updateLineHighlight=function(){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.updateSource(this.intextarea.value,a),this.runScript(a),this.highlightContent(a,b)},EdenUI.ScriptArea.prototype.runScript=function(a){if(this.gutter.lines[a-1]&&this.gutter.lines[a-1].live&&!this.fragment.ast.hasErrors()){var b=this.fragment.ast.script.getStatementByLine(a-1);this.fragment.ast.executeStatement(b,a,this.fragment)}},EdenUI.ScriptArea.prototype.hideInfoBox=function(){},EdenUI.ScriptArea.prototype.updateLineCachedHighlight=function(){if(this.fragment){var a=-1,b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd,a=this.getLineNumber(this.intextarea)),this.highlightContent(a,b)}},EdenUI.ScriptArea.prototype.updateEntireHighlight=function(a,b){if(void 0!==this.fragment){this.cachedhlopt=b,this.updateSource(this.intextarea.value,-1);var c=-1;document.activeElement===this.intextarea&&(c=this.intextarea.selectionEnd),a&&runScript(0),this.highlightContent(-1,c,b)}},EdenUI.ScriptArea.prototype.updateCachedHighlight=function(a){var b=-1;document.activeElement===this.intextarea&&(b=this.intextarea.selectionEnd),this.highlightContent(-1,b,a?a:this.cachedhlopt)},EdenUI.ScriptArea.prototype.findElementLineNumber=function(a){for(var b=a;b.parentNode!==this.outdiv;)b=b.parentNode;var c=parseInt(b.getAttribute("data-line"));return c},EdenUI.ScriptArea.prototype.replaceLine=function(a,b){var c=this.intextarea.value.split("\n");c[a]=b,this.intextarea.value=c.join("\n")},EdenUI.ScriptArea.prototype.focusOutput=function(){this.setCaretToFakeCaret(),this.outdiv.focus()},EdenUI.ScriptArea.prototype.focusText=function(){if(!this.readonly){var a=getCaretCharacterOffsetWithin(this.outdiv),b=getStartCaretCharacterOffsetWithin(this.outdiv);this.intextarea.focus(),this.intextarea.selectionEnd=a,this.intextarea.selectionStart=b,b!=a&&(this.refreshentire=!0)}},EdenUI.ScriptArea.prototype.toggleHighlighting=function(){this.disablehl=!this.disablehl,this.updateEntireHighlight(),this.gutter.clear()},EdenUI.ScriptArea.prototype.highlightContent=function(a,b,c){if(this.fragment){var d=this.fragment.ast;if(d){if(void 0===c&&this.disablehl&&(c={}),this.disablehl&&(c.disabled=!0),this.highlighter.highlight(d,a,b,c),document.activeElement!==this.intextarea&&$(this.outdiv).find(".fake-caret").addClass("fake-blur-caret"),"comment"==this.alwaysreadonly)for(var e=$(this.outdiv).find(".eden-comment-line"),f=0;f")},axis:"x",distance:5,drag:function(b,c){if(!a.readonly){var d;if(a.dragint?d=Math.round(a.dragvalue+(c.position.left-a.dragstart)/2):(d=a.dragvalue+.005*(c.position.left-a.dragstart),d=d.toFixed(4)),d!=a.draglast){a.draglast=d,b.target.innerHTML=""+d;var e=b.target.parentNode.textContent;"\n"==e.charAt(e.length-1)&&(e=e.slice(0,-1)),a.replaceLine(a.dragline,e),a.updateSource(a.intextarea.value,a.dragline),a.runScript(a.dragline+1),a.highlightContent(a.dragline,-1)}}},start:function(b,c){if(!a.readonly){a.edited=!0,a.dragline=a.findElementLineNumber(b.target),a.dragstart=c.position.left;var d=b.target.textContent;d.indexOf(".")==-1?(a.dragvalue=parseInt(d),a.dragint=!0):(a.dragvalue=parseFloat(d),a.dragint=!1),a.draglast=a.dragvalue,$(b.target).addClass("eden-select"),$(a.outdiv).css("cursor","ew-resize")}},stop:function(b,c){a.readonly||($(b.target).removeClass("eden-select"),$(a.outdiv).css("cursor","text"),a.dragline=-1)},cursor:"move",cursorAt:{top:-5,left:-5}}).click(function(){$(this).draggable({disabled:!0})}).blur(function(){$(this).draggable({disabled:!1})})},EdenUI.ScriptArea.prototype.getLineNumber=function(){var a=this.intextarea.value.substr(0,this.intextarea.selectionStart).split("\n");return this.currentlineno=a.length,this.currentcharno=a[a.length-1].length,this.currentlineno},EdenUI.ScriptArea.prototype.gotoLine=function(a){var b=this.intextarea.value.split("\n");b.length=a+1;var c=b.join("\n").length;this.intextarea.focus(),this.intextarea.selectionEnd=c,this.intextarea.selectionStart=c,this.updateLineCachedHighlight()},EdenUI.ScriptArea.prototype.checkScroll=function(){var a=$(this.outdiv.childNodes[this.currentlineno-1]).find(".fake-caret").get(0);if(void 0!==a){for(var b=this.contents.parentNode,c=a.offsetLeft-b.scrollLeft+25,d=b.clientWidth+b.scrollLeft-a.offsetLeft-25;a.parentNode!=this.outdiv;)a=a.parentNode;var e=a.offsetTop-b.scrollTop+15,f=b.clientHeight+b.scrollTop-a.offsetTop-15;c<80&&(b.scrollLeft=b.scrollLeft-(80-c)),d<80&&(b.scrollLeft=b.scrollLeft+(80-d)),e<40&&(b.scrollTop=b.scrollTop-(40-e)),f<40&&(b.scrollTop=b.scrollTop+(40-f))}},EdenUI.ScriptArea.prototype.setCaretToFakeCaret=function(){var a=$(this.outdiv).find(".fake-caret").get(0);if(a){var b=document.createRange(),c=window.getSelection();a.nextSibling&&(a=a.nextSibling),b.setStart(a,0),b.collapse(!0),c.removeAllRanges(),c.addRange(b),$(this.outdiv).remove(".fake-caret")}},EdenUI.ScriptArea.prototype.makeDiff=function(){var a={},b=this.fragment.diff(),c=0;for(var d in b.remove)if(!b.remove[d].consecutive){var e=parseInt(d),f=0,g=20;do g+=20,f++;while(b.remove[e+f]&&b.remove[e+f].consecutive);a[b.remove[d].nline+c]=g}this.gutter.setDiffs(b),this.cachedhlopt={spacing:a},this.updateCachedHighlight()},EdenUI.ScriptArea.prototype.doRebuild=function(){this.makeNumbersDrag()},EdenUI.ScriptArea.prototype.delayRebuild=function(){var a=this;clearTimeout(this.rebuildtimer),this.rebuildtimer=setTimeout(function(){a.doRebuild()},this.rebuildinterval)},EdenUI.ScriptArea.prototype.rebuild=function(){this.gutter.edits?(this.updateSource(this.intextarea.value,-1),this.gutter.ast=this.fragment.ast,this.makeDiff()):(this.edited=!0,this.refreshentire?(this.updateEntireHighlight(),this.refreshentire=!1):this.updateLineHighlight(),this.checkScroll(),this.dirty=!1)},EdenUI.ScriptArea.prototype.enableGotoMode=function(){this.gotomode||(this.outdiv.contentEditable=!1,changeClass(this.outdiv,"goto",!0),this.gotomode=!0)},EdenUI.ScriptArea.prototype.disableGotoMode=function(){this.gotomode&&(this.outdiv.contentEditable=!0,changeClass(this.outdiv,"goto",!1),this.gotomode=!1)},EdenUI.ScriptArea.prototype.insertTab=function(){var a=this.intextarea.selectionStart,b=this.intextarea.selectionEnd;this.intextarea.value=this.intextarea.value.substring(0,a)+"\t"+this.intextarea.value.substring(b),this.intextarea.selectionStart=this.intextarea.selectionEnd=a+1,this.rebuild()},EdenUI.ScriptArea.Details=function(a){this.scriptarea=a,this.contents=document.createElement("div"),this.contents.className="script-details",this.contents.addEventListener("keyup",function(a){var b=a.target.parentNode.getAttribute("data-name"),c=a.target.value;console.log("CHANGE PROP",b,c)}),this.visible=!1},EdenUI.ScriptArea.Details.prototype.addProperty=function(a,b,c,d){var e=document.createElement("div");e.className="script-details-prop",e.setAttribute("data-name",a);var f=document.createElement("div");f.className="script-details-label",f.textContent=b,e.appendChild(f);var g=document.createElement("input");g.className="script-details-value",g.value=c?c:"",g.setAttribute("type","text"),d&&d.readonly&&(g.className+=" script-details-readonly",g.setAttribute("readonly","true")),e.appendChild(g);var h=document.createElement("div");return h.className="script-details-status",d&&d.readonly?h.innerHTML="":h.innerHTML="",e.appendChild(h),this.contents.appendChild(e),e},EdenUI.ScriptArea.Details.prototype.clear=function(){for(;this.contents.lastChild;)this.contents.removeChild(this.contents.lastChild)},EdenUI.ScriptArea.Details.prototype.addButtons=function(){var a=document.createElement("div");a.className="script-details-buttons";var b=document.createElement("button");b.className="script-button",b.innerHTML='Close',a.appendChild(b),this.contents.appendChild(a)},EdenUI.ScriptArea.Details.prototype.show=function(){this.clear(),this.addProperty("name","Name",this.scriptarea.fragment.name),this.addProperty("selector","Path",this.scriptarea.fragment.selector,{readonly:!0}),this.scriptarea.fragment.originast&&this.addProperty("id","Full Name",Eden.Selectors.getID(this.scriptarea.fragment.originast),{readonly:!0});var a=this.scriptarea.fragment.doxy;if(a){this.addProperty("desc","Description",a.stripped()),this.addProperty("tags","Tags",a.getHashTags().join(" "));var b=a.getControls();for(var c in b)this.addProperty(c,c.substring(1),b[c])}this.addButtons(),this.scriptarea.codearea.appendChild(this.contents),changeClass(this.scriptarea.outdiv,"blur",!0),this.visible=!0},EdenUI.ScriptArea.Details.prototype.hide=function(){this.visible&&(this.scriptarea.codearea.removeChild(this.contents),this.visible=!1,changeClass(this.scriptarea.outdiv,"blur",!1))},EdenUI.ScriptArea.Details.prototype.toggle=function(){this.visible?this.hide():this.show()},EdenUI.ScriptArea.Keyboard=function(a){function b(a){var b=a.key;return a.shiftKey&&(b="Shift-"+b),a.altKey&&(b="Alt-"+b),(a.ctrlKey||a.metaKey)&&(b="Ctrl-"+b),b}function c(c){var d=b(c);switch(d){case"Tab":c.preventDefault(),a.insertTab();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Home":case"End":a.moveCaret();break;case"Ctrl-a":a.selectAll(),c.preventDefault();break;case"Ctrl-h":a.toggleHighlighting(),c.preventDefault();break;case"Ctrl-Shift-ArrowLeft":case"Ctrl-Shift-ArrowRight":case"Ctrl-Shift-ArrowUp":case"Ctrl-Shift-ArrowDown":case"Ctrl-Shift-Home":case"Ctrl-Shift-End":case"Shift-ArrowLeft":case"Shift-ArrowRight":case"Shift-ArrowUp":case"Shift-ArrowDown":case"Shift-Home":case"Shift-End":a.focusOutput();break;case"Backspace":a.refreshentire=10==a.intextarea.value.charCodeAt(a.intextarea.selectionStart-1);break;case"Enter":a.refreshentire=!0;break;case"Ctrl-Control":a.enableGotoMode()}}function d(b){a.refreshentire=!0}function e(c){var d=b(c);switch(c.ctrlKey||a.disableGotoMode(),d){case"Ctrl-Control":a.disableGotoMode();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Home":case"End":a.updateLineCachedHighlight(),a.gutter&&a.gutter.selectLine(a.currentlineno),a.checkScroll()}}function f(b){"INPUT"!=b.target.nodeName&&"textarea"!=b.target.nodeName&&(!b.shiftKey||37!=b.keyCode&&38!=b.keyCode&&39!=b.keyCode&&40!=b.keyCode&&35!=b.keyCode&&36!=b.keyCode)&&"Control"!=b.key&&"Shift"!=b.key&&"c"!=b.key&&a.focusText()}function g(b){a.intextarea.focus(),setTimeout(function(){a.updateEntireHighlight()},0)}function h(b){"INPUT"!=b.target.nodeName&&"textarea"!=b.target.nodeName&&(17!=b.keyCode&&91!=b.keyCode&&92!=b.keyCode||a.disableGotoMode())}function i(b){$(a.outdiv).find(".fake-caret").remove()}function j(b){a.dirty=!0,a.rebuild()}function k(a){}a.intextarea.addEventListener("input",j),a.intextarea.addEventListener("keydown",c),a.intextarea.addEventListener("keyup",e),a.intextarea.addEventListener("paste",d),a.outdiv.addEventListener("keydown",f),a.outdiv.addEventListener("keyup",h),a.outdiv.addEventListener("paste",g),a.intextarea.addEventListener("blur",i),a.intextarea.addEventListener("focus",k)},EdenUI.ScriptArea.Mouse=function(a){function b(b){a.readonly}function c(b){if("INPUT"!=b.target.nodeName&&"textarea"!=b.target.nodeName&&(a.hideInfoBox(),!a.readonly&&0!=b.target.isContentEditable))if(a.gotomode){var c=b.target;if(""==c.className&&"SPAN"==c.parentNode.nodeName&&(c=c.parentNode),"eden-selector"==c.className||"eden-selector2"==c.className){a.disableGotoMode();var d=c.parentNode.textContent;Eden.Selectors.goto(d)}else if("eden-observable"==c.className){var e=c.getAttribute("data-observable");Eden.Selectors.goto(e+":active")}b.preventDefault()}else if(document.activeElement===a.outdiv){var f=getCaretCharacterOffsetWithin(a.outdiv),g=getStartCaretCharacterOffsetWithin(a.outdiv);if(g!=f)a.refreshentire=!0;else{a.intextarea.focus(),a.intextarea.selectionEnd=f,a.intextarea.selectionStart=f;a.currentlineno;a.updateLineCachedHighlight()}}}a.outdiv.addEventListener("mouseup",c),a.outdiv.addEventListener("mousedown",b)},EdenUI.plugins.PluginManager=function(a,b){this.createDialog=function(b,c){var d,e,f,g=$('
      '),h=function(b){return a.plugins[b]?"(loaded)":"(not loaded)"};pluginNames=Object.keys(EdenUI.plugins).sort(function(b,c){var d=a.plugins[b],e=a.plugins[c];return d&&!e?1:e&&!d?-1:b
      '+d.title+"
      ";void 0!==d.originalAuthor&&(k=k+""),void 0!==d.author&&(f=void 0===d.originalAuthor?"By ":"Built on by ",k=k+""),k=k+'",$(k).click(function(b){return function(){var c=$(this);a.loadPlugin(b,function(){a.plugins[b]&&(c.find(".pluginlist-loaded").html(h(b)),c.addClass("pluginmanager-loaded",100)),a.menu.updateViewsMenu()})}}(e)).appendTo(g)}var l=$('
      ');l.append(g),$dialog=$('
      ').html(l).dialog({title:c,width:310,height:400,minHeight:120,minWidth:230,dialogClass:"unpadded-dialog"})},a.views.PluginManager={dialog:this.createDialog,title:"Plug-in Manager",category:a.viewCategories.environment,name:"plugins"},b()},EdenUI.plugins.PluginManager.title="Plug-in Manager",EdenUI.plugins.PluginManager.description="Provides the ability to load plug-ins.",EdenUI.plugins.Canvas2D=function(a,b){var c=this;this.defaultFontSizePx=13.3,this.defaultLineHeight=1.75*this.defaultFontSizePx,this.defaultLineWidth=2;var d=600,e=500;canvases={},contents={};var f,g,h,i={},j=40,k=!1,l=!1;Object.defineProperty(this,"mouseIdleTimeout",{set:function(a){clearInterval(g),g=setInterval(function(){if(k)l=!1,k=!1;else if(!l){var a=root.lookup("mouseFollow").value();root.lookup("mouseVelocity").assign(new Point(0,0),root.scope,Symbol.hciAgent,a),l=!0,h=void 0}},a/2),f=a},get:function(){return f},enumerable:!0}),this.mouseVelocitySampleTime=100,this.mouseVelocityDampening=.3,this.mouseIdleTimeout=300;var m=function(a,b){var c;for(c in b)if("false"!=b[c][0].getAttribute("data-garbage"))for(var d=b[c],e=0;em?(e=j,d=i*(e/h),f=0,g=(k-d)/2):(d=k,e=j,f=0,g=0);var n=document.createElement("canvas");n.setAttribute("width","200"),n.setAttribute("height","112");var o=n.getContext("2d");o.drawImage(b,f,g,e,d);var p;try{p=n.toDataURL("image/png")}catch(q){}a&&a(p)},this.drawPicture=function(a){var b=canvases[a];if(void 0!==b&&!b.drawingQueued&&(b.drawingQueued=!0,!b.drawingInProgress)){var d=function(){b.drawingInProgress=!0,b.drawingQueued=!1;var e=i[a],f={},g="view_"+a+"_content",h=root.lookup(g),k=h.value(),l=b.getContext("2d"),n=contents[a],o=0;if(void 0!==n){var p=root.lookup("view_"+a+"_background_colour").value();void 0===p&&(p="white"),l.setTransform(1,0,0,1,0,0),c.setFillStyle(l,p),n.style.backgroundColor=p,l.fillRect(0,0,b.width,b.height);var q;for(q in e)e[q][0].setAttribute("data-garbage",!0);if(Array.isArray(k)){var r=root.lookup("view_"+a+"_scale").value();"number"!=typeof r&&(r=1);var s=root.lookup("view_"+a+"_zoom").value();"number"!=typeof s&&(s=1);var t,u,v=r*s;r<0?(l.scale(-v,v),v=-v,u=-r,t=!0):(1!=v&&l.scale(v,v),u=r,t=!1);var w=root.lookup("view_"+a+"_offset").value();if(w instanceof Point)if(t){var x=b.height/v-w.y;l.translate(w.x,-x),w=new Point(w.x,x)}else l.translate(w.x,w.y);else w=new Point(0,0);c.configureContextDefaults(l,u);for(var y=[k],z=[0],A=[],B="";y.length>0;){var C=y.pop(),D=z.pop();for(D>0&&C[D-1]instanceof EdenUI.plugins.Canvas2D.Transform&&(l.restore(),A.pop(),B=A.join(" "));D=d;i-=c){var j=(Math.round(i*b)-.5)/b;h.moveTo(j,e),h.lineTo(j,g),h.stroke()}for(var k=0==a.y?c:0;k<=g;k+=c){var l=(Math.round(k*b)-.5)/b;h.moveTo(d,l),h.lineTo(f,l),h.stroke()}for(var k=-c;k>=e;k-=c){var l=(Math.round(k*b)-.5)/b;h.moveTo(d,l),h.lineTo(f,l),h.stroke()}},this.configureContextDefaults=function(a,b){a.lineJoin="bevel",a.miterLimit=429496656,a.lineWidth=this.defaultLineWidth/b},this.configureContext=function(a,b,c,d){if("object"!=typeof d)return!0;if(d.visible===!1)return!1;if(Array.isArray(d.dashes)&&(a.setLineDash(d.dashes),"dashOffset"in d&&(a.lineDashOffset=d.dashOffset)),"cap"in d&&(a.lineCap=d.cap),"join"in d&&(a.lineJoin=d.join),"miterLimit"in d&&(a.miterLimit=d.miterLimit),"lineWidth"in d&&(a.lineWidth=d.lineWidth/b),"opacity"in d&&(a.globalAlpha=d.opacity),"object"==typeof d.shadow)if(a.shadowColor=d.shadow.colour,d.shadow.scale){var e=c*b;a.shadowBlur=d.shadow.blur*e,a.shadowOffsetX=d.shadow.xOffset*e,a.shadowOffsetY=d.shadow.yOffset*e}else a.shadowBlur=d.shadow.blur*c,a.shadowOffsetX=d.shadow.xOffset*c,a.shadowOffsetY=d.shadow.yOffset*c;return!0},this.setFillStyle=function(a,b){if(b instanceof CanvasImage){var c=a.createPattern(b.image,"repeat");a.fillStyle=c}else b instanceof EdenUI.plugins.Canvas2D.FillStyle?a.fillStyle=b.getColour(a):a.fillStyle=b},this.initZoneFromDrawingOpts=function(b,c){var d;if(b instanceof Object&&b.zone!==!1){if(d=b.name,void 0===d&&b.zone===!0)return root.currentObservableName();if(a.eden.isValidIdentifier(d)){var e=root.lookup(d+"_click");void 0===e.value()&&e.assign(!1,root.scope,root.lookup(c))}return d}},this.initZoneFromName=function(b,c){if(a.eden.isValidIdentifier(b)){var d=root.lookup(b+"_click");void 0===d.value()&&d.assign(!1,root.scope,root.lookup(c))}return b},this.findDrawableHit=function(a,b,c,d,e){var f=root.lookup("view_"+a+"_content").value(),g=canvases[a];if(g){var h=g.getContext("2d"),i=root.lookup("view_"+a+"_scale").value();return this.findDrawableHitInList(f,h,i,b,c,d,e)}},this.findDrawableHitInList=function(a,b,c,d,e,f,g){if(Array.isArray(a)){var h,i;f?(h=0,i=1):(h=a.length-1,i=-1);for(var j=h;f?j=0;j+=i){var k=a[j];if("object"==typeof k)if(Array.isArray(k)){var l=this.findDrawableHitInList(k,b,c,d,e,f,g);if(l)return l}else{var m=k.isHit;if(void 0!==m){if(!g&&void 0===k.name)continue;b.save();var n=k.isHit(b,c,d,e);if(b.restore(),n===!0)return k}else if(k.inverse){var o=k.inverse(d,e),l=this.findDrawableHitInList(k.items,b,c,o.x,o.y,f,g);if(void 0!==l)return l}}}}},this.findAllDrawablesHit=function(a,b,c,d){var e=root.lookup("view_"+a+"_content").value(),f=canvases[a],g=f.getContext("2d"),h=root.lookup("view_"+a+"_scale").value();return this.findAllDrawablesHitInList(e,g,h,b,c,d)},this.findAllDrawablesHitInList=function(a,b,c,d,e,f){if(!Array.isArray(a))return[];for(var g=[],h=0;h0&&(g=g.concat(m))}}}return g};var n={leftButton:!1,middleButton:!1,rightButton:!1,button4:!1,button5:!1,buttonCount:0,insideCanvas:!1,capturing:!1};this.createCommon=function(b,f){function g(){c.drawPicture(s)}function j(a){return"view_"+b+"_"+a}function l(){var b,d,e=x.value(),f=y.value(),g=e*f,h=z.value();h instanceof Point?(b=h.x,d=h.y):(b=0,d=0);var i=A.value();void 0!==i?(i=Math.ceil((A.value()+b)*g),t.width=i):f>1?t.width=Math.ceil(C.value()*f):t.width=Math.floor(C.value());var j;void 0!==B.value()?j=Math.ceil((B.value()+d)*g):f>1?j=Math.ceil(D.value()*f):(j=D.value(),void 0!==i&&i>Math.floor(C.value())&&(j-=a.scrollBarSize),j=Math.floor(j-1)),t.height=j,t.rescale=!0,c.drawPicture(s)}function m(){E?(E=!1,t.rescale=!0,c.drawPicture(s),H||(H=!0,setTimeout(m,1e3))):(l(),H=!1)}function o(a){var b=root.lookup("mouseFollow").value();root.beginAutocalcOff(),n.insideCanvas=!0;var d;switch(a.button){case 0:n.leftButton=!0,root.lookup("mousePressed").assign(!0,root.scope,Symbol.hciAgent,b),d="Left";break;case 1:n.middleButton=!0,d="Middle";break;case 2:n.rightButton=!0,d="Right";break;case 3:n.button4=!0,d="Button4";break;case 4:n.button5=!0,d="Button5";break;default:d="Unknown"}n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5;var e="|";if(n.leftButton&&(e+="Left|"),n.middleButton&&(e+="Middle|"),n.rightButton&&(e+="Right|"),n.button4&&(e+="Button4|"),n.button5&&(e+="Button5|"),root.lookup("mouseButtons").assign(e,root.scope,Symbol.hciAgent,b),root.lookup("mouseButton").assign(d+" down",root.scope,Symbol.hciAgent,b),1==n.buttonCount){var f=root.lookup("mousePosition").value();root.lookup("mouseDownView").assign(s,root.scope,Symbol.hciAgent,b),root.lookup("mouseDown").assign(f,root.scope,Symbol.hciAgent,b);var g=root.lookup("view_"+s+"_scale").value(),h=root.lookup("view_"+s+"_zoom").value(),i=g*h,j=$(this).offset(),k=(a.pageX-Math.round(j.left))/i,l=(a.pageY-Math.round(j.top))/i,m=root.lookup("view_"+s+"_offset").value();m instanceof Point&&(k-=m.x,l-=m.y);var o,p=c.findDrawableHit(s,k,l,!1,!1);o=void 0===p?void 0:p.name;var q=root.lookup("mouseZone"),r=q.value();o!==r&&q.assign(o,root.scope,Symbol.hciAgent,b),root.lookup("mouseDownZone").assign(o,root.scope,Symbol.hciAgent,b)}root.endAutocalcOff()}var p,q,r={name:"*Default"},s=b,t=canvases[b];void 0===t?(p=$('
      '),p.html(''),q=p.find(".canvashtml-canvas"),t=q[0],canvases[b]=t,contents[b]=p[0],i[b]={},t.drawingQueued=!1,t.drawingInProgress=!1,t.rescale=!1):(p=$("#"+b+"-canvascontent"), +q=p.find(".canvashtml-canvas"));var u=[j("content"),j("background_colour"),j("scale"),j("zoom"),j("offset"),j("canvas_right"),j("canvas_bottom"),"mousePosition","mouseButton","mouseButtons","mouseCapture","mouseCaptured","mouseDown","mouseDownView","mouseFollow","mousePressed","mouseUp","mouseWheel","mouseWheelEnabled","mouseWheelVelocity","mouseView","mouseZone","mouseVelocity"];t.setAttribute("data-observables",u.join(","));var v=root.lookup("view_"+s+"_content");v.addJSObserver("repaintView",g);var w=root.lookup("view_"+s+"_background_colour");void 0===w.value()&&w.assign("white",root.scope,r),w.addJSObserver("refreshView",g);var x=root.lookup("view_"+s+"_scale"),y=root.lookup("view_"+s+"_zoom"),z=root.lookup("view_"+s+"_offset"),A=root.lookup("view_"+s+"_canvas_right"),B=root.lookup("view_"+s+"_canvas_bottom"),C=root.lookup("view_"+s+"_width"),D=root.lookup("view_"+s+"_height"),E=!1,F=x.value();void 0===F&&(x.assign(1,root.scope,r),F=1),x.addJSObserver("refreshView",l);var G=y.value();void 0===G&&(y.assign(1,root.scope,r),G=1);var H=!1;y.addJSObserver("refreshView",function(a,b){Math.round(100*b);E=!0,m()});var I,J,K=z.value();K instanceof Point?(I=K.x,J=K.y):(z.assign(new Point(0,0),root.scope,r),I=0,J=0),z.addJSObserver("refreshView",l),void 0==A.value()&&A.assign(void 0,root.scope,r),A.addJSObserver("repaintView",l),void 0==B.value()&&B.assign(void 0,root.scope,r),B.addJSObserver("repaintView",l);var L=A.value();L=void 0===L?d:L*F+I;var M=B.value();M=void 0===M?e:M*F+J;var N=root.lookup("view_"+s+"_grid_visible");void 0===N.value()&&N.assign(!1,root.scope,r),N.addJSObserver("refreshView",g);var O=root.lookup("view_"+s+"_grid_spacing");return void 0===O.value()&&O.assign(20,root.scope,r),O.addJSObserver("refreshView",g),q.on("mousedown",o),q.on("mouseup",function(b){var c=root.lookup("mouseFollow").value();root.beginAutocalcOff(),n.insideCanvas=!0;var d;switch(navigator.platform.toUpperCase().indexOf("MAC")>=0&&b.ctrlKey&&(b.button=2),b.button){case 0:n.leftButton=!1,root.lookup("mousePressed").assign(!1,root.scope,Symbol.hciAgent,c),d="Left";break;case 1:n.middleButton=!1,d="Middle";break;case 2:n.rightButton=!1,d="Right";break;case 3:n.button4=!1,d="Button4";break;case 4:n.button5=!1,d="Button5";break;default:d="Unknown"}if(n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5,root.lookup("mouseButton").assign(d+" up",root.scope,Symbol.hciAgent,c),0==n.buttonCount){var e=root.lookup("mousePosition").value();root.lookup("mouseButtons").assign("",root.scope,Symbol.hciAgent,c),root.lookup("mouseUp").assign(e,root.scope,Symbol.hciAgent,c),a.plugins.Canvas2D.endClick()}else{var f="|";n.leftButton&&(f+="Left|"),n.middleButton&&(f+="Middle|"),n.rightButton&&(f+="Right|"),n.button4&&(f+="Button4|"),n.button5&&(f+="Button5|"),root.lookup("mouseButtons").assign(f,root.scope,Symbol.hciAgent,c)}root.endAutocalcOff()}).on("contextmenu",function(a){navigator.platform.toUpperCase().indexOf("MAC")>=0&&a.ctrlKey&&(a.button=2,o(a)),root.lookup("mouseContextMenuEnabled").value()||(a.preventDefault(),a.stopPropagation())}).on("click",function(a){root.lookup("mouseCapture").value()&&this.requestPointerLock()}).on("dblclick",function(a){var b=root.lookup("mouseFollow").value(),c=root.lookup("mouseDoubleClicks"),d=c.value();c.assign(d+1,root.scope,Symbol.hciAgent,b)}).on("wheel",function(a){var b,d=a.originalEvent,e=D.value();b=d.deltaMode==WheelEvent.DOM_DELTA_LINE?c.defaultLineHeight:d.deltaMode==WheelEvent.DOM_DELTA_PAGE?0!=d.deltaX?C.value():e:1;var f=root.lookup("mouseFollow").value();if(0!=d.deltaY&&a.ctrlKey&&!a.altKey&&!a.metaKey&&!a.shiftKey){a.preventDefault(),a.stopPropagation(),root.beginAutocalcOff();var g=-d.deltaY*b;if(root.lookup("touchPinchEnabled").value()){var h=root.lookup("touchPinch"),i=h.value();i+=g,h.assign(i,root.scope,Symbol.hciAgent,f)}else{var j=y.value();j=j*(e+2*g)/e,j<.05&&(j=.05),y.assign(j,root.scope,Symbol.hciAgent,f)}return void root.endAutocalcOff()}if(root.lookup("mouseWheelEnabled").value()){if(root.beginAutocalcOff(),0!==d.deltaY&&(!a.ctrlKey||a.altKey||a.metaKey||a.shiftKey)){a.preventDefault(),a.stopPropagation();var k=root.lookup("mouseWheel"),l=k.value(),g=d.deltaY*b;l+=g,k.assign(l,root.scope,Symbol.hciAgent,f),root.lookup("mouseWheelVelocity").assign(g,root.scope,Symbol.hciAgent,f)}if(0!==d.deltaX){a.preventDefault(),a.stopPropagation();var m=root.lookup("touchPanX"),n=m.value(),o=d.deltaX*b;n+=o,m.assign(n,root.scope,Symbol.hciAgent,f),root.lookup("touchPanXSpeed").assign(o,root.scope,Symbol.hciAgent,f)}root.endAutocalcOff()}}).on("mouseout",function(a){n.insideCanvas=!1;var b=root.lookup("mouseFollow").value();root.lookup("mouseZone").assign(void 0,root.scope,Symbol.hciAgent,b)}).on("mouseenter",function(a){if(!n.insideCanvas){n.insideCanvas=!0;var b;0==n.buttonCount?b="":(b="|",n.leftButton&&(b+="Left|"),n.middleButton&&(b+="Middle|"),n.rightButton&&(b+="Right|"),n.button4&&(b+="Button4|"),n.button5&&(b+="Button5|"));var c=root.lookup("mouseButtons"),d=c.value();if(b!=d){var e=root.lookup("mouseFollow").value();root.beginAutocalcOff(),c.assign(b,root.scope,Symbol.hciAgent,e),root.lookup("mouseButton").assign("Enter window",root.scope,Symbol.hciAgent,e);var f=root.lookup("mousePressed");f.value()!=n.leftButton&&f.assign(n.leftButton,root.scope,Symbol.hciAgent,e),""==d&&""!=b&&(root.lookup("mouseDown").assign(void 0,root.scope,Symbol.hciAgent,e),root.lookup("mouseDownView").assign(void 0,root.scope,Symbol.hciAgent,e)),root.endAutocalcOff()}}}).on("mousemove",function(a){k=!0;var b=root.lookup("mouseFollow").value();root.beginAutocalcOff();var d,e,f,g,i=root.lookup("mouseView"),j=root.lookup("mousePosition"),l=i.value(),m=j.value();m&&(f=m.x,g=m.y);var o=root.lookup("view_"+s+"_scale").value(),p=root.lookup("view_"+s+"_zoom").value(),q=o*p;if(n.capturing){var r=a.originalEvent;d=f+r.movementX/q,e=g+r.movementY/q}else{var t=$(this).offset();d=(a.pageX-Math.round(t.left))/q,e=(a.pageY-Math.round(t.top))/q;var u=root.lookup("view_"+s+"_offset").value();u instanceof Point&&(d-=u.x,e-=u.y)}i.assign(s,root.scope,Symbol.hciAgent,b);var v=new Point(d,e);j.assign(v,root.scope,Symbol.hciAgent,b);var w,x=Date.now();if(l==s&&void 0!==h){if(w=x-h,w>=c.mouseVelocitySampleTime){var y=root.lookup("mouseVelocity"),z=y.value(),A=1e3*(d-f)/w,B=1e3*(e-g)/w;if(z){var C=c.mouseVelocityDampening,D=z.x;(A>0&&D>0||A<0&&D<0)&&(A=C*D+(1-C)*A);var E=z.y;(B>0&&E>0||B<0&&E<0)&&(B=C*E+(1-C)*B)}A=Math.ceil(A*q)/q,B=Math.ceil(B*q)/q;var F=new Point(A,B);y.assign(F,root.scope,Symbol.hciAgent,b),h=x}}else h=x;var G,H=c.findDrawableHit(s,d,e,!1,!1);G=void 0===H?void 0:H.name;var I=root.lookup("mouseZone"),J=I.value();G!==J&&I.assign(G,root.scope,Symbol.hciAgent,b),root.endAutocalcOff()}).on("keyup",function(a){var b=a.which,c=!1;if(a.altKey&&!a.shiftKey&&!a.ctrlKey){var d=root.lookup("view_"+s+"_zoom"),e=d.value();61==b||187==b?(e=1.25*e,c=!0):173==b||189==b?(e/=1.25,c=!0):48==b&&(e=1,c=!0),d.assign(e,root.scope,Symbol.hciAgent)}c&&(a.preventDefault(),a.stopPropagation())}),{initialWidth:L,initialHeight:M,code_entry:p,offsetSym:z,zoomSym:y,widthSym:A,heightSym:B,scaleSym:x}},this.createEmbedded=function(b,d,e){var f=b;eden.execute2("view_"+f+"_content is "+e+";");var g=c.createCommon(b,d),h=(g.initialWidth,g.initialHeight,g.code_entry),i=g.offsetSym,j=g.zoomSym,k=g.widthSym,l=g.heightSym,m=g.scaleSym,n={code_entry:h,contents:h,destroy:function(){delete canvases[f],delete contents[f]},resize:function(b,d){var e,g,h=i.value();h instanceof Point?(e=h.x,g=h.y):(e=0,g=0);var n,o,p=j.value(),q=document.getElementById(f+"-canvas"),r=!1,s=k.value();if(void 0===s?(n=p>1?Math.ceil(b*p):Math.floor(b),q.width!=n&&(q.width=n,r=!0)):s=Math.ceil(s*m.value()*p+e),void 0===l.value()){if(p>1)o=Math.ceil(d*p);else{o=d,void 0!==s&&s>o&&(o-=a.scrollBarSize);var o=Math.floor(o-1)}o!=q.height&&(q.height=o,r=!0)}r&&c.drawPicture(f)}};return n},this.createDialog=function(b,d){var e,f=b.slice(0,-7),g=c.createCommon(f,d),h=g.initialWidth,j=g.initialHeight,k=g.code_entry,l=g.offsetSym,m=g.zoomSym,n=g.widthSym,o=g.heightSym,p=g.scaleSym;return $('
      ').html(k).dialog({appendTo:"#jseden-views",title:d,width:h+a.scrollBarSize,height:j+a.titleBarHeight,minHeight:120,minWidth:230,classes:{"ui-dialog":"canvas-dialog unpadded-dialog ui-front"}}),e={confirmClose:!0,destroy:function(){var a=i[f];for(var b in a)for(var c=a[b],d=0;d1?Math.ceil(b*k):Math.floor(b),q.width!=i&&(q.width=i,r=!0)):s=Math.ceil(s*p.value()*k+e),void 0===o.value()){if(k>1)j=Math.ceil(d*k);else{j=d,void 0!==s&&s>j&&(j-=a.scrollBarSize);var j=Math.floor(j-1)}j!=q.height&&(q.height=j,r=!0)}r&&c.drawPicture(f)}},c.drawPicture(f),e},root.lookup("mouseDownZone").addJSObserver("recordClick",function(a,b){if(eden.isValidIdentifier(b)){var c=root.lookup(b+"_click");c.value()===!1&&c.assign(!0,root.scope,Symbol.hciAgent,!0)}}),this.endClick=function(){var a=root.lookup("mouseDownZone").value();if(eden.isValidIdentifier(a)){var b=root.lookup(a+"_click");b.value()===!0&&b.assign(!1,root.scope,Symbol.hciAgent,!0)}},this.canvasNameFromElement=function(a){for(;a;){var b=a.id;if("-canvascontent"==b.slice(-14))return b.slice(0,-14);a=a.parentElement}return null},document.addEventListener("mouseup",function(b){var c=root.lookup("mouseFollow").value();if(root.beginAutocalcOff(),!n.insideCanvas){var d;switch(b.button){case 0:n.leftButton=!1,d="Left";break;case 1:n.middleButton=!1,d="Middle";break;case 2:n.rightButton=!1,d="Right";break;case 3:n.button4=!1,d="Button4";break;case 4:n.button5=!1,d="Button5";break;default:d="Unknown"}n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5;var e=root.lookup("mouseButtons");if(0==n.buttonCount&&""!=e.value()){var f=root.lookup("mousePressed"),g=f.value();root.lookup("mouseButton").assign(d+" up",root.scope,Symbol.hciAgent,c),e.assign("",root.scope,Symbol.hciAgent,c),root.lookup("mousePosition").assign(void 0,root.scope,Symbol.hciAgent,c),g&&f.assign(!1,root.scope,Symbol.hciAgent,c),root.lookup("mouseUp").assign(void 0,root.scope,Symbol.hciAgent,c),root.lookup("mouseView").assign(void 0,root.scope,Symbol.hciAgent,c),a.plugins.Canvas2D.endClick()}}root.endAutocalcOff()}),document.addEventListener("mousedown",function(a){if(!n.insideCanvas){switch(a.button){case 0:n.leftButton=!0;break;case 1:n.middleButton=!0;break;case 2:n.rightButton=!0;break;case 3:n.button4=!0;break;case 4:n.button5=!0}n.buttonCount=n.leftButton+n.middleButton+n.rightButton+n.button4+n.button5}}),document.addEventListener("pointerlockchange",function(a){var b=null!==document.pointerLockElement;n.capturing=b;var c=root.lookup("mouseFollow").value();root.lookup("mouseCaptured").assign(b,root.scope,void 0,c)}),a.views.Canvas2D={dialog:this.createDialog,embedded:this.createEmbedded,title:"Canvas 2D",category:a.viewCategories.visualization,holdsContent:!0};var o;o="/index-dev.html"==document.location.pathname.slice(-15)?"canvas.js-e":"jseden-canvas.min.js-e",Eden.Selectors.execute("plugins > canvas > canvas",function(){eden.root.lookup("plugins_canvas_loaded").assign(!0,eden.root.scope),b&&b()})},EdenUI.plugins.Canvas2D.FillStyle=function(){},EdenUI.plugins.Canvas2D.Transform=function(){},EdenUI.plugins.Canvas2D.Transform.CSSInfo=function(a,b,c){this.css=a,this.scaleX=b,this.scaleY=c},EdenUI.plugins.Canvas2D.title="Canvas 2D",EdenUI.plugins.Canvas2D.description="Provides the ability to draw two-dimensional shapes, images, text and user interface controls using EDEN dependencies.",EdenUI.plugins.Page=function(a,b){function c(a){if(!a)return"";if("title"!=a[0])return"";var b,c=$("
      "),d=$("
      ");a[6]&&c.css("height",""+a[6]+"px"),b=a[1]?$(""+a[1]+""):$('');var e=$("
      "+a[2]+"");return d.append(b),d.append(e),c.append(d),void 0!==a[3],c}function d(a){if(!a)return"";if("header"!=a[0])return"";switch(a[3]){case 0:return $("

      "+a[1]+"

      ");case 1:return $("")}}function e(a){var b=typeof a;switch(b){case"string":return a;case"number":return""+a+"px";default:return""}}function f(a,b){for(var c=0;c]*(?:"[^"]*")*(?:'[^']*')*)*)?(?:\/|(?:>((?:[^<]*(?:<(?!\/jseden\1>))*)*)<\/jseden\1))>/g,function(a,d,e,f,h,i,j){return void 0===h&&(h=""),b.push(h),c.push(g(e,f)),"\0\0"});var d=a.split("\0\0");if(1==d.length)return a;for(var e=$("
      "),f=0;f"+d[f]+"
      ")),void 0===c[f].tagType){var h=b[f].split("\n").length;void 0===c[f].lines&&(c[f].lines=h),void 0===c[f].width&&(c[f].width="50%"),void 0===c[f].box&&(c[f].box=!0);var i=l(["script",c[f].static,[b[f]],c[f].name,c[f].box,c[f].lines,!1,c[f].float,c[f].width]);e.append(i)}else if(c[f])if("canvas"==c[f].tagType){var j=n(["canvas",c[f].name,c[f].source,c[f].width,c[f].height,c[f].float,c[f].box]);e.append(j)}else if("veden"==c[f].tagType){var k=m(["veden",c[f].name,c[f].width,c[f].height,c[f].float,b[f]]);e.append(k)}return e.append($("
      "+d[d.length-1]+"
      ")),e.get(0)}function i(a){if(a&&"element"==a[0]){var b,c=a[1],d=a[2],e=a[3],g=a[4],i=a[5],k=a[6],l=(a[7],a[8],a[9],a[10],a[11],a[12]),m=a[13];switch(c){case"div":case"span":case"button":case"img":case"p":case"ul":case"ol":case"li":case"br":case"pre":case"h1":case"h2":case"h3":case"a":case"input":b=document.createElement(c);break;default:return void console.error("Invalid element type: "+c)}if(d&&(b.id=d),e&&(b.className=e),g&&"string"==typeof g){var n=h(g);"string"==typeof n?b.innerHTML=n:b.appendChild(n)}return g&&g instanceof Array&&j(b,g),i&&"string"==typeof i&&(b.cssText=i),i&&i instanceof Array&&f(b,i),k&&d&&(b.onclick=function(a){var b=eden.root.lookup(d+"_click");console.log("ELEMENT CLICK"),b.assign(!0,eden.root.scope)}),"img"==c&&l&&(b.src=l),"a"==c&&m&&(b.href=m),b}}function j(a,b){if("string"==typeof b[0]){var c=i(b);return void(c&&a.appendChild(c))}for(var d=0;d([\s\S]*?)<\/jseden>/g,function(a,b,d,e,f){return console.log("ATTRIBS: "+b),c.push(d),"\0\0"});var d=b.split("\0\0");if(1==d.length)return $("
      "+b+"
      ");for(var e=$("
      "+d[f]+"
      "));var g=c[f].split("\n").length,h=l(["script",!1,[c[f]],void 0,!0,g,!1,!1,"50%"]);e.append(h)}return e.append($("
      "+d[d.length-1]+"
      ")),e}function l(b){if(b&&"script"==b[0]){var c=b[1],d=b[2],e=b[3],f=b[4],g=b[5],h=b[6],i=b[7],j=b[8];if(void 0===e&&(e="embedded"+B,B++),c){var k;k=f?$("
      "):$("
      ");var l,m=new EdenUI.Highlight(k.get(0));l=d instanceof Array?EdenUI.plugins.ScriptInput.buildScriptFromList(d):d;var n=new Eden.AST(l);m.highlight(n,-1,-1),i&&"none"!=i&&k.css("float",i),"50%"!=j&&("number"==typeof j?k.width(j):k.css("width",j));var o=EdenUI.plugins.ScriptInput.getRequiredHeight(g,!0);return k.height(o),k}var p;z[e]?(p=z[e],p.update(d)):(p=a.views.ScriptInput.embed(e,e,d,h),z[e]=p);var q;q=f?$("
      "):$("
      ");var o=EdenUI.plugins.ScriptInput.getRequiredHeight(g,!0);return q.height(o),i&&"none"!=i&&q.css("float",i),"50%"!=j&&("number"==typeof j?q.width(j):q.css("width",j)),p.contents.appendTo(q),q.resizable(),q}}function m(b){if(b&&"veden"==b[0]){var c,d=b[1],e=b[2],f=b[3],g=b[4],h=b[5];A[d]?c=A[d]:(c=a.views.Veden.embed(d,d,h),A[d]=c);var i;return i=$("
      "),i.height(f),g&&"none"!=g&&i.css("float",g),"50%"!=e&&("number"==typeof e?i.width(e):i.css("width",e)),c.contents.appendTo(i),i.resizable(),i}}function n(b){var c,d=b[6],f=b[3],g=b[4];if(c=d?$("
      "):$("
      "),f&&c.css("width",e(f)),g&&c.css("height",e(g)),void 0===y[b[1]]){var h=a.views.Canvas2D.embedded(b[1],b[1],b[2]);y[b[1]]=h,c.append(h.code_entry),x.push(function(){h.resize(b[3],b[4])})}else y[b[1]].code_entry.appendTo(c),x.push(function(){y[b[1]].resize(b[3],b[4])});return"none"!=b[5]&&c.css("float",b[5]),c}function o(a){var b;if(b=a[1]?$("
        "):$("
          "),a[2]&&a[2]instanceof Array)for(var c=0;c"+a[2][c]+"");b.append(d)}return b}function p(a,b){if(!a)return"";if(!(a instanceof Array))return"";for(var c=$("
          "),e=0;e"));break;case"list":c.append(o(a[e]))}return c}function q(a,b){if(void 0!==b&&b instanceof Array){for(var c in y)y[c].code_entry.detach();for(var d in z)z[d].contents.detach();w.html(""),j(w.get(0),b);for(var e=0;e");$("#jseden-views").append(w).addClass("page-body");var x=[],y={},z={},A={},B=0,C=["top","bottom","left","right","width","height","background","position","color","border","font","fontSize","fontFamily","fontWeight","borderBottom","borderLeft","borderRight","borderTop","overflow","padding","paddingTop","paddingLeft","paddingRight","paddingBottom","margin","marginLeft","marginRight","marginTop","marginBottom","textShadow"];r(t,v),t.addJSObserver("pageGenerator",r),u.addJSObserver("pageGenerator",q),Eden.Selectors.execute("plugins > page > page",function(){eden.root.lookup("plugins_page_loaded").assign(!0,eden.root.scope),b&&b()})},EdenUI.plugins.Page.title="Page",EdenUI.plugins.Page.description="Generate web content from scripts.";var edenfunctions={};EdenUI.plugins.SymbolViewer=function(a,b){var c=this;this.instances=[];var d=0,e=function(a,b){var c='\t\t\t
          \t\t\t\t \t\t\t\tEdit Listed
          \t\t\t\t';return c+='\t\t\t
          \t\t\t
          '};this.createDialog=function(b,f,g){function h(){var b=q.value();return o.val().startsWith("select: ")?a.regExpFromStr("","",!1,b):a.regExpFromStr(o,"",!1,b)}function i(a,b){n.search(p.value,h()),"regexp"==b?o.attr("placeholder","search regular expression"):"simple"==b?o.attr("placeholder","simple search"):o.attr("placeholder","search")}var k=b.slice(0,-7),l=root.lookup("createView"),m=$('
          ');m.html(e(b,g));var n=new EdenUI.plugins.SymbolViewer.SymbolList(a.eden.root,m.find(".symbollist-results")[0],g);$dialog=$('
          ').append(m).dialog({appendTo:"#jseden-views",title:f,width:360,height:400,minHeight:200,minWidth:200,classes:{"ui-dialog":"symbollist-dialog ui-front"}}),c.instances.push(n),d++,1==d&&a.eden.root.addGlobal(j),m.find(".symbollist-search-box-outer > .symbollist-edit").click(function(){var b="edit_"+k;if(p.value.startsWith("select: ")){a.createView(b,"ScriptInput",void 0);var c=eden.root.lookup("view_"+b+"_tabs").value();Array.isArray(c)||(c=[]),c.push(p.value.substring(8)),eden.root.lookup("view_"+b+"_tabs").assign(c,eden.root.scope,Symbol.hciAgent),eden.root.lookup("view_"+b+"_current").assign(c.length-1,eden.root.scope,Symbol.hciAgent)}});var o=m.find(".symbollist-search-box-outer > .symbollist-search"),p=o[0],q=root.lookup("view_"+k+"_search_language");i(q,q.value()),q.addJSObserver("refreshView",i);var r=root.lookup("view_"+k+"_search_string"),s=function(a,b){void 0!==b&&(b!==p.value&&(p.value=b),n.search(b,h()))},t=r.value();void 0===t?(r.assign("",root.scope,l),n.search("",new RegExp(""))):s(r,t),r.addJSObserver("refreshView",s),o.keyup(function(){r.assign(p.value,root.scope,Symbol.hciAgent)});var u={destroy:function(){var b=c.instances.indexOf(n);c.instances.splice(b,1),d--,0==d&&a.eden.root.removeGlobal(j)}};return u},this.createObservableDialog=function(a,b){return c.createDialog(a,b,"obs")},this.createFunctionDialog=function(a,b){return c.createDialog(a,b,"func")},this.createAgentDialog=function(a,b){return c.createDialog(a,b,"agent")},this.createSymbolDialog=function(a,b){return c.createDialog(a,b,"all")};var f={},g={},h=!1;this.isCreationPending=function(a){return a in g},this.delay=40;var i=function(){for(x in c.instances){var a,b,d,e=c.instances[x];void 0===EdenUI.plugins.SymbolViewer.inlineEditorSymbol&&(a=$(e.symresults),b=a.parent(),d=a.scrollTop(),a.detach());for(var i in g){var j=g[i];e.filter?e.filter.indexOf(i)>=0&&e.addSymbol(j,i):e.addSymbol(j,i)}for(var i in f)e.updateSymbol(i);void 0===EdenUI.plugins.SymbolViewer.inlineEditorSymbol&&(a.appendTo(b),a.scrollTop(d))}f={},g={},h=!1},j=function(a,b){var d=a.name;if(1==b)g[d]=a;else{if(d in g)return;f[d]=a}h||(h=!0,setTimeout(i,c.delay))};a.views.ObservableList={dialog:this.createObservableDialog,title:"Observable List",category:a.viewCategories.comprehension,menuPriority:0},a.views.FunctionList={dialog:this.createFunctionDialog,title:"Function List",category:a.viewCategories.comprehension,menuPriority:0},a.views.AgentList={dialog:this.createAgentDialog,title:"Agent List",category:a.viewCategories.comprehension,menuPriority:0},a.views.SymbolList={dialog:this.createSymbolDialog,title:"Symbol List",category:a.viewCategories.comprehension,menuPriority:1},eden.root.lookup("plugins_symbolviewer_loaded").assign(!0,eden.root.scope),b()},EdenUI.plugins.SymbolViewer.title="Symbol Viewer",EdenUI.plugins.SymbolViewer.description="Provide various views of the symbol table.",EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0,EdenUI.plugins.SymbolViewer.SymbolList=function(a,b,c){this.root=a,this.regExp=new RegExp(""),this.type=c,this.category="all",this.customCategory=!1,this.subtypes="all",this.symresults=b,this.symbols={},this.filter=void 0},EdenUI.plugins.SymbolViewer.SymbolList.prototype.search=function(a,b,c,d){if("undefined"!=typeof a)if(a.startsWith("select: ")){var e=Eden.Selectors.query(a.substr(8),"symbol");console.log(e),this.filter=e,this.regExp=b,this.regExp=b,void 0!==d&&(this.subtypes=d),EdenUI.closeTooltip(),this.symresults.innerHTML="",this.symbols={};for(var f=0;f'),d&&this.element.addClass("symbollist-"+d+"-result"),c){case"func":this.update=this.updateFunction;break;case"agent":this.update=this.updateProcedure;break;case"obs":this.update=this.updateObservable}var f=this,g=!1;this.element.click(function(){EdenUI.plugins.SymbolViewer.inlineEditorSymbol||g||(g=!0,setTimeout(function(){if(!EdenUI.plugins.SymbolViewer.inlineEditorSymbol&&g){g=!1;"edit_"+f.name;Eden.Selectors.goto("> :not(ACTIVE) >> "+a.name)}},350))}),"obs"==c&&this.element.dblclick(function(){function a(){var a=l.get(0).value,b=o.value;";"!=b.slice(-1)&&(b+=";"),eden.execute2(f.name+" "+a+" "+b),e(),EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0}function c(b){var c=b.which;13==c?a():27==c&&(e(),EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0)}if(g=!1,EdenUI.plugins.SymbolViewer.inlineEditorSymbol!==f){var d=f.symbol.cache.value;if(void 0!==f.symbol.definition||"boolean"!=typeof d){EdenUI.plugins.SymbolViewer.inlineEditorSymbol=f,f.element.addClass("symbollist-inline-editor");var h=f.element.find(".result_value"),i=f.element.find(".result_separator");h.html("");var j,k;void 0!==f.symbol.definition?(j=f.symbol.getSource().replace(new RegExp("^\\s*"+b+"\\s+is\\s+"),""),k="is"):(j=Eden.edenCodeForValue(d),k="=");var l=$("");"="==k?(l.append(''),l.append('')):(l.append(''),l.append('')),i.html(" "),i.append(l);var m=Eden.htmlEscape(j,!0),n=$(''),o=n.get(0);n.on("keyup",c),n.on("blur",function(){setTimeout(function(){l.is(document.activeElement)||(e(),setTimeout(function(){EdenUI.plugins.SymbolViewer.inlineEditorSymbol===f&&(EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0)},500))},0)}),l.on("keydown",c),l.on("blur",function(){setTimeout(function(){n.is(document.activeElement)||(e(),setTimeout(function(){EdenUI.plugins.SymbolViewer.inlineEditorSymbol===f&&(EdenUI.plugins.SymbolViewer.inlineEditorSymbol=void 0)},500))},0)}),h.append(n);var p=f.element.find(".symbollist-result-inner");p.length>0&&(p.get(0).onmouseenter=void 0),EdenUI.closeTooltip(),o.focus(),o.select();var q=j.slice(0,1);'"'!=q&&"'"!=q&&"["!=q&&"{"!=q||(o.selectionStart=1,o.selectionEnd=j.length-1)}else d===!0?f.symbol.assign(!1,eden.root.scope,Symbol.hciAgent,!0):f.symbol.assign(!0,eden.root.scope,Symbol.hciAgent,!0)}}),this.update()},EdenUI.plugins.SymbolViewer.Symbol.prototype.updateFunction=function(){var a,b,c=this.symbol.getSource();if(a=void 0===this.symbol.definition||/^func\s/.test(c)?this.name:""+this.name+"",void 0!=edenfunctions.functions&&void 0!==edenfunctions.functions[this.name]){this.details=edenfunctions.functions[this.name];var d=Object.keys(this.details.parameters||{});b="( "+d.join(", ")+" )"}else b="";var e=""+a+""+b;if(void 0!==this.symbol.definition&&!/^func\s/.test(this.symbol.eden_definition)){var f=Eden.htmlEscape(c,!1,!0);f=Eden.htmlEscape("
          "+f+";
          "),e=""+e+""}this.element.html(e)},EdenUI.plugins.SymbolViewer.Symbol.prototype.updateObservable=function(){var a,b=this.symbol.value(),c=_formatVal(b);a=void 0!==this.symbol.definition?""+this.name+"":this.name;var d=""+a+" = "+c+"";if(void 0!==this.symbol.definition){var e=Eden.htmlEscape(this.symbol.getSource(),!1,!0);e=Eden.htmlEscape("
          "+e+";
          "),d=""+d+""}this.element.html(d)},EdenUI.plugins.SymbolViewer.Symbol.prototype.updateProcedure=function(){var a,b,c=this.symbol.getSource();if(a=void 0===this.symbol.definition||/^proc\s/.test(c)?this.name:""+this.name+"",void 0!=edenfunctions.functions&&void 0!==edenfunctions.procedures[this.name]){this.details=edenfunctions.procedures[this.name];var d=Object.keys(this.details.parameters||{});b="( "+d.join(", ")+" )"}else b="";var e=""+a+""+b;if(void 0!==this.symbol.definition&&!/^proc\s/.test(c)){var f=Eden.htmlEscape(c,!1,!0);f=Eden.htmlEscape("
          "+f+";
          "),e=""+e+""}this.element.html(e)};var edenfunctions={};EdenUI.plugins.VersionViewer=function(a,b){var c=this;this.instances=[];var d=0,e=function(a,b){var c='
          ';return c};this.createDialog=function(b,f,g){var h=b.slice(0,-7),i=(root.lookup("createView"),$('
          '));i.html(e(b,g)),$dialog=$('
          ').append(i).dialog({appendTo:"#jseden-views",title:f,width:360,height:400,minHeight:200,minWidth:200,classes:{"ui-dialog":"versionviewer-dialog ui-front"}});var j=(root.lookup("view_"+h+"_search_string"),function(){var a=URLUtil.getParameterByName("load");$.get(Eden.DB.remoteURL+"/project/versions",{projectID:a},function(b){var c=i.find(".version-viewer-list").html(""),d=$("VidDateParentDiff");c.append(d),$(b).each(function(b,d){var e=$(''+d.saveID+""+d.date+""+d.parentDiff+"");c.append(e)})})});j();var k={destroy:function(){var b=c.instances.indexOf(symbollist);c.instances.splice(b,1),d--,0==d&&a.eden.root.removeGlobal(symbolChanged)}};return k},this.createVersionListDialog=function(a,b){return c.createDialog(a,b,"all")},a.views.VersionList={dialog:this.createVersionListDialog,title:"Version List",category:a.viewCategories.history,menuPriority:1},eden.root.lookup("plugins_VersionViewer_loaded").assign(!0,eden.root.scope),b()},EdenUI.plugins.VersionViewer.title="Version Viewer",EdenUI.plugins.VersionViewer.description="Show version details for a specified project.",EdenUI.plugins.VersionViewer.inlineEditorSymbol=void 0, +EdenUI.plugins.ExternalHTMLContent=function(a,b){function c(){d=!1}var d=!1,e=!1;this.createDialog=function(b,f){function g(a,b){void 0===b?n.src="plugins/external-html-content/undefined-url.html?view="+encodeURI(j):n.src="plugins/external-html-content/redirect.html?view="+encodeURI(j)+"&url="+encodeURI(b)}function h(a,b){b?(r.value()&&l.addClass("external-html-content-pinned"),p.css("display","block")):(l.removeClass("external-html-content-pinned"),p.css("display","none"))}function i(a,b){q.value()&&l.toggleClass("external-html-content-pinned",b)}e||(""==document.location.hash&&window.history.pushState({},"","#noNavigateAway"),window.addEventListener("popstate",function(){""==document.location.hash&&(d?window.history.forward(1):a.modalDialog("Leave Environment?","

          Leaving this page will discard the current script. Your work will not be saved.

          Are you sure you want to close JS-EDEN?

          ",["Close JS-EDEN","Return to Construal"],1,function(a){0==a?(doingNavigateAway=!0,window.history.back(1)):window.history.forward(1)}))}),e=!0);var j=b.slice(0,-7),k=root.lookup("createView"),l=$(''),m=root.lookup("_view_"+j+"_url"),n=l[0];g(m,m.value()),m.addJSObserver("refreshView",g);var o=$('
          ').html(l).dialog({title:f,width:600,height:450,minHeight:120,minWidth:230,dialogClass:"external-html-content"}),p=$('
          ');o.append(p);var q=root.lookup("_view_"+j+"_toolbar_visible"),r=root.lookup("_view_"+j+"_toolbar_pinned");void 0===q.value()&&q.assign(!0,root.scope,k),void 0===r.value()&&r.assign(!1,root.scope,k),h(q,q.value()),q.addJSObserver("refreshView",h),r.addJSObserver("refreshView",i);var s=$('');s.on("click",function(){r.assign(!r.value(),root.scope,Symbol.hciAgent),n.focus()}),p.append(s);var t=$('');t.on("click",function(){d||setTimeout(c,1e3),d=!0,window.history.back(1),n.focus()}),p.append(t);var u=$('');u.on("click",function(){window.history.forward(1),n.focus()}),p.append(u);var v=$('');return v.on("click",function(){g(m,m.value()),n.focus()}),p.append(v),{confirmClose:!0}},a.views.ExternalHTMLContent={dialog:this.createDialog,title:"External HTML Content",category:a.viewCategories.visualization,holdsContent:!0},a.eden.include("plugins/external-html-content/external-html-content.js-e",b)},EdenUI.plugins.ExternalHTMLContent.title="External HTML Content",EdenUI.plugins.ExternalHTMLContent.description="Allows construals to display web pages created outside of JS-EDEN.",EdenUI.plugins.HTMLContent=function(a,b){this.createDialog=function(a,b){function c(a){return"view_"+e+"_"+a}function d(a,b){k.get(0).parentNode.style.background=b}var e=a.slice(0,-7),f=[c("background_colour"),c("content")],g=$('
          ');g.on("mousedown","button",function(a){var b=a.currentTarget.name,c=a.currentTarget.getAttribute("data-value");null!==c&&null!==c.charAt(0).match(/[0-9]?/)&&(c=parseInt(c)),eden.root.lookup(b).assign(null===c||c,eden.root.scope,Symbol.hciAgent)}),g.on("mouseup","button",function(a){var b=a.currentTarget.name,c=a.currentTarget.getAttribute("data-value");null===c&&eden.root.lookup(b).assign(!1,eden.root.scope,Symbol.hciAgent)}),g.on("click",function(a){var b=a.srcElement.getAttribute("data-jseden");b&&""!=b&&(console.log(b),eden.execute2(b,{name:"execute"}))});var h=root.lookup("view_"+e+"_content"),i=function(a,b){void 0===b?g.html('
          Give view_'+e+"_content a value to display HTML formatted text here.
          "):g.html(b)};i(h,h.value()),h.addJSObserver("repaintView",i);var j=root.lookup("view_"+e+"_background_colour");j.addJSObserver("changeColour",d);var k=$('
          ').html(g).dialog({appendTo:"#jseden-views",title:b,width:600,height:450,minHeight:120,minWidth:230,classes:{"ui-dialog":"htmlviews-dialog ui-front"}}),l=j.value();return l&&d(j,l),{confirmClose:!0}},a.views.HTMLContent={dialog:this.createDialog,title:"HTML Content",category:a.viewCategories.visualization,holdsContent:!0},Eden.Selectors.execute("plugins > html > html",function(){eden.root.lookup("plugins_html_loaded").assign(!0,eden.root.scope,Symbol.localJSAgent),b&&b()})},EdenUI.plugins.HTMLContent.title="HTML Content",EdenUI.plugins.HTMLContent.description="Provides construals with the ability to create windows dedicated to displaying HTML content created using EDEN code.",EdenUI.plugins.ExpressionTree=function(a,b){var c=this;this.createDialog=function(a,b){var c='
          ';$dialog=$('
          ').html(c).dialog({title:b,width:300,height:450,minHeight:120,minWidth:230})};var d=function(a,b,c,d,e){var f=function(g,h,i){if(!g.hasOwnProperty("children"))return g.name;var j,k,l,m=g.name,n=g.children;if(b.hasOwnProperty(m)&&2==n.length){j=b[m],k=j.precedence;var o=j.associativity,p=f(n[0],k,j.text),q=f(n[1],k,j.text);if("left"==o){var r=n[1].name;n[1].hasOwnProperty("children")&&2==n[1].children.length&&b.hasOwnProperty(r)&&k==b[r].precedence&&(q="("+q+")")}else{var s=n[0].name;n[0].hasOwnProperty("children")&&2==n[0].children.length&&b.hasOwnProperty(s)&&k==b[s].precedence&&(p="("+p+")")}l=j.whitespace?p+" "+j.text+" "+q:p+j.text+q}else if(a.hasOwnProperty(m))j=a[m],k=j.precedence,l=j.text+f(n[0],k,j.text);else if(c.hasOwnProperty(m))j=c[m],k=j.precedence,l=f(n[0],k,j.text)+j.text;else if(d.hasOwnProperty(m))j=d[m],this.precedence=j.precedence,l=j.code(n,i);else{k=e;for(var t=[],u=0;u"]={precedence:6,associativity:"left",text:">=",whitespace:!0},e[">="]={precedence:6,associativity:"left",text:">",whitespace:!0},e["=~"]={precedence:6,associativity:"left",text:"=~",whitespace:!0},e["!~"]={precedence:6,associativity:"left",text:"!=",whitespace:!0},e["//"]={precedence:7,associativity:"left",text:"//",whitespace:!0},e["+"]={precedence:8,associativity:"left",text:"+",whitespace:!0},e["-"]={precedence:8,associativity:"left",text:"-",whitespace:!0},e["*"]={precedence:9,associativity:"left",text:"*",whitespace:!0},e["/"]={precedence:9,associativity:"left",text:"/",whitespace:!0},e["%"]={precedence:9,associativity:"left",text:"%",whitespace:!0},e["^"]={precedence:11,associativity:"right",text:".",whitespace:!1},e["."]={precedence:14,associativity:"left",text:".",whitespace:!1};var f={};f["-"]={precedence:10,text:"-"},f["!"]={precedence:10,text:"!"},f["&"]={precedence:10,text:"&"},f.not={precedence:10,text:"!"},f["++."]={precedence:11,text:"++"},f["--."]={precedence:11,text:"--"},f["*"]={precedence:12,text:"*"};var g={};g["#"]={precedence:11,text:"#"},g[".++"]={precedence:11,text:"++"},g[".--"]={precedence:11,text:"--"};var h={},i=13;this.convertTreeToEden=d(f,e,g,h,i),h["?"]={precedence:2,code:function(a){var b=c.convertTreeToEden(a[0]),d=c.convertTreeToEden(a[1]),e=c.convertTreeToEden(a[2]);return b+"? "+d+" : "+e}},h["`...`"]={precedence:13,code:function(a){var b=c.convertTreeToEden(a[0]);return"`"+b+"`"}},h["${{...}}$"]={precedence:13,code:function(a){var b=a[0].name;return"${{ "+b+" }}$"}},h["(...)"]={precedence:13,code:function(a){for(var b=c.convertTreeToEden(a[0]),d=[],e=1;e'+c(a)+"
          "),$dialog=$('
          ').html(code_entry).dialog({title:b,width:600,height:450,minHeight:120,minWidth:230})},a.views.SymbolLookUpTable={dialog:this.createDialog,title:"Symbol Look-Up Table",category:a.viewCategories.comprehension,menuPriority:3},this.search=function(b){var c=$("#"+b+"-regexp"),e=a.regExpFromStr(c);document.getElementById(b+"-table-div").innerHTML=d(e,b)};var c=function(a){var b="",c="
          "+b+"
          "+d(new RegExp(""),a)+"
          ";return c},d=function(a,b){var c='NameTypeDefinitionCurrent ValueWatchesUpdatesBackticksLast Modified ByJavaScript Actions';tableBodyHTML="";var d,h=[],i={};for(var j in root.symbols)if(d=root.symbols[j],a.test(j)){var k,l,m;if(void 0===d.eden_definition)l="-",k="function"==typeof d.cache.value?"Function":"Observable",m=Eden.htmlEscape(Eden.edenCodeForValue(d.cache.value));else if(l=Eden.htmlEscape(d.eden_definition),0==l.indexOf("proc")){if(Eden.isitSystemAgent(j)&&!new RegExp("\\b"+j+"\\b").test(a.source))continue;k="Agent",m=""}else if(0==l.indexOf("func")){if(Eden.isitSystemFunction(j)&&!new RegExp("\\b"+j+"\\b").test(a.source))continue;k="Function",m=""}else k="Dependency",m=Eden.htmlEscape(Eden.edenCodeForValue(d.cache.value));h.push([d,j,k,l,m]),i[j]=!0}for(var n=0;n

          '+o[1]+'

          '+o[2]+'

          '+o[3]+'

          '+o[4]+'

          '+r+'

          '+u+'

          '+v+'

          '+w+'

          '+x+"

          ";/^((_view_.*)|mousePosition|mouseView)$/.test(o[1])?tableBodyHTML+=y:tableBodyHTML=y+tableBodyHTML}return""+c+tableBodyHTML+"
          "},e=function(a,b,c){var d=[];for(var e in a){var f=e.slice(1);d.push(g(f,b,c))}return d.join(", ")},f=function(a,b,c){for(var d=[],e=0;e"+a+"
          ":""+a+""};this.addSymbolToSearch=function(b,c){var d,e=document.getElementById(b+"-regexp");d="false"==a.getOptionValue("optSimpleWildcards")?e.value+"|^"+c+"$":e.value+" "+Language.ui.search.disjunction+" "+c,e.value=d,this.search(b)},this.jump=function(a){var b=location.href;location.href="#"+a,history.replaceState(null,null,b)},b()},EdenUI.plugins.SymbolLookUpTable.title="Symbol Look-Up Table",EdenUI.plugins.SymbolLookUpTable.description="Displays detailed information about symbols.",EdenUI.plugins.SymbolLookUpTable.originalAuthor="Joe Butler";var edenfunctions={};SymbolMeta=function(a){this.symbol=a,this.interestingness=0,this.significance=.5,this.index=0,this.isinteresting=!1,this.oldstr=""},SymbolMeta.DependencyComplexityRate=.4,SymbolMeta.DependencyChangeProbability=.01,SymbolMeta.SubscriberRate=.1,SymbolMeta.DecayRate=.9999,SymbolMeta.DependencyPercentage=.5,SymbolMeta.SubscriberPercentage=.5,SymbolMeta.SigDeleteRate=.1,SymbolMeta.SigInterestingRate=1.01,SymbolMeta.prototype.dependencyInterestingness=function(a){var b=0,c=0,d=.1;for(var e in this.symbol.dependencies){b++,d+=(1-d)*SymbolMeta.DependencyComplexityRate;var f=e.substr(1);void 0!==a.meta[f]&&a.meta[f].interestingness>=a.minInteresting()&&c++}return d-=b*SymbolMeta.DependencyChangeProbability,0!=b&&(d=.5*d+.5*(c/b)),d<0?0:d},SymbolMeta.prototype.subscriberInterestingness=function(a){var b=0,c=0,d=0;for(var e in this.symbol.subscribers){b++,d+=(1-d)*SymbolMeta.SubscriberRate;var f=e.substr(1);void 0!==a.meta[f]&&a.meta[f].interestingness>=a.minInteresting()&&c++}return d=1-d,0!=b&&(d=.5*d+.5*(c/b)),d},SymbolMeta.prototype.nameInterestingness=function(){var a=this.symbol.name.substr(1);return"_"==a[0]?.5:/\d/.test(a)?.9:1},SymbolMeta.prototype.frequencyInterestingness=function(){},SymbolMeta.prototype.update=function(a){var b=0;b=this.dependencyInterestingness(a)*this.subscriberInterestingness(a)*this.nameInterestingness()*this.significance,this.interestingness=b},EdenUI.plugins.ObservableMining=function(a,b){var c=this;this.meta={},this.interesting=[],this.limitInteresting=15,this.symresults=void 0,this.symbolsui=[];var d=function(a){var b='
          ';return b};this.createDialog=function(a,b){var e=(a.slice(0,-7),$("
          "));e.html(d(a)),c.symresults=e.find(".symbolframer-results")[0],$dialog=$('
          ').html(e).dialog({title:b,width:360,height:400,minHeight:200,minWidth:200,dialogClass:"unpadded-dialog"})},this.delay=100;var e=void 0,f=function(){if(void 0!==c.symresults){var a=$(c.symresults).parent();$(c.symresults).detach();for(var b=0;b=c.minInteresting())){c.interesting.length;if(c.interesting.length==c.limitInteresting){var g=c.interesting[c.interesting.length-1];g.isinteresting=!1,c.interesting.pop()}c.interesting.push(e),e.isinteresting=!0,e.significance*=SymbolMeta.SigInterestingRate,c.interesting.sort(function(a,b){return b.interestingness-a.interestingness})}}},a.eden.root.addGlobal(e),a.views.ObservableMining={dialog:this.createDialog,title:"Observable Mining",category:a.viewCategories.comprehension,menuPriority:1},$(document).tooltip(),b()},EdenUI.plugins.ObservableMining.prototype.minInteresting=function(){return this.interesting.length>0?this.interesting[this.interesting.length-1].interestingness:0},EdenUI.plugins.ObservableMining.prototype.maxInteresting=function(){return this.interesting.length>0?this.interesting[0].interestingness:0},EdenUI.plugins.ObservableMining.title="Observable Mining",EdenUI.plugins.ObservableMining.description="Automatically generate search for interesting observables",EdenUI.plugins.ObservableMining.Symbol=function(){this.symbol=void 0,this.name=void 0,this.meta=void 0,this.element=$('
          '),this.details=void 0,this.update=void 0,this.outofdate=!1,this.dodelete=!1,this.symbolChanged=void 0,this.editing=!1,this.update=this.updateObservable;var a=this;this.element.hover(function(){$(this).animate({backgroundColor:"#eaeaea"},100)},function(){$(this).animate({backgroundColor:"#fafafa"},100),1==a.editing&&(a.editing=!1,a.element.find("textarea").remove(),a.element.animate({height:"20px"},"fast"))}).click(function(){if(!a.editing){var b;b="function"==typeof a.symbol.value()&&void 0!==a.symbol.eden_definition?a.symbol.eden_definition:a.symbol.definition?a.symbol.eden_definition+";":a.name+" = "+Eden.edenCodeForValue(a.symbol.value())+";",a.element.animate({height:"60px"},{duration:200,complete:function(){var c=$('');c.val(b),c.appendTo(a.element),c.show("fast")}}),a.editing=!0}}).draggable({distance:40,axis:"x",scroll:!1,drag:function(b,c){c.position.left>150?a.dodelete=!0:a.dodelete=!1},revert:function(b,c){return!a.dodelete},stop:function(b,c){a.dodelete&&(a.meta.significance*=SymbolMeta.SigDeleteRate,a.symbolChanged(a.symbol,!1),a.element.hide("drop",{direction:"right"},"slow",function(){a.element.remove()}))}})},EdenUI.plugins.ObservableMining.Symbol.prototype.updateObservable=function(a,b){if(void 0!==this.symbol){0==b&&(b=1);var c,d=(this.meta.interestingness-a)*(1/(b-a)),e=Math.round(8+12*d),f=this.symbol.value(),g=_formatFramerVal(f);c=void 0!==this.symbol.definition?""+this.name+"":this.name;var h=""+c+" = "+g+"";if(void 0!==this.symbol.definition){var i=Eden.htmlEscape(this.symbol.eden_definition,!1,!0);i=Eden.htmlEscape("
          "+i+";
          "),h=""+h+""}var j=this.element.find(".observable");j.html(h),j.css({"font-size":e+"px"})}},EdenUI.plugins.ObservablePalette=function(a,b){function c(a){var b=a.value();return"function"!=typeof b||!/\breturn\s+([^\/;]|(\/[^\/*]))/.test(b.toString())}function d(a,b){var d=a.term,e=i[d];if(void 0===e){var f=new RegExp("^"+d);e=[];for(var g in root.symbols)f.test(g)&&c(root.symbols[g])&&e.push(g);i[d]=e}b(e)}function e(){var a=h;return h++,a}function f(b,c,d,g,h,i){function j(a){var b=a.target.value;if("hide"==b)return void h.remove(c,g,d);var e;"boolean"==b?e=!1:"number"==b?e=0:"string"==b&&(e=""),o.assign(e,Symbol.hciAgent,!0)}function k(a){pa.fadeOut(250,"linear",function(){a?(pa.html("true"),pa.css("color","green")):(pa.html("false"),pa.css("color","red")),pa.fadeIn(400,"swing",function(){y.html(a?"true":"false")})})}var l=128;g?(g.hasClass("ui-accordion")&&g.accordion("destroy"),g.html("")):(g=$('
          '),i&&g.data("editor","read-only"));var m,n=a.eden.root,o=n.lookup(c),p=o.value(),q=typeof p,r="string"==q,s=!i||r,t=o.eden_definition;if(!i&&void 0!==o.eden_definition){var u=t.match(/^\S+\s+is\s+(.*?);?$/);rhs=u[1],q="definition"}var v=$('

          '+c+"

          ");i&&g.addClass("observable-palette-dependency-value-box");var w=$('
          ');v.append(w),g.append(v);var x=Eden.prettyPrintValue("",p,l,!1,!1),y=$(""+x+"");w.append(y);var z=$("");i?z.append('"):(z.append(''),z.append(''),z.append(''),z.append('')),z.append(''),z[0].value=q,z.on("change",j),w.on("click",function(a){a.stopPropagation()}),y.on("click",function(a){y.detach(),w.append(z),z.focus()}),z.on("blur",function(a){z.detach(),w.append(y)});var A=$("
          ");if("definition"==q){var B=$('
          ');B.append(c+" is "),rhsSpan=$(''),rhsSpan.append(Eden.htmlEscape(rhs)),B.append(rhsSpan),B.append(";"),B.on("click",function(a){rhsSpan.focus(),B.addClass("focussed")}),rhsSpan.on("blur",function(a){B.removeClass("focussed")}),A.append(B);var C=$('
          ');A.append(C);var D=$('Expand');D.click(function(){H.find(".observable-palette-obs-box.ui-accordion").accordion("option","active",0)});var E=$('Collapse');E.click(function(){H.find(".observable-palette-obs-box.ui-accordion").accordion("option","active",!1)});var F=$('Hide');F.click(function(){var a=H.find(".observable-palette-obs-box");a.removeClass("observable-palette-visible"),a.slideUp()});var G=$('Show');G.click(function(){var a=H.find(".observable-palette-obs-box");a.addClass("observable-palette-visible"),a.slideDown()}),C.append(D),C.append(E),C.append(F),C.append(G);var H=$('
          ');H.sortable({connectWith:".observable-palette-column",forcePlaceholderSize:!0,handle:"h3",items:">.observable-palette-obs-box",placeholder:"observable-palette-drag-placeholder",tolerance:"pointer",receive:function(a,b){var d=b.item,e=d.data("observable");(!o.isDependentOn("/"+e)||e==c&&"read-only"!=d.data("editor"))&&b.sender.sortable("cancel"),2==H.children(".observable-palette-visible").length&&C.slideDown(),h.removeDuplicates(a.target,d)},remove:function(a,b){H.children(".observable-palette-visible").length<2&&C.slideUp()}});var I,J=0;for(var K in o.dependencies){var L=o.dependencies[K];K=K.slice(1),void 0===L.eden_definition&&(I=f(b,K,e(),void 0,h,!1), +h.register(K,I),H.append(I),J++)}if(J<2&&C.hide(),m=function(a,e){var i=a.eden_definition;void 0===i?f(b,c,d,g,h,!1):y.html(Eden.prettyPrintValue("",e,l,!1,!1))},A.append(H),r){var M=f(b,c,e(),void 0,h,!0);H.append(M)}}else if("number"==q){var N,O,P;if(P=1==p||p==-1||p!=Math.floor(p)?5e-4:1,0==p)N=0,O=10;else if(p>=-1&&p<=1)N=p>0?0:-1,O=1;else if(p<0){N=2*p;var Q=Number((-p%P).toPrecision(14));0!=Q&&Q!=P&&(N=N+Q-P),O=N+2*(p-N)}else N=0,O=2*Math.ceil((p/P).toPrecision(16))*P;var R=$(''),S=R[0];R.on("input",function(a){o.assign(parseFloat(S.value),Symbol.hciAgent,!0)});var T=$('
          '),U=$("");T.append(U);var V=$('');V.append(R),U.append(V);var W=$('');T.append(W);var X=$(''),Y=$(''),Z=Y[0];X.append(Y),W.append(X),Y.on("input",function(a){var b=a.target.value;if(""!=b){var c=parseFloat(b);S.min=b;var d=o.value();c>=0&&d0?c+Math.ceil((c/e).toPrecision(16))*e:Math.ceil((c/2/e).toPrecision(16))*e,f');W.append(ca);var da=$('
          ');ca.append(da);var ea=$('');da.append(ea);var fa=$(''),ga=fa[0];ea.append(fa),fa.on("input",function(a){var b=a.target.value;""!=b&&(S.value=b,o.assign(parseFloat(b),Symbol.hciAgent,!0))}),fa.on("focus",function(a){ba=!0,aa=a.target.value}),fa.on("blur",function(a){var b=a.target.value;if(""==b)o.assign(parseFloat(aa),Symbol.hciAgent,!0);else{var c=o.value(),d=parseFloat(S.min);c'),ia=$(''),ja=ia[0];ha.append(ia),W.append(ha),ia.on("input",function(a){S.max=a.target.value});var ka=$('');da.append(ka);var la=$(''),ma=la[0];ma.acceptedValue=P,ka.append(la),la.on("input",function(a){var b=parseFloat(ma.value);if(b>0){var c,d=Math.floor(b);if(b==d){var e=String(b).match(/(0*)$/);c=Math.pow(10,e[1].length)}else c=Math.pow(10,-((b-d).toPrecision(15).replace(/0*$/,"").length-2));b==c&&b0?(j=Math.ceil(e/2/p)*p-p,m=Number((e%p).toPrecision(14)),0!=m&&m!=p&&(j+=m)):(j=2*e,m=Number((-e%p).toPrecision(14)),0!=m&&m!=p&&(j=j+m-p)),S.min=j,Z.value=j,k=j+Math.round((o-j)/p)*p,S.max=k,ja.value=k):e>o&&(k=n+2*Math.ceil(((e-n)/p).toPrecision(16))*p,S.max=k,ja.value=k),S.value=e,ga.value=e}},A.append(T)}else if("boolean"==q){var na=$(''),oa=na[0],pa=$('');na.on("change",function(a){var b=oa.checked;o.assign(b,o.hciAgent,!0)}),m=function(a,e){e!==!0&&e!==!1||void 0!==a.eden_definition?f(b,c,d,g,h,i):(oa.checked=e,k(e))},k(p);var qa=$('');qa.append(na),qa.append(pa),A.append(qa)}else if("string"==q){var ra=$('"),sa=ra[0];ra.on("input",function(a){var b=sa.value;o.assign(b,Symbol.hciAgent,!0),sa.style.height="",sa.style.height=String(sa.scrollHeight+4)+"px"}),m=function(a,e){"string"!=typeof e||void 0!==a.eden_definition?f(b,c,d,g,h,i):(sa.value=e,sa.rows=e.split("\n").length,y.html(Eden.prettyPrintValue("",e,l,!1,!1)))},A.append($('
          ')),A.append(ra),A.append($('
          '))}else if("undefined"==q){if(A.append($('

          '+c+" is currently undefined.

          ")),!i){var ta=z.clone();ta[0].value="undefined",ta.on("change",j);var ua=$("");ua.append(ta);var va=$("
          ");va.append(ua),A.append(va)}m=function(a,e){void 0===e&&void 0===a.eden_definition||f(b,c,d,g,h,i)}}else m=function(a,e){void 0===e&&void 0===a.eden_definition||f(b,c,d,g,h,i)};return o.addJSObserver(b+"/"+c+"/"+d,m),s?(i&&A.find("input, textarea").attr("readonly","readonly"),g.append(A),g.accordion({active:"undefined"!=q&&void 0,collapsible:!0,heightStyle:"content"})):v.addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all observable-palette-static-header"),g.removeFromDialog=function(){h.remove(c,g,d)},g}function g(a,b){a.target.style.minWidth=b.size.width+"px"}var h=0,i={};root.addGlobal(function(a,b,d){if(d&&c(b)){var e=b.name.slice(1);for(var f in i)new RegExp("^"+f).test(e)&&i[f].push(e)}}),this.createDialog=function(b,c){function h(a,b){for(var c=b.data("observable"),d=b[0],e=p[c],f=0;f'),p={},q=$(''),r=q[0];q.on("keyup",function(a){13==a.which&&(j(r.value,0,!1),r.value="")}),q.autocomplete({minLength:2,source:d});var s=$('');s.click(function(){j(r.value,0,!1),r.value=""});var t=$('');t.on("click",function(a){l(r.value),r.value=""});var u=$(""),v=$(''),w=v[0];u.append(v),u.append(" Advanced");var x=root.lookup("_view_"+m+"_advanced"),y=x.value();void 0===y?(x.assign(!1,n),o.addClass("observable-palette-no-advanced")):y||o.addClass("observable-palette-no-advanced"),x.addJSObserver("repaintView",function(a,b){o.toggleClass("observable-palette-no-advanced",!b),w.checked=b}),v.on("change",function(a){x.assign(a.target.checked,n)});var z=$('
          ');z.append(q),z.append(s),z.append(t),z.append(u);var A=[],B=7,C=root.lookup("_view_"+m+"_observables"),D=C.value();Array.isArray(D)&&(D.length>0&&!Array.isArray(D[0])&&(D=[D]),D.length>B&&(B=D.length));for(var E=0;E');F.sortable({connectWith:".observable-palette-column, .observable-palette-dependencies",forcePlaceholderSize:!0,handle:"h3",items:">.observable-palette-obs-box",placeholder:"observable-palette-drag-placeholder",scroll:!1,tolerance:"pointer",receive:function(a,b){var c=a.target,d=b.item;h(c,d)}}),E')),e=($("
          "),$('
          '),$('
          '),$('
          '));d.append(e);var f=$('');d.append(f);var g={};e.on("click",".scriptgen-importex",function(a){var b=a.currentTarget.getAttribute("data-agent");g[b]?g[b]=!1:g[b]=!0,h()});var h=function(){e.html("");for(var a=c.generateScriptLines(g),b=0;b '+f[1]+"";if(f.length>2)for(var i=2;i'+(g[d]?"":"")+""+(g[d]?'## '+a.imports[b]+"":h)+"");e.append(j)}e.append($('
          '));var k=$("
          ");e.append(k);var l=a.definitions.join("\n")+"\n## When agents\n\n"+a.agents,m=new Eden.AST(l,(void 0),{name:"*JavaScript"}),n=new EdenUI.Highlight(k.get(0));n.highlight(m,-1,-1)};f.click(function(){h()}),h(),$('
          ').html(d).dialog({appendTo:"#jseden-views",title:b,width:790,height:700,minHeight:120,minWidth:230,dialogClass:"scriptgen-dialog"})};this.generateScriptLines=function(a){var b={},c=Eden.Generator.importsScript().split("\n");b.imports=c;var d=Eden.Generator.symbolScript(a).split("\n");b.definitions=d;var e=Eden.Agent.getActiveAgents(a,!1);return b.agents=e,b},this.baseConstrualSymbols={},this.changeListener=function(a,b){var d=a.last_modified_by;if(!b&&"include"!=d){var e=a.name.slice(1);void 0!==a.eden_definition&&void 0!==a.definition?c.baseConstrualSymbols[e]={eden_definition:a.eden_definition,last_modified_by:d}:c.baseConstrualSymbols[e]={cached_value:a.cached_value,last_modified_by:d}}},a.eden.listenTo("executeError",EdenUI.plugins.ScriptGenerator,function(a,b){root.removeGlobal(c.changeListener)}),this.baseConstrualURL="",a.views.ScriptGenerator={dialog:this.createDialog,title:"Script Generator",category:a.viewCategories.history},b()},EdenUI.plugins.ScriptGenerator.title="Script Generator",EdenUI.plugins.ScriptGenerator.description="Generates a definitional script that can be used to recreate the current state of the environment at a later time.",EdenUI.plugins.ScriptGenerator.originalAuthor="Joe Butler",EdenUI.plugins.ScriptGenerator.loadBaseConstrual=function(a){"ScriptGenerator"in edenUI.plugins&&root.addGlobal(edenUI.plugins.ScriptGenerator.changeListener),eden.include(a,"",{name:Symbol.getInputAgentName()},function(){"ScriptGenerator"in edenUI.plugins&&(root.removeGlobal(edenUI.plugins.ScriptGenerator.changeListener),edenUI.plugins.ScriptGenerator.baseConstrualURL=a)})},function(){"use strict";var a,b=this;a="undefined"!=typeof exports?exports:b.Springy={};var c=a.Graph=function(){this.nodeSet={},this.nodes=[],this.edges=[],this.adjacency={},this.nextNodeId=0,this.nextEdgeId=0,this.eventListeners=[]},d=a.Node=function(a,b){this.id=a,this.data=void 0!==b?b:{}},e=a.Edge=function(a,b,c,d){this.id=a,this.source=b,this.target=c,this.data=void 0!==d?d:{}};c.prototype.addNode=function(a){return a.id in this.nodeSet||this.nodes.push(a),this.nodeSet[a.id]=a,this.notify(),a},c.prototype.addNodes=function(){for(var a=0;a=0;b--)this.nodes[b].id===a.id&&this.nodes.splice(b,1);this.detachNode(a)},c.prototype.detachNode=function(a){var b=this.edges.slice();b.forEach(function(b){try{b.source.id!==a.id&&b.target.id!==a.id||this.removeEdge(b)}catch(c){}},this),this.notify()},c.prototype.removeEdge=function(a){for(var b=this.edges.length-1;b>=0;b--)this.edges[b].id===a.id&&this.edges.splice(b,1);for(var c in this.adjacency){for(var d in this.adjacency[c]){for(var e=this.adjacency[c][d],f=e.length-1;f>=0;f--)this.adjacency[c][d][f].id===a.id&&this.adjacency[c][d].splice(f,1);0==this.adjacency[c][d].length&&delete this.adjacency[c][d]}j(this.adjacency[c])&&delete this.adjacency[c]}this.notify()},c.prototype.merge=function(a){var b=[];a.nodes.forEach(function(a){b.push(this.addNode(new d(a.id,a.data)))},this),a.edges.forEach(function(a){var c=b[a.from],d=b[a.to],f=a.directed?f=a.type+"-"+c.id+"-"+d.id:c.idb.x&&(b.x=d.p.x),d.p.y>b.y&&(b.y=d.p.y)});var c=b.subtract(a).multiply(.07);return{bottomleft:a.subtract(c),topright:b.add(c)}};var h=a.Vector=function(a,b){this.x=a,this.y=b};h.random=function(){return new h(10*(Math.random()-.5),10*(Math.random()-.5))},h.prototype.add=function(a){return new h(this.x+a.x,this.y+a.y)},h.prototype.subtract=function(a){return new h(this.x-a.x,this.y-a.y)},h.prototype.multiply=function(a){return new h(this.x*a,this.y*a)},h.prototype.divide=function(a){return new h(this.x/a||0,this.y/a||0)},h.prototype.magnitude=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},h.prototype.normal=function(){return new h((-this.y),this.x)},h.prototype.normalise=function(){return this.divide(this.magnitude())},f.ForceDirected.Point=function(a,b){this.p=a,this.m=b,this.v=new h(0,0),this.a=new h(0,0)},f.ForceDirected.Point.prototype.applyForce=function(a){this.a=this.a.add(a.divide(this.m))},f.ForceDirected.Spring=function(a,b,c,d){this.point1=a,this.point2=b,this.length=c,this.k=d};var i=a.Renderer=function(a,b,c,d){this.layout=a,this.clear=b,this.drawEdge=c,this.drawNode=d,this.layout.graph.addGraphListener(this)};i.prototype.graphChanged=function(a){this.start()},i.prototype.start=function(){var a=this;this.layout.start(function(){a.clear(),a.layout.eachEdge(function(b,c){a.drawEdge(b,c.point1.p,c.point2.p)}),a.layout.eachNode(function(b,c){a.drawNode(b,c.p)})})},i.prototype.stop=function(){this.layout.stop()},Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("[object Function]"!={}.toString.call(a))throw new TypeError(a+" is not a function");for(b&&(c=b),d=0;d1||g<0||g>1)&&new Springy.Vector(a.x+f*(b.x-a.x),a.y+f*(b.y-a.y))}function c(a,c,d,e,f){var g,h={x:d.x,y:d.y},i={x:d.x+e,y:d.y},j={x:d.x,y:d.y+f},k={x:d.x+e,y:d.y+f};return(g=b(a,c,h,i))?g:(g=b(a,c,i,k))?g:(g=b(a,c,k,j))?g:!!(g=b(a,c,j,h))&&g}var d=this.graph=a.graph||new Springy.Graph,e=a.stiffness||100,f=a.repulsion||5e3,g=a.damping||.5,h=a.nodeSelected||null,i=this[0],j=i.getContext("2d"),k=this.layout=new Springy.Layout.ForceDirected(d,e,f,g),l=k.getBoundingBox(),m={bottomleft:new Springy.Vector((-2),(-2)),topright:new Springy.Vector(2,2)};Springy.requestAnimationFrame(function a(){m=k.getBoundingBox(),l={bottomleft:l.bottomleft.add(m.bottomleft.subtract(l.bottomleft).divide(10)),topright:l.topright.add(m.topright.subtract(l.topright).divide(10))},Springy.requestAnimationFrame(a)});var n=function(a){var b=l.topright.subtract(l.bottomleft),c=a.subtract(l.bottomleft).divide(b.x).x*i.width,d=a.subtract(l.bottomleft).divide(b.y).y*i.height;return new Springy.Vector(c,d)},o=function(a){var b=l.topright.subtract(l.bottomleft),c=a.x/i.width*b.x+l.bottomleft.x,d=a.y/i.height*b.y+l.bottomleft.y;return new Springy.Vector(c,d)},p=null,q=null,r=null;jQuery(i).mousedown(function(a){var b=jQuery(this).offset(),c=o({x:a.pageX-b.left,y:a.pageY-b.top});p=q=r=k.nearest(c),null!==p.node&&(r.point.m=1e4,h&&h(p.node)),s.start()}),jQuery(i).dblclick(function(a){var b=jQuery(this).offset(),c=o({x:a.pageX-b.left,y:a.pageY-b.top});p=k.nearest(c),node=p.node,node&&node.data&&node.data.ondoubleclick&&node.data.ondoubleclick()}),jQuery(i).mousemove(function(a){var b=jQuery(this).offset(),c=o({x:a.pageX-b.left,y:a.pageY-b.top});q=k.nearest(c),null!==r&&null!==r.node&&(r.point.p.x=c.x,r.point.p.y=c.y),s.start()}),jQuery(window).bind("mouseup",function(a){r=null}),Springy.Node.prototype.getWidth=function(){var a=void 0!==this.data.label?this.data.label:this.id;if(this._width&&this._width[a])return this._width[a];j.save(),j.font="16px Verdana, sans-serif";var b=j.measureText(a).width+10;return j.restore(),this._width||(this._width={}),this._width[a]=b,b},Springy.Node.prototype.getHeight=function(){return 20};var s=this.renderer=new Springy.Renderer(k,function(){var a=i.parentNode;null!==a&&(i.height=a.clientHeight,i.width=a.clientWidth),j.clearRect(0,0,i.width,i.height)},function(a,b,e){for(var f=n(b).x,g=n(b).y,h=n(e).x,i=n(e).y,k=new Springy.Vector(h-f,i-g),l=k.normal().normalise(),m=d.getEdges(a.source,a.target),o=d.getEdges(a.target,a.source),p=m.length+o.length,q=0,r=0;r'),h=$("").springy({graph:f,nodeSelected:function(a){}});g.append(h);var i=$('
          ');g.append(i);var j=$(''),k=j.get(0),l=$(''),m=l.get(0);i.append(j),i.append($("").append(l)),j.on("input",e),l.on("change",e),g.on("mouseenter",e),g.dialog({appendTo:"#jseden-views",title:d,width:600,height:450,minHeight:120,minWidth:230,dialogClass:"dependency-map-dialog"})},this.updateGraph=function(a,b){a.re=b,a.newNodes=[],a.newEdges=[];for(var c in root.symbols){var d=root.symbols[c],e=d.name;if(b.test(e)){a.newNodes.indexOf(e)==-1&&a.newNodes.push(e);var f=d.dependencies;for(var g in f){var h=f[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([h,e,!1])}f=d.dynamicDependencies;for(var g in f){var h=f[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([h,e,!0])}f=d.observees;for(var g in f){var h=f[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([h,e,!1])}var i=d.subscribers;for(var g in i){var j=i[g],h=j.name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h);var k=d.name in j.dynamicDependencies;a.newEdges.push([e,h,k])}i=d.observers;for(var g in i){var h=i[g].name;a.newNodes.indexOf(h)==-1&&a.newNodes.push(h),a.newEdges.push([e,h,!1])}}}if(!arrayCompare(a.previousNodes,a.newNodes)||!arrayCompare(a.previousEdges,a.newEdges)){a.previousNodes=a.newNodes,a.previousEdges=a.newEdges,a.filterEdges(function(a){return!1}),a.filterNodes(function(a){return!1}),a.nodeObjectsStore={};for(var c in a.previousNodes){var l=a.previousNodes[c];a.nodeObjectsStore[l]=a.newNode({label:l},{color:"#6A4A3C"})}for(var g in a.previousEdges){var m=a.previousEdges[g][0],n=a.previousEdges[g][1],o={};a.previousEdges[g][2]&&(o.dashes=[10,10]),a.newEdge(a.nodeObjectsStore[m],a.nodeObjectsStore[n],o)}}},a.views.DependencyMap={dialog:this.createDialog,title:"Dependency Map",category:a.viewCategories.comprehension,menuPriority:2},b()},EdenUI.plugins.DependencyMap.title="Dependency Map",EdenUI.plugins.DependencyMap.description="Displays a diagram showing the relationships between observables.",EdenUI.plugins.DependencyMap.author="Joe Butler",EdenUI.plugins.StateTimeLine=function(a,b){var c=this;this.createDialog=function(b,e){c.ignoreRE=new RegExp("((_view.*)|(_View.*)|(_status)|(mouse.*)|(picture))"),code_entry=$('
          ').append($('')).append($('').click(function(){c.ST.states.push(d("partial"));var e=document.getElementById(b+"-regex").value;""==e&&(e="State "+c.ST.nextBlankState),$("#"+b+"-content-states").append("
          "+e+": Restore "+(new Date).toLocaleTimeString()+" Delete
          "),document.getElementById(b+"-regex").value="",a.plugins.StateTimeLine.ST.nextBlankState++})).append($('
          ')),$dialog=$('
          ').html(code_entry).dialog({title:e,width:300,height:450,minHeight:120,minWidth:230})},c.ST={},c.ST.states=[],c.ST.nextBlankState=0,this.deleteState=function(a){$(document.getElementById("stdiv"+a)).remove()},this.changeState=function(b){for(var c in root.symbols)Eden.isitSystemSymbol(root.symbols[c].name.substring(1,root.symbols[c].name.length))||a.plugins.StateTimeLine.ignoreRE.test(root.symbols[c].name.substring(1,root.symbols[c].name.length))||delete root.symbols[c];a.plugins.ScriptInput.submitEdenCode(a.plugins.StateTimeLine.ST.states[b])};var d=function(b){var c=[],d=[],e=[],f=[],g="autocalc = 1;",h="autocalc = 0;",i=root.lookup("picture").eden_definition;void 0==i?i="picture is [];":i+=";";for(var j in root.symbols){var k="@",l="",m=5,n=root.symbols[j],o=n.eden_definition;if(void 0==o&&(o=k),0==o.indexOf("proc")){if(l="(Action)",m=2,"partial"==b&&Eden.isitSystemAgent(j))continue}else if(0==o.indexOf("func")){if(l="(Function)",m=1,"partial"==b&&Eden.isitSystemFunction(j))continue}else if(l="(Observable)",m=0,"partial"==b&&Eden.isitSystemObservable(j))continue;var p=Eden.edenCodeForValue(n.cached_value);if(!a.plugins.StateTimeLine.ignoreRE.test(j))if(1==m)f.push(o);else if(0==m){if(p==k&&o==k)continue;o==k?d.push(j+" = "+p+";"):c.push(o+";")}else 2==m?e.push(o):console.log("oh dear error")}var q=[];q.push(h);for(var r=0;r

          ';return $dialog=$('
          ').html(e).dialog({title:c,width:300,height:450,minHeight:120,minWidth:230}),$("#connectBtn").click(function(){function b(b){var c=a.eden.root,d=c.lookup("definitionOf").definition(c)(b);e.send(d)}if(window.WebSocket=window.WebSocket||window.MozWebSocket, +!window.WebSocket)return void console.log("WebSockets not supported");var c="ws://"+$("#sl-ipaddr").val()+":"+$("#sl-port").val()+"/",e=new WebSocket(c);eden.listenTo("executeBegin",this,function(a,b){"net"!=a&&e.send(b)}),eden.listenTo("beforeAssign",this,function(a,b,c){"net"!=c&&e.send(a.name.slice(1)+"="+Eden.edenCodeForValue(b)+";")}),$("#sl-status").html("

          Connected to: "+c+"

          "),e.onerror=function(a){$("#sl-status").html("

          Error connecting to server - please verify server is running at "+c+". For usage instructions please read the comments in the state-listener-server.js file.

          "),d.confirmClose=!1},e.onmessage=function(a){$("#sl-status").html("

          Received: "+Eden.htmlEscape(a.data)+"

          "),eden.execute(a.data,"net","",{name:"/execute"},noop)},e.onopen=function(){d.confirmClose=!0,randomSeedSym=a.eden.root.lookup("randomSeed"),randomSeed=randomSeedSym.value(),void 0===randomSeed?randomSeedSym.assign((new Date).getTime(),eden.root.scope,void 0,!0):b("randomSeed"),b("randomGenerator")}}),d},a.views.StateListener={dialog:this.createDialog,title:"State Listener",category:a.viewCategories.extension},a.eden.include("plugins/state-listener/state-listener.js-e",b)},EdenUI.plugins.StateListener.title="State Listener",EdenUI.plugins.StateListener.description="Provides the ability to synchronize observables over the internet.",EdenUI.plugins.StateListener.author="Jonny Foss",EdenUI.plugins.NetworkRemote=function(a,b){function c(){h=!1,$("#connectBtn").attr("value","Connect"),$("#nr-ipaddr").removeAttr("disabled"),$("#nr-port").removeAttr("disabled"),$("#nr-key").removeAttr("disabled")}function d(){eden.root.lookup("network_address").assign($("#nr-ipaddr").val(),eden.root.scope),eden.root.lookup("network_port").assign($("#nr-port").val(),eden.root.scope),eden.root.lookup("network_key").assign($("#nr-key").val(),eden.root.scope),f.connect()}var e,f=this,g=!1,h=!1;Eden.Agent.importAgent("lib/dynamic","default",void 0,function(){}),f.connect=function(){function b(b){var c=a.eden.root,d=c.lookup("definitionOf").definition(c)(b);j.send(JSON.stringify({code:d}))}var c=eden.root.lookup("network_address").value(),d=eden.root.lookup("network_port").value(),g=eden.root.lookup("network_key").value();if(window.WebSocket=window.WebSocket||window.MozWebSocket,!window.WebSocket)return void console.log("WebSockets not supported");var i="ws://"+c+":"+d+"/",j=new WebSocket(i);Eden.Agent.listenTo("executeline",this,function(a,b){if(a){var c=JSON.stringify({action:"executeline",name:a.name,lineno:b});j.send(c)}}),Eden.Agent.listenTo("patch",this,function(a,b,c){if(a){var d=JSON.stringify({action:"patch",name:a.name,patch:b,lineno:c});j.send(d)}}),Eden.Agent.listenTo("owned",this,function(a,b){"net"!=b&&j.send(JSON.stringify({action:"ownership",name:a.name,owned:a.owned}))}),eden.listenTo("beforeAssign",this,function(a,b,c){"net"!=c&&(console.log("ASSIGN: "+a.name+" = "+Eden.edenCodeForValue(b)),j.send(JSON.stringify({action:"assign",symbol:a.name.slice(1),value:b})))}),$("#nr-status").html("

          Connected to: "+i+"

          "),j.onopen=function(c){j.send(g),randomSeedSym=a.eden.root.lookup("randomSeed"),randomSeed=randomSeedSym.value(),void 0===randomSeed?randomSeedSym.assign((new Date).getTime(),eden.root.scope,void 0,!0):b("randomSeed"),b("randomGenerator"),h=!0;for(var d in Eden.Agent.agents)Eden.Agent.agents[d].owned&&j.send(JSON.stringify({action:"ownership",name:d,owned:!0}));eden.root.lookup("network_connected").assign(!0,eden.root.scope)},j.onerror=function(a){h=!1,eden.root.lookup("network_connected").assign(!1,eden.root.scope),eden.root.lookup("network_error").assign(a,eden.root.scope)},j.onclose=function(){eden.root.lookup("network_connected").assign(!1,eden.root.scope)},f.sendControl=function(a,b){console.log("Send Control: "+a+"= "+b),console.log(b),j.send(JSON.stringify({action:"control",key:a,value:b}))},f.sendAssign=function(a){"net"!=a.last_modified_by&&j.send(JSON.stringify({action:"assign",symbol:a.name.slice(1),value:a.value()}))},j.onmessage=function(a){e=JSON.parse(a.data);for(var b=0;b

          ';return $dialog=$('
          ').html(f).dialog({title:b,width:300,height:450,minHeight:120,minWidth:230}),$("#connectBtn").click(function(){h?c():d()}),e},this.playCode=function(a){if(void 0===e[a])return void $("#nr-status").html("

          Replay finished

          ");var b=e[a].time/$("#nr-speedrange").val();b>1e3?($("#nr-status").html("

          Next line in "+b+" milliseconds

          "),g=!0):g&&$("#nr-status").html("

          Replaying...

          "),setTimeout(function(){eden.execute(e[a].code,"net","",{name:"/execute"},noop),f.playCode(a+1)},b)},a.views.NetworkRemote={dialog:this.createDialog,title:"Network Remote",category:a.viewCategories.extension},a.eden.include("plugins/network-remote/network-remote.js-e",b),eden.root.lookup("plugins_network_loaded").assign(!0,eden.root.scope)},EdenUI.plugins.NetworkRemote.title="Network Remote",EdenUI.plugins.NetworkRemote.description="Method of syncronizing observables via TCP, and playing back scripts",EdenUI.plugins.NetworkRemote.author="Jonny Foss",EdenUI.plugins.WindowLayoutTool=function(a,b){var c="";$.getScript("plugins/view-layout/gridster/jquery.gridster.min.js");var d=$("");$("head").append(d);var d=$("");$("head").append(d),this.name="window_name",this.createDialog=function(b,d){""==c&&(c=b);var e=[];viewlayoutstr="View Layout";var f=5*a.gridSizeY,g=3*a.gridSizeX,h=[],i=root.lookup("_views_list").value(),j=this.name;i.forEach(function(b){if(b!=j){var c=root.lookup("_view_"+b+"_x").value(),d=root.lookup("_view_"+b+"_y").value();c="undefined"!=typeof c?c:0,d="undefined"!=typeof d?d:0,h=[b,c,d,root.lookup("_view_"+b+"_width").value()+a.scrollBarSize,root.lookup("_view_"+b+"_height").value()+a.titleBarHeight,root.lookup("_view_"+b+"_title").value()],console.log(h),e.push(h)}});var k="";e.forEach(function(a,b){k+='
        1. '+a[5]+" ["+a[0]+"]
        2. "});var l='Update
            '+k+"
          ";$dialog=$('
          ').html(l).dialog({title:d,width:$(window).width()/2,height:$(window).height()/2,minHeight:120,minWidth:230}),gridster=$(".gridster ul").gridster({widget_base_dimensions:[g,f],widget_margins:[0,0],min_cols:Math.round($(window).width()/g),max_cols:Math.round($(window).width()/g),helper:"clone",resize:{enabled:!0},serialize_params:function(a,b){return{col:b.col,row:b.row,size_x:b.size_x,size_y:b.size_y,name:b.name,name:$(b.el.context).attr("data-name")}}}).data("gridster"),$(".vl-update").click(function(){var b=gridster.serialize(),c=1,d=1;b.forEach(function(a,b){a.col "+this.actions},d.prototype.toString=function(){return this.name+"("+this.parameters.join(",")+")\nDefinitions:\n"+this.definitions+"\nActions:\n"+this.actionsArr};var g=function(a,b){for(var d=new Array,e=0;e");if(2==g.length){var h="this_g"+d.length;d.push(new c(h,g[0],g[1]))}}return d},h=function(a){var b,c=new Array;a.split("(").length<2?b=a:(c=a.split("(")[1].split(")")[0].split(","),b=a.split("(")[0]);var d=document.getElementById("adm-definitions"),e=[];d.value.length>0&&(e=d.value.split("\n"));var d=document.getElementById("adm-actions"),f=d.value.split("\n"),h=g(b,f);return F(b,c,e,h),0},i=function(){for(var a=document.getElementById("adm-name"),b=a.value.split("(")[0],c=!0,d=0;d=f.templates.length&&(a=-1),a==-1)document.getElementById("adm-name").value="",document.getElementById("adm-definitions").value="",document.getElementById("adm-actions").value="";else{var b=f.templates[a];document.getElementById("adm-name").value=b.name,document.getElementById("adm-definitions").value=b.definitions.join("\n"),document.getElementById("adm-actions").value=b.actionsArr.join("\n")}f.currIndex=a},k=function(a){a>-1&&(alert("Deleting template "+f.templates[a].name),f.templates.splice(a),f.currIndex=a-1,j(f.currIndex))},l=function(a){return'
          \t\t\t
          Name:
          \t\t\t
          \t\t\t
          Definitions:
          \t\t\t
          \t\t\t
          Actions:
          \t\t\t
          \t\t
          \t\t
          \t\t\t
          \t\t
          '};this.createTemplateCreator=function(a,b){var c=$("
          ");c.html(l(a)),$dialog=$('
          ').html(c).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-add",text:"Add Template",click:function(){i()}},{id:"btn-delete",text:"Delete Template",click:function(){k(f.currIndex)}},{text:"Previous",click:function(){j(f.currIndex-1)}},{text:"Next",click:function(){j(f.currIndex+1)}}]}),input_dialog=$dialog,$("#btn-submit").css("margin-right","30px")};var m=function(a,b){var c=new Array;for(x in b){var d=b[x];c.push(d.replace(/this/g,a))}return c},n=function(a,b){var d=new Array;for(x in b){var e=b[x],f=e.guard.replace(/this/g,a),g=e.actions.replace(/this/g,a),h=e.edenVar.replace(/this/g,a);d.push(new c(h,f,g))}return d},o=function(a,b){a.value="";for(x in b)b[x].value=""},p=function(a){var b;for(x in f.templates)if(f.templates[x].name==a){b=f.templates[x];break}return b},q=function(){for(var a=document.getElementById("template-menu"),b=a.options[a.selectedIndex].value,c=p(b),d=document.getElementById("entity-name"),e=d.value,g=!0,h=0;h");c=$('
          \t\t\t\t\t
          Templates:
          \t\t\t\t\t
          \t\t\t\t\t\t\t\t\t\t\t
          \t\t\t\t\t
          Entity name:
          \t\t\t\t\t
          \t\t\t\t\t\t\t\t\t\t\t
          \t\t\t\t\t
          Parameters:
          \t\t\t\t\t
          \t\t\t\t
          '),$dialog=$('
          ').html(c).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-instantiate",text:"Instantiate",click:function(){q()}}]}),f.templateList=new EdenUI.plugins.ADM.TemplateList;for(x in f.templates){var d=f.templates[x];f.templateList.addTemplate(d.name,d.parameters)}};var s=function(a){var b,c;for(x in f.entities)if(f.entities[x].name==a){b=f.entities[x],c=x;break}if(null==b)return void alert(a+" doesn't exist to delete.");f.entities.splice(c,1);for(x in f.actionLists)if(f.actionLists[x].entityName==a){c=x,f.actionLists[x].remove();break}null!=f.actionLists&&f.actionLists.splice(c,1),null!=f.entityList&&f.entityList.removeEntity(a)},t=function(a,b,c){var d=p(a);if(null==d)return alert("no template with name "+a),-1;for(x in f.entities)if(f.entities[x].name==c)return alert("Please enter a unique entity name"),-1;if(""==b)var e=[];else if(b.indexOf(",")==-1)var e=[b];else var e=b.split(",");if(e.length!=d.parameters.length)return alert("not enough parameters to instantiate "+d),-1;for(x in e){var g=D(d.parameters[x]),h=D(e[x]);eden.executeEden(c+"_"+g+" is "+h+";")}var i=m(c,d.definitions),j=r(c,i);return j!=-1&&u(c,i,d.actionsArr),j},u=function(a,b,c){var d=n(a,c),g=new e(a,b,d);f.entities.push(g);for(x in d){var h=d[x],i=h.edenVar+" is "+h.guard+";";eden.executeEden(i)}if(null!=f.actionLists){var j=new EdenUI.plugins.ADM.ActionsList(a);f.actionLists.push(j),w(g,j)}null!=f.entityList&&f.entityList.addEntity(a,b,d)},v=function(){for(x in f.selectedActions){var b=f.selectedActions[x];if(b=D(b),945==b.charCodeAt(0))if("r"==b[2]){var c=b.split("(")[1];c=c.substring(0,c.length-1),s(c)}else if("i"==b[2]){var d=b.split("(")[1],e=b.split("(")[2].split(")")[0],c=b.split("as")[1],g=t(d,e,c);if(g==-1)break}else alert("Action on another entity must one of α_remove(entity_name), α_r, α_instantiate(template(param_value) as entity_name) or α_i");else eden.executeEden(b+";")}f.selectedActions=new Array,a.plugins.ADM.refreshHumanPerspective()};this.actionPush=function(a){f.selectedActions.push(a)},this.actionRemove=function(a){var b=new Array;for(x in f.selectedActions){var c=f.selectedActions[x];c!=a&&b.push(c)}f.selectedActions=b},this.refreshHumanPerspective=function(){for(x in f.entities){var a,b=f.entities[x];for(y in f.actionLists){var c=f.actionLists[y];if(c.entityName==b.name){a=c;break}}a.clear();var d=[];for(x in b.queuedActions){var e=b.queuedActions[x].split(";"),g=e[0];if(g.length>0){e.splice(0,1);var h=!0;e[0].length>0&&(d.push(e.join(";")),h=!1),a.addAction(g,h)}}b.queuedActions=d,w(b,a)}};var w=function(a,b){for(var c=0;c0&&(a.queuedActions.push(f.join(";")),h=!1),b.addAction(g,h)}}};this.createHumanPerspective=function(b,c){var d=$("
          ");d=$('
          '),$dialog=$('
          ').html(d).dialog({title:c,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-refresh",text:"Refresh actions",click:function(){a.plugins.ADM.refreshHumanPerspective()}},{id:"btn-step",text:"Step",click:function(){v()}}]}),f.actionLists=new Array;for(x in f.entities){var b=f.entities[x].name;f.actionLists.push(new EdenUI.plugins.ADM.ActionsList(b))}a.plugins.ADM.refreshHumanPerspective()};var z=function(){for(x in f.selectedEntities)s(f.selectedEntities[x]);alert("Entities successfully deleted."),f.selectedEntities=new Array};this.entityPush=function(a){f.selectedEntities.push(a)},this.entityRemove=function(a){var b=new Array;for(x in f.selectedEntities){var c=f.selectedEntities[x];c!=a&&b.push(c)}f.selectedEntities=b};var A=function(){return'
          '};this.createInstanceList=function(a,b){var c=$("
          ");c.html(A()),$dialog=$('
          ').html(c).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-delete-entity",text:"Delete selected",click:function(){z()}}]}),f.entityList=new EdenUI.plugins.ADM.EntityList;for(x in f.entities){var d=f.entities[x];f.entityList.addEntity(d.name,d.definitions.join("\n"),d.actionsArr.join("\n"))}};var B=function(a){var b=a.split(":")[1];return D(b.split("(")[0])},C=function(a){var b=a.split(":")[1].split("(")[1];return b.length>1?b.split(")")[0].split(","):[]},D=function(a){for(;32==a.charCodeAt(0)||9==a.charCodeAt(0);)a=a.substring(1,a.length);for(;32==a.charCodeAt(a.length-1)||9==a.charCodeAt(a.length-1);)a=E(a);return a},E=function(a){return a.substring(0,a.length-1)},F=function(a,b,c,e){for(x in f.templates)if(f.templates[x].name==a)return alert("Templates must have unique names."),-1;var h=g(a,e),i=new d(a,b,c,h);return f.templates.push(i),null!=f.templateList&&f.templateList.addTemplate(a,b),1},G=function(a){var b,c=a.split("\n"),d=new Array,e=new Array,f=new Array,g=!1,h=!1,i=!1;for(x in c){var j=c[x];if(j=D(j),""!=j)if(0==i)if("{"==j[0])i=!0,j.indexOf("name:")!=-1&&(b=B(j),d=C(j));else{var k=j.split("(")[0],l=j.split("(")[1].split(")")[0],m=E(D(j.split("as")[1])),n=t(k,l,m);if(n==-1)break}else if(1==g){var o=j.indexOf("}");o!=-1&&(j=E(j),g=!1),j.length>0&&e.push(j)}else if(1==h){var o=j.indexOf("}");o!=-1&&(j=E(j),h=!1),j.length>0&&f.push(j)}else if("}"==j[0]){i=!1;var n=F(b,d,e,f);if(b="",d=new Array,e=new Array,f=new Array,n==-1)return}else if(j.indexOf("name:")!=-1)b=B(j),d=C(j);else if(j.indexOf("definitions:")!=-1||j.indexOf("defs:")!=-1){if(g=!0,j=D(j),j.split("{").length>1){var p=D(j.split("{")[1]);p.indexOf("}")!=-1&&(p=E(p),g=!1),p.length>0&&e.push(p)}}else if(j.indexOf("actions:")!=-1&&(h=!0,j=D(j),j.split("{").length>1)){var p=D(j.split("{")[1]),o=p.indexOf("}");o!=-1&&(p=E(p),h=!1),p.length>0&&f.push(p)}}};this.createAdvancedInput=function(a,b){var c=document.createElement("textarea");c.style.boxSizing="border-box",c.style.width="100%",c.style.height="100%",$code_entry=$('
          '),$code_entry.append(c),$dialog=$('
          ').html($code_entry).dialog({title:b,width:360,height:400,minHeight:200,minWidth:360,buttons:[{id:"btn-submit-advanced",text:"Submit",click:function(){var a=c.value;G(a),c.value=""}}]}),input_dialog=$dialog,$("#btn-submit-advanced").css("margin-right","30px")},a.addViewCategory("adm","Abstract Definitive Machine"),a.views.AdmTemplateCreator={dialog:this.createTemplateCreator,title:"ADM Template Creator",category:a.viewCategories.adm},a.views.AdmInstantiator={dialog:this.createInstantiator,title:"ADM Template Instantiator",category:a.viewCategories.adm},a.views.AdmHumanPerspective={dialog:this.createHumanPerspective,title:"ADM Human Perspective",category:a.viewCategories.adm},a.views.AdmEntityList={dialog:this.createInstanceList,title:"ADM Entity List",category:a.viewCategories.adm},a.views.AdmAdvancedInput={dialog:this.createAdvancedInput,title:"ADM Advanced Input",category:a.viewCategories.adm},b()},EdenUI.plugins.ADM.TemplateList=function(){this.templateList=document.getElementById("template-menu"),this.templateList.style.minWidth="100px",this.templates=new Array},EdenUI.plugins.ADM.TemplateList.prototype.addTemplate=function(a,b){var c=new EdenUI.plugins.ADM.Template(a,b);c.element.appendTo(this.templateList),this.templates.push(c)},EdenUI.plugins.ADM.Template=function(a,b){this.template=a,this.element=$("");var c=this.showParamInput;this.element.click(function(){c(b)});var d=document.getElementById("instantiate-params");""==d.innerHTML&&c(b)},EdenUI.plugins.ADM.Template.prototype.showParamInput=function(a){var b=document.getElementById("instantiate-params");b.innerHTML="";for(x in a){var c=a[x],d=document.createElement("label");d.innerHTML=c+":",b.appendChild(d);var e=document.createElement("input");e.type="text",b.appendChild(e);var f=document.createElement("br");b.appendChild(f)}},EdenUI.plugins.ADM.ActionsList=function(a){var b=document.getElementById("human-perspective");this.actionresults=document.createElement("div"),this.actionresults.setAttribute("id","actions_"+a),this.actionresults.innerHTML="",b.appendChild(this.actionresults),this.actions=new Array,this.entityName=a},EdenUI.plugins.ADM.ActionsList.prototype.addAction=function(a,b){var c=new EdenUI.plugins.ADM.Action(a,b);c.element.appendTo(this.actionresults),this.actions.push(c)},EdenUI.plugins.ADM.ActionsList.prototype.clear=function(){this.actions=new Array,this.actionresults.innerHTML=""},EdenUI.plugins.ADM.ActionsList.prototype.remove=function(){var a=document.getElementById("human-perspective");a.removeChild(document.getElementById("actions_"+this.entityName))},EdenUI.plugins.ADM.Action=function(a,b){var a=a;this.action=a,this.element=$('
          '),this.update=this.updateAction;var c=!1;this.element.hover(function(){0==c?$(this).animate({backgroundColor:"#eaeaea"},100):$(this).animate({backgroundColor:"#66CCCC"},100)},function(){0==c?$(this).animate({backgroundColor:"white"},100):$(this).animate({backgroundColor:"#6666CC"},100)}).click(function(){0==c?(edenUI.plugins.ADM.actionPush(a),$(this).css("backgroundColor","#6666CC"),c=!0):(edenUI.plugins.ADM.actionRemove(a),$(this).css("backgroundColor","white"),c=!1)}),this.update(b)},EdenUI.plugins.ADM.Action.prototype.updateAction=function(a){var b='
        3. ';b=1==a?b+this.action+"
        4. ":b+this.action+" ... ",this.element.html(b)},EdenUI.plugins.ADM.EntityList=function(){this.entityList=document.getElementById("entity-list"),this.entities=new Array},EdenUI.plugins.ADM.EntityList.prototype.addEntity=function(a,b,c){var d=new EdenUI.plugins.ADM.Entity(a,b,c);d.element.appendTo(this.entityList),this.entities.push(d)},EdenUI.plugins.ADM.EntityList.prototype.removeEntity=function(a){var b;for(x in this.entities)if(this.entities[x].entity==a){b=x;break}this.entities.splice(b,1);var c=document.getElementById("element-"+a);this.entityList.removeChild(c)},EdenUI.plugins.ADM.EntityList.prototype.unselectAll=function(){for(x in this.entities)this.entities[x].unselect()},EdenUI.plugins.ADM.Entity=function(a,b,c){this.entity=a,this.element=$('
          ");var d='
        5. '+this.entity+"
        6. ";this.element.html(d);var b=b,c=c,e=!1;this.element.hover(function(){0==e?$(this).animate({backgroundColor:"#eaeaea"},100):$(this).animate({backgroundColor:"#66CCCC"},100)},function(){0==e?$(this).animate({backgroundColor:"white"},100):$(this).animate({backgroundColor:"#6666CC"},100)}).click(function(){if(this.innerHTML==d){var f=document.createElement("div");f.innerHTML="
          \t\t\t\t\t
          \t\t\t\t\t
          \t\t\t\t\t
          ",this.appendChild(f),edenUI.plugins.ADM.entityPush(a),$(this).css("backgroundColor","#6666CC"),e=!0}else this.innerHTML=d,edenUI.plugins.ADM.entityRemove(a),$(this).css("backgroundColor","white"),e=!1})},EdenUI.plugins.ADM.Entity.prototype.unselect=function(){var a='
        7. '+this.entity+"
        8. ";this.element.html(a)},EdenUI.plugins.ADM.title="Abstract Definitive Machine",EdenUI.plugins.ADM.description="Abstract Definitive Machine",EdenUI.plugins.ADM.author="Ruth King",EdenUI.plugins.DBView=function(a,b){this.createDialog=function(a,b){function c(){0==Array.isArray(j)&&(j=[["Value"],[[j]]]);for(var a=f.get(0);a.firstChild;)a.removeChild(a.firstChild);if(g=j[0],h=j[1],Array.isArray(g)||(h=j,g=[["List"]]),Array.isArray(h)){for(var b=$(""),c=0;c");d.html(g[c]),d.appendTo(b)}b.appendTo(f);for(var e=0;e"),c=0;c'):$(""),k.appendTo(i);var l=Array.isArray(h[e])?h[e][c]:h[e];k.html("
          "+Eden.edenCodeForValue(l)+"
          ")}i.appendTo(f)}}}function d(){f.find(".dbview-dependant").removeClass("dbview-dependant"),f.find(".dbview-dependency").removeClass("dbview-dependency")}var e=$('
          Query:
          '),f=$('
          ');f.appendTo(e);var g,h,i=e.find(".dbview-select-text").get(0),j=void 0,k=a.slice(0,-7),l=new Eden.Agent((void 0),"view/db/"+k+"/config"),m="_view_"+k+"_source";return l.declare(m),f.on("input","td",function(a){var b=a.target.cellIndex,c=a.target.parentNode.rowIndex-1;if(!(b<0||c<0)){a.target.textContent}}).on("mouseenter","td",function(a){a.target.cellIndex,a.target.parentNode.rowIndex-1}).on("mouseleave","td",function(a){d()}),e.on("input",".dbview-select-text",function(a){l.setSource("_view_"+k+"_source is "+i.value),l.execute(!0,!0)}),j=l.state[m],c(),l.on(m,function(a,b){j=b,c()}),$('
          ').html(e).dialog({title:b,width:600,height:450,minHeight:120,minWidth:230,dialogClass:"dbview-dialog"}),{confirmClose:!0}},a.views.DBView={dialog:this.createDialog,title:"Database Viewer",category:a.viewCategories.visualization},b()},EdenUI.plugins.DBView.title="DBView",EdenUI.plugins.DBView.description="Display a table showing entire database contents.",EdenUI.plugins.SpeechSynthesis=function(a,b){function c(){var a=window.speechSynthesis.paused;window.speechSynthesis.cancel(),a&&window.speechSynthesis.pause()}function d(a,b){if(f)return void(f=!1);var e,g=root.lookup("speak"),h=root.lookup("speakingList"),i=root.lookup("speakingIndex"),j=root.lookup("speaking"),k=root.lookup("speakingID"),l=root.lookup("speakingText"),m=root.lookup("speakingSpeech"),n=root.lookup("speakingCharIndex"),o=h.value(),p=i.value();if(c(),p||(p=1),""!=a){if("finished"==a){var q=l.value();"string"==typeof q&&n.assign(q.length+1,g)}else"interrupted"==a&&(f=!0);e=k.value(),eden.isValidIdentifier(e)&&root.lookup(e+"_status").assign(a,g)}if(b&&p++,n.assign(1,g),root.lookup("speakingTime").assign(0,g),Array.isArray(o)&&p<=o.length){j.value()||j.assign(!0,g);var r=o[p-1];if(!(r instanceof SpeakingWords)||r.cancelled)return void d("",!0);r.prepareUtterance();var s=r.utterance;e=r.id,k.assign(e,g),eden.isValidIdentifier(e)&&root.lookup(e+"_status").assign("speaking",g),l.assign(s.text,g),m.assign(r,g),b&&i.assign(p,g),r.hasBeenSpoken=!0,window.speechSynthesis.speak(s)}else j.assign(!1,g),k.assign("",g),l.assign("",g),m.assign(void 0,g),Array.isArray(o)&&i.assign(o.length+1,g)}function e(a,b){var c,d,e,f,g=window.speechSynthesis.getVoices();a&&(a=a.toLowerCase(),d=a.indexOf("-"),d!=-1?(e=a.slice(0,d),f=!0):(e=a,f=!1)),b&&(c=new RegExp("\\b"+b+"\\b","i"));for(var h=void 0,i=!1,j=!1,k=!1,l=!1,m=0;mb.length+1)e.assign(b.length+1,c);else if(f<=b.length){for(var g=f<1?0:f-1;g=1&&e<=128&&c.send([192+d,e-1])}b.length>16&&eden.error(new Error("MIDI programs list is too long."))}}function d(a){if(void 0===a)return p;if(Number.isInteger(a)){if(a<1||h&&a>k.length)throw new Error("No MIDI output device exists with device number "+a);return a-1}if(h&&"string"==typeof a){for(var b=0;bl.length)throw new Error("No MIDI input device exists with device number "+a);return a-1}if(h&&"string"==typeof a){for(var b=0;bw&&(x=new Array(w)),x[0]=a,B=1,C=0;else{var b,c=a.timeStamp;for(b=B-1;b>=C&&!(x[b].timeStamp<=c);b--);b==B-1?x[B]=a:x.splice(b+1,0,a),B++}D.assign(B-C)}var g=this,h=!1;Object.defineProperty(this,"initialized",{get:function(){return h},enumerable:!0});var j=[];this.addSoftwareDriver=function(a){console.log("New JavaScript MIDI driver registered."),j.push(a),h&&a()};var k=[],l=[],m=root.lookup("midiNumberOfOutputs");m.assign(0);var n=root.lookup("midiNumberOfInputs");n.assign(0);var o={};this.addSoftSynth=function(a){if(k.push(a),m.assign(k.length),console.log('Added software synthesizer "'+a.name+'".'),h){var b=k.length-1,d=o[b];void 0!==d&&c(b,d.value())}},this.addSoftInput=function(a){l.push(a),n.assign(l.length),console.log('Added software input "'+a.name+'".')};var p=0,q=0;Object.defineProperty(this,"outputNames",{get:function(){for(var a=[],b=0;b=127?127:Math.round(a):void 0},this.isValidNote=function(a){return Number.isInteger(a)&&a>=-20&&a<=107},this.loadPrograms=function(a,b){a=d(a);var c=k[a];if(!Array.isArray(b))throw new Error("MIDI programs must be given as a list.");for(var e=b.length,f=new Array(e),g=0;g=1&&h<=128))throw new Error("Item "+g+" must be an integer between 1 and 128.");f[g]=h-1}c.loadPrograms&&c.loadPrograms(f)},this.bindPrograms=function(a,b){if(!(a instanceof Symbol))throw new Error("The first argument must be a Symbol.");b=d(b),Array.isArray(a.value())||void 0!==a.definition||a.assign([1]);var e=function(a,d){return Array.isArray(d)?void(h&&c(b,d)):void eden.error(new Error("Illegal MIDI programs list: "+Eden.edenCodeForValue(d)))};e(a,a.value()),a.addJSObserver("bind",e),o[b]=a},this.getInputs=function(){return l};var r=!1,s=[],t=[];this.initialize=function(a,b){function d(a){if(a0&&j.send([144+c,e+20,g.roundValue(f)]):(f>0?(void 0!==i&&j.send([144+c,i+20,0]),h&&j.send([144+c,e+20,g.roundValue(f)])):f<0?void 0!==i&&j.send([128+c,i+20,g.roundValue(-f)]):void 0!==i&&j.send([144+c,i+20,0]),u[a]=e):void 0!==i&&j.send([144+c,i+20,0])},this.alterVelocity=function(a,b,c,e,f){var h=u[a];if(e===h&&void 0!==e){var i=k[d(b)];f>0?i.send([160+c,e+20,g.roundValue(f)]):f<0?i.send([128+c,e+20,g.roundValue(-f)]):i.send([144+c,e+20,0])}};var v={};v.volume=7,this.bindControlChange=function(a,b,c,e){function f(a,b){var d=g.roundValue(b);void 0!==d&&i.send([176+c,h,d])}if(!(a instanceof Symbol))throw new Error("The first argument must be a Symbol.");var h,i=k[d(b)];if("string"==typeof e){if(h=v[e.toLowerCase()],void 0===h)throw new Error("Unknown control name "+e)}else{if(!(Number.isInteger(e)&&e>=0&&e<=127))throw new Error("The control must be specified either as a string or as an integer between 0 and 127 inclusive.");h=e}f(a,a.value()),a.addJSObserver("bind",f)};var w=16,x=new Array(w),y=root.lookup("midiInputDevice"),z=root.lookup("midiInputTimestamp"),A=root.lookup("midiInputMessage"),B=0,C=0,D=root.lookup("midiInputMessageCount");this.startInput=function(a){if(void 0===a)for(i=0;i=2*w&&C>.8*c-1&&(x.splice(0,C),B-=C,C=0);var d,e=b.target;e&&(d=e.name),root.beginAutocalcOff(),y.assign(d,a),z.assign(b.timeStamp,a),A.assign(b.data),D.assign(B-C),root.endAutocalcOff()}},this.clearInputMessages=function(){x.length>w&&(x=new Array(w)),B=0,C=0,D.assign(0)},Eden.Agent.importAgent("plugins/midi","default",[],b)},EdenUI.plugins.MIDI.title="MIDI",EdenUI.plugins.MIDI.description="Adds musical capabilities to JS-EDEN.",EdenUI.plugins.Debugger=function(a,b){this.createDialog=function(a,b){function c(a){var b="";return"when"==a.type&&a.base&&a.base.origin?(b+="## "+a.base.origin.name,a.line&&(b+=":"+(a.line+1)),b+="\n"):a.name&&(b+="## "+a.name+"\n"),a.getSource&&(b+=a.getSource()),b}var d=(a.slice(0,-7),!1),e=void 0,f=!1,g=500,h=$('
          '),i=$('
          ');h.append(i);var j=$('
          ');h.append(j);var k={},l=1,m=function(a){var b=a.agent,e=c(b);if(k[b.id]){var h=k[b.id].html;if(k[b.id].data=a,f=!1,h){var i=new Eden.AST(e,(void 0),b),j=new EdenUI.Highlight(h.get(0).childNodes[1]);if(j.highlight(i,-1,-1),a.statement){var l=a.statement.line-b.getLine(),m=h.get(0).childNodes[1].childNodes[l+1];m?m.className="eden-line debugger-line":console.error("Missing line: "+l)}}else console.error("Missing output")}d&&setTimeout(a.next,g)};Eden.AST.debugstep_cb=m;var n=function(a){var b=a.agent;void 0!==b.id&&(o(a),console.log("WHEN ALREADY LOGGED")),b.id=l,l++;var d=$('
          ');j.append(d),k[b.id]={html:d,data:a},void 0===e&&(e=k[b.id],d.get(0).className="debugger-agent active");var f=c(b),g=new Eden.AST(f,(void 0),b),h=new EdenUI.Highlight(d.get(0).childNodes[1]);h.highlight(g,-1,-1)};Eden.AST.debug_begin_cb=n;var o=function(a){var b=a.agent;if(void 0!==b.id&&void 0!==k[b.id]){e===k[b.id]&&(f=!1,e=void 0);var d=c(b),g=k[b.id].html,h=new Eden.AST(d,(void 0),b),i=new EdenUI.Highlight(g.get(0).childNodes[1]);i.highlight(h,-1,-1),k[b.id].html.remove(),delete k[b.id],b.id=void 0}};return Eden.AST.debug_end_cb=o,Eden.AST.debug=!0,Eden.AST.debugstep=!1,$('
          ').html(h).dialog({appendTo:"#jseden-views",title:b,width:590,height:500,minHeight:120,minWidth:230,dialogClass:"debugger-dialog"}),i.on("click",".play",function(a){d=!d,d?(a.currentTarget.innerHTML="",a.currentTarget.className="debugger-button play active"):(a.currentTarget.innerHTML="",a.currentTarget.className="debugger-button play")}).on("click",".stepforward",function(a){e&&e.data.next&&(e.data.next(),e&&(e.data.next=void 0))}).on("click",".debug",function(a){Eden.AST.debugstep=!Eden.AST.debugstep,Eden.AST.debugstep?a.currentTarget.className="debugger-button debug active":a.currentTarget.className="debugger-button debug"}).on("change",".debugger-speed",function(a){g=a.currentTarget.value,console.log("Change speed: "+g)}),j.on("click",".debugger-agent",function(a){e&&(e.html.get(0).className="debugger-agent"),e=k[a.currentTarget.getAttribute("data-agent")],e.html.get(0).className="debugger-agent active"}),{destroy:function(){Eden.AST.debug=!1}}},a.views.Debugger={dialog:this.createDialog,title:"Debugger",category:a.viewCategories.history},b()},EdenUI.plugins.Debugger.title="Debugger",EdenUI.plugins.Debugger.description="",EdenUI.plugins.Debugger.originalAuthor="Nicolas Pope",EdenUI.plugins.MIDIDotJS=function(a,b){function c(){a.plugins.MIDI.addSoftwareDriver(function(b,c){function f(e){e==i.length?(g=window.MIDI,g.loadPlugin({soundfontUrl:d,onsuccess:function(){a.plugins.MIDI.addSoftSynth(h),b&&b.apply(this,c)}})):$.ajax({url:"plugins/midi/emulation/lib/MIDI.js/"+i[e],success:function(){f(e+1)}})}var g,h={};h.name="MIDI.js",h.loadPrograms=function(a){for(var b=0;b0)window.setTimeout(function(){var a=b(h);d.onmidimessage(a),c(g+1)},i);else{var j=b(h);d.onmidimessage(j),c(g+1)}}}var e=window.performance.now(),f=a.length;c(0)},a.plugins.MIDI?c():a.loadPlugin("MIDI",c)},EdenUI.plugins.MIDIFileInput.title="MIDI File Input",EdenUI.plugins.MIDIFileInput.description="Use a MIDI file to simulate MIDI file input."; \ No newline at end of file