Permalink
Browse files

github got all strict on pushing empty files to gist

  • Loading branch information...
1 parent 18981df commit 5eb486793890cbf3d7df0ebcc0b16348413de4da @enjalot committed Jan 4, 2013
Showing with 10 additions and 5 deletions.
  1. +5 −1 app.py
  2. +1 −1 src/config.js
  3. +1 −0 static/lib/inlet.js
  4. +1 −1 static/tributary.js
  5. +2 −2 static/tributary.min.js
View
6 app.py
@@ -255,6 +255,7 @@ def github_authenticated():
def fork__req_new(old_gist_id, data, token=None):
url = 'https://api.github.com/gists'
#data = data.encode('utf-8')
+ #print "DATA", data
old_data = fetch_gist_content(old_gist_id, token)
gist_history = ""
@@ -264,7 +265,10 @@ def fork__req_new(old_gist_id, data, token=None):
# print "Old_gist_id = ", old_gist_id
new_data = json.loads(data)
if old_gist_id is None:
- markdown = ""
+ default = "An inlet to tributary"
+ markdown = new_data.get("config", {}).get("description", default)
+ if len(markdown) <= 0:
+ markdown = default
else:
markdown = "<br/><a href=\"https://gist.github.com/" + old_gist_id + "\">Gist #" + old_gist_id + "</a> "
new_data["files"]["_.md"] = {"content": markdown + gist_history}
View
2 src/config.js
@@ -3,7 +3,7 @@
//of tributary components
tributary.Config = Backbone.Model.extend({
defaults: {
- description: "Another Inlet",
+ description: "An inlet to Tributary",
endpoint: "tributary",
display: "svg",
public: true,
View
1 static/lib/inlet.js
@@ -39,6 +39,7 @@ var Inlet = (function() {
var start = {"line":cursor.line, "ch":token.start};
var end = {"line":cursor.line, "ch":token.end};
start.ch = start.ch + token.string.indexOf("#");
+ console.log("token string", token.string);
end.ch = start.ch + 7;
//editor.replaceRange('"#' + newcolor.toUpperCase() + '"', start, end);
editor.replaceRange('#' + newcolor.toUpperCase(), start, end);
View
2 static/tributary.js
@@ -199,7 +199,7 @@ var Tributary = function() {
});
tributary.Config = Backbone.Model.extend({
defaults: {
- description: "Another Inlet",
+ description: "An inlet to Tributary",
endpoint: "tributary",
display: "svg",
"public": true,
View
4 static/tributary.min.js
@@ -1,3 +1,3 @@
//(function(){
-var Tributary=function(){function _assemble(a){var b=a.config;tributary.__config__=b,b.contexts=[];var c,d,e,f,g=b.get("endpoint");tributary.endpoint&&(g=tributary.endpoint),g==="delta"?(b.set("display","svg"),b.set("play",!0),b.set("loop",!0),b.set("autoinit",!0)):g==="cypress"?(b.set("display","canvas"),b.set("play",!0),b.set("autoinit",!0)):g==="hourglass"?(b.set("display","svg"),b.set("play",!0),b.set("autoinit",!0)):g==="curiosity"?(b.set("display","webgl"),b.set("play",!0),b.set("autoinit",!0)):g==="bigfish"?(b.set("display","svg"),b.set("play",!0),b.set("autoinit",!1),b.set("restart",!0)):g==="fly"?(b.set("display","canvas"),b.set("play",!0),b.set("autoinit",!1),b.set("restart",!0)):g==="ocean"&&b.set("display","div"),b.get("display")||b.set("display","svg"),b.set("endpoint","");var h=panel.select(".tb_edit");tributary.edit=h,a.models.each(function(a){f=a.get("type"),c=tributary.make_context({config:b,model:a,display:display}),c&&(b.contexts.push(c),c.render(),mainfiles.indexOf(a.get("filename"))<0&&c.execute(),c.editor=tributary.make_editor({model:a,parent:h}),a.trigger("hide"))}),b.contexts.forEach(function(a){mainfiles.indexOf(a.model.get("filename"))>=0&&(a.model.trigger("show"),tributary.autoinit=!0,a.execute(),tributary.autoinit=b.get("autoinit"))});var i=new tributary.ConfigView({el:".tb_config",model:b});i.render();var j=new tributary.FilesView({el:".tb_files",model:b});j.render();var k=new tributary.ControlsView({el:".tb_controls",model:b});k.render(),setup_header(a),tributary.events.trigger("show",b.get("tab")),tributary.events.on("show",function(a){b.set("tab",a)}),tributary.dims.display_percent=b.get("display_percent"),tributary.events.trigger("resize"),tributary.events.on("resize",function(){b.set("display_percent",tributary.dims.display_percent)}),b.get("hidepanel")?tributary.events.trigger("hidepanel"):tributary.events.trigger("showpanel")}function setup_header(a){setup_save(a.config);if(a.user){var b=a.user.id;if(b===tributary.userid)var c='<input id="gist-title" value="'+a.gist.description+'" > by <!-- ya boy -->';else var c='"<span id="gist-title-static"><a href="'+a.gist.html_url+'">'+a.gist.description+'</a></span>" by ';a.user.url===""?c+=a.user.login:c+='<a href="'+a.user.url+'">'+a.user.login+"</a>",d3.select("title").text(a.gist.description||"Tributary"),$("#gist_info").html(c),a.user.id!==tributary.userid&&($("#forkPanel").css("display","none"),$("#savePanel").attr("id","forkPanel"),setup_save(a.config))}else if(isNaN(tributary.userid)||!a.gist)$("#forkPanel").css("display","none"),$("#savePanel").attr("id","forkPanel"),setup_save(a.config);$("#gist-title").on("keyup",function(){a.config.set("description",$("#gist-title").val()),d3.select("title").text($("#gist-title").val())})}function setup_save(a){$("#savePanel").off("click"),$("#savePanel").on("click",function(b){console.log("saving!"),d3.select("#syncing").style("display","block"),tributary.save_gist(a,"save",function(a,b){d3.select("#syncing").style("display","none")})}),$("#forkPanel").off("click"),$("#forkPanel").on("click",function(b){console.log("forking!"),d3.select("#syncing").style("display","block"),tributary.save_gist(a,"fork",function(a,b){window.onunload=!1,window.onbeforeunload=!1,window.location=a})}),$("#loginPanel").on("click",function(a){tributary.login_gist(tributary.loggedin,function(a,b){window.onunload=!1,window.onbeforeunload=!1,window.location=a})})}var tributary={};tributary.events=_.clone(Backbone.Events),tributary.data={},window.trib={},window.trib_options={},window.addEventListener("resize",function(a){tributary.events.trigger("resize",a)});var mainfiles=["inlet.js","inlet.coffee","sinwaves.js","squarecircle.js"];tributary.displays=[{name:"svg",description:"creates an <svg> element for you to use"},{name:"canvas",description:"creates a <canvas> element and gives you a Context for the canvas"},{name:"webgl",description:"gives you a Three.js WebGLRenderer scene"},{name:"html",description:"gives you <div id=display>"}],tributary.time_controls=[{name:"play",description:"gives you a play button, and tributary.t. if you provide tributary.run(g,t) it will be executed in a run loop"},{name:"loop",description:"gives you a loop where tributary.t goes from 0 to 1."},{name:"restart",description:"assumes you only want tributary.init(g) to be run when the restart button is clicked"}],tributary.make_context=function(a){var b,c,d,e,f=a.config;if(a.model)c=a.model,g=c.get("filename"),e=c.get("type");else{var g,h;a.filename?g=a.filename:g="inlet.js",a.content?h=a.content:h="";var i=g.split(".");e=i[i.length-1],c=new tributary.CodeModel({name:i[0],filename:g,code:h})}return a.display?d=a.display:d=d3.select("#display"),c.set("type",e),mainfiles.indexOf(g)>=0?b=new tributary.TributaryContext({config:f,model:c,el:d.node()}):e==="json"?(c.set("mode","json"),b=new tributary.JSONContext({config:f,model:c})):e==="csv"?(c.set("mode","text"),b=new tributary.CSVContext({config:f,model:c})):e==="tsv"?(c.set("mode","text"),b=new tributary.TSVContext({config:f,model:c})):e==="js"?b=new tributary.JSContext({config:f,model:c}):e==="coffee"?(c.set("mode","coffeescript"),b=new tributary.CoffeeContext({config:f,model:c})):e==="css"?(c.set("mode","css"),b=new tributary.CSSContext({config:f,model:c})):e==="html"?(c.set("mode","text/html"),b=new tributary.HTMLContext({config:f,model:c,el:d.node()})):e==="svg"&&g!=="inlet.svg"&&(c.set("mode","text/html"),b=new tributary.SVGContext({config:f,model:c,el:d.node()})),b},d3.selection.prototype.moveToFront=function(){return this.each(function(){this.parentNode.appendChild(this)})},tributary.appendSVGFragment=function(a,b){var c="<svg xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink>",d="</svg>",e=document.createRange();e.selectNode(a);var f=e.createContextualFragment(c+b+d),g=f.childNodes[0].childNodes;for(var h=0,i=g.length;h<i;h++)a.appendChild(g[0])},Handlebars.getTemplate=function(a,b){(Handlebars.templates===undefined||Handlebars.templates[a]===undefined)&&$.ajax({url:"/static/templates/"+a+".handlebars",success:function(c){Handlebars.templates===undefined&&(Handlebars.templates={}),Handlebars.templates[a]=Handlebars.compile(c),b&&b(template)}})},tributary.CodeModel=Backbone.Model.extend({defaults:{code:"",filename:"inlet.js",name:"inlet",type:"js",mode:"javascript"},initialize:function(){this.binder()},binder:function(){this.on("error",this.handle_error)},handle_error:function(a){tributary.trace&&(console.trace(),console.log(a))},handle_coffee:function(){var a=this.get("code");return this.get("mode")==="coffeescript"&&(a=CoffeeScript.compile(a,{bare:!0})),a},local_storage:function(a){a||(a="");var b=this.get("filename")+"/code/"+a;return localStorage[b]},set_local_storage:function(a,b){var c=this.get("filename")+"/code/"+b;localStorage[c]=a}}),tributary.CodeModels=Backbone.Collection.extend({model:tributary.CodeModel}),tributary.Config=Backbone.Model.extend({defaults:{description:"Another Inlet",endpoint:"tributary",display:"svg","public":!0,require:[],fileconfigs:{},tab:"edit",display_percent:.7,play:!1,loop:!1,restart:!1,autoinit:!0,pause:!0,loop_type:"period",bv:!1,nclones:15,clone_opacity:.4,duration:3e3,ease:"linear",dt:.01},require:function(a,b){var c=this.get("require"),d=_.pluck(c,"url"),e=function(){return a(b,arguments)};require(d,e)},initialize:function(){this.on("hide",function(){this.contexts.forEach(function(a){a.model.trigger("hide")})},this)}}),tributary.ConfigView=Backbone.View.extend({initialize:function(){},render:function(){var a=this,b=Handlebars.templates.config,c={displays:tributary.displays,time_controls:tributary.time_controls,requires:this.model.get("require")};$(this.el).html(b(c));var d=d3.select(this.el).select(".displaycontrols").selectAll("div.config"),e=this.model.get("display");d.datum(function(){return this.dataset}),d.filter(function(a){return a.name===e}).classed("config_active",!0),d.on("click",function(b){d3.select(this.parentNode).selectAll("div.config").classed("config_active",!1),d3.select(this).classed("config_active",!0),a.model.set("display",b.name),tributary.events.trigger("execute")});var f=d3.select(this.el).select(".timecontrols").selectAll("div.config");f.datum(function(){return this.dataset}),f.filter(function(b){return a.model.get(b.name)}).classed("config_active",!0),f.on("click",function(b){var c=!a.model.get(b.name);d3.select(this).classed("config_active",c),a.model.set(b.name,c)});var g=d3.select(this.el).select(".editorcontrols");g.selectAll("div.config").on("click",function(a){$(this).attr("data-name")=="log-errors"&&(tributary.hint==1&&tributary.trace==1?($(this).removeClass("config_active"),tributary.hint=!1,tributary.trace=!1,tributary.events.trigger("execute")):(tributary.hint=!0,tributary.trace=!0,tributary.events.trigger("execute"),$(this).addClass("config_active")))});var h=d3.select(this.el).select(".requirecontrols"),i=h.selectAll(".plus"),j=h.selectAll(".tb_add"),k=h.select(".tb_add").select("input.name"),l=h.select(".tb_add").select("input.url");h.selectAll("div.config").datum(function(){return this.dataset}).select("span.delete").datum(function(){return this.dataset}).on("click",function(b){var c=a.model.get("require"),d=c.indexOf(b);c.splice(d,1),a.model.set("require",c),a.$el.empty(),a.render(),j.style("display","none")}),h.selectAll("div.config").on("click",function(b){j.style("display",""),k.node().value=b.name,l.node().value=b.url;var c=function(){var c=a.model.get("require"),d=_.find(c,function(a){return a.name===b.name});d.name=k.node().value,d.url=l.node().value,a.model.set("require",c),a.model.require(function(){},c),a.$el.empty(),a.render()};k.on("keypress",function(){d3.event.charCode===13&&c()}),l.on("keypress",function(){d3.event.charCode===13&&c()})}),i.on("click",function(){j.style("display",""),k.node().focus();var b=function(){var b={name:k.node().value,url:l.node().value},c=a.model.get("require");c.push(b),a.model.set("require",c),a.model.require(function(){},c),a.$el.empty(),a.render()};k.on("keypress",function(){d3.event.charCode===13&&b()}),l.on("keypress",function(){d3.event.charCode===13&&b()})})}}),tributary.Context=Backbone.View.extend({initialize:function(){},execute:function(){},render:function(){}}),tributary.TributaryContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",function(){tributary.events.trigger("execute")}),tributary.events.on("execute",this.execute,this),tributary.__config__||(tributary.__config__=this.options.config),this.model.on("change:code",function(){window.onbeforeunload||$(window).on("beforeunload",function(){return"Are you sure you want to leave?"})},this),this.config=this.options.config,this.config.on("change:display",this.set_display,this);var a=this.config;tributary.init=undefined,tributary.run=undefined,tributary.loop=a.get("loop"),tributary.autoinit=a.get("autoinit"),tributary.pause=a.get("pause"),tributary.loop_type=a.get("loop_type"),tributary.bv=a.get("bv"),tributary.nclones=a.get("nclones"),tributary.clone_opacity=a.get("clone_opacity"),tributary.duration=a.get("duration"),tributary.ease=d3.ease(a.get("ease")),tributary.t=0,tributary.dt=a.get("dt"),tributary.reverse=!1,tributary.useThreejsControls=!0,tributary.render=function(){},tributary.execute=function(){if(tributary.run!==undefined){var a=tributary.t;tributary.loop&&(a=tributary.ease(tributary.t)),tributary.run(tributary.g,a,0)}},tributary.timer={then:new Date,duration:tributary.duration,ctime:tributary.t},d3.timer(function(){tributary.render();if(tributary.pause)return!1;var b=new Date,c=b-tributary.timer.then,d;if(tributary.loop){tributary.reverse?d=tributary.timer.ctime*c/tributary.timer.duration*-1:d=(1-tributary.timer.ctime)*c/tributary.timer.duration,tributary.t=tributary.timer.ctime+d;if(tributary.t>=1||tributary.t<=0||tributary.t==="NaN")tributary.loop_type==="period"?(tributary.t=0,tributary.timer.then=new Date,tributary.timer.duration=tributary.duration,tributary.timer.ctime=tributary.t,tributary.reverse=!1):tributary.loop_type==="pingpong"?(tributary.t=!tributary.reverse,tributary.timer.then=new Date,tributary.timer.duration=tributary.duration,tributary.timer.ctime=tributary.t,tributary.reverse=!tributary.reverse):tributary.t!==0&&(tributary.t=1,tributary.pause=!0);tributary.t===!0&&(tributary.t=1),tributary.t===!1&&(tributary.t=0)}else tributary.t+=tributary.dt;tributary.execute(),a.trigger("tick",tributary.t)})},execute:function(){var a=this.model.handle_coffee();if(a.length>0&&this.model.get("type")!=="coffee"){var b=JSHINT(a,{asi:!0,laxcomma:!0,laxbreak:!0,loopfunc:!0,smarttabs:!0,sub:!0});b?this.model.trigger("nojshint"):this.model.trigger("jshint",JSHINT.errors)}try{tributary.initialize=new Function("g","tributary",a)}catch(c){return this.model.trigger("error",c),!1}try{window.trib={},window.trib_options={},trib=window.trib,trib_options=window.trib_options,tributary.autoinit&&(tributary.clear(),tributary.events.trigger("prerender")),this.clones&&$(this.clones.node()).empty(),tributary.bv&&this.make_clones(),tributary.initialize(tributary.g,tributary),tributary.autoinit&&tributary.init!==undefined&&tributary.init(tributary.g,0),tributary.execute()}catch(d){return this.model.trigger("error",d),!1}return this.model.trigger("noerror"),!0},render:function(){this.set_display()},set_display:function(){var a=this;this.$el.empty();var b=this.config.get("display");b==="svg"?this.make_svg():b==="canvas"?this.make_canvas():b==="webgl"?this.make_webgl():b==="div"?(this.g=d3.select(this.el),tributary.g=this.g,tributary.clear=function(){a.$el.empty()}):tributary.clear=function(){a.$el.empty()}},make_svg:function(){this.svg=d3.select(this.el).append("svg").attr({xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink","class":"tributary_svg"}),tributary.g=this.svg,tributary.clear=function(){$(tributary.g.node()).empty()}},make_canvas:function(){tributary.clear=function(){tributary.canvas.width=tributary.sw,tributary.canvas.height=tributary.sh,tributary.ctx.clearRect(0,0,tributary.sw,tributary.sh)},tributary.canvas=d3.select(this.el).append("canvas").classed("tributary_canvas",!0).node(),tributary.ctx=tributary.canvas.getContext("2d"),tributary.g=tributary.ctx},make_clones:function(){this.clones=this.svg.selectAll("g.clones").data([0]),this.clones.enter().append("g").attr("class","clones"),tributary.g=this.svg.selectAll("g.delta").data([0]),tributary.g.enter().append("g").attr("class","delta");var a=d3.range(tributary.nclones),b=this.clones.selectAll("g.bvclone").data(a).enter().append("g").attr("class","bvclone").style("opacity",tributary.clone_opacity);b.each(function(a,b){var c=b+1,d=d3.select(this);tributary.init(d,c);var e=tributary.ease(c/(tributary.nclones+1));tributary.run(d,e,c)})},make_webgl:function(){function b(){windowHalfX=tributary.sw/2,windowHalfY=tributary.sh/2,tributary.camera.aspect=tributary.sw/tributary.sh,tributary.camera.updateProjectionMatrix(),tributary.renderer.setSize(tributary.sw,tributary.sh)}container=this.el,tributary.camera=new THREE.PerspectiveCamera(70,tributary.sw/tributary.sh,1,1e3),tributary.camera.position.y=150,tributary.camera.position.z=500,tributary.scene=new THREE.Scene,THREE.Object3D.prototype.clear=function(){var a=this.children,b;for(b=a.length-1;b>=0;b--){var c=a[b];c.clear(),this.remove(c)}},tributary.renderer=new THREE.WebGLRenderer,tributary.renderer.setSize(tributary.sw,tributary.sh),container.appendChild(tributary.renderer.domElement);var a=new THREE.TrackballControls(tributary.camera);a.target.set(0,0,0),a.rotateSpeed=1,a.zoomSpeed=1.2,a.panSpeed=.8,a.noZoom=!1,a.noPan=!1,a.staticMoving=!1,a.dynamicDampingFactor=.15,tributary.controls=a,tributary.render=function(){tributary.useThreejsControls&&tributary.controls.update(),tributary.renderer.render(tributary.scene,tributary.camera)},tributary.render(),tributary.events.on("resize",b,!1),tributary.clear=function(){tributary.scene.clear()}}}),tributary.JSONContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{var a=JSON.parse(this.model.get("code"));tributary[this.model.get("name")]=a}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.JSContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){var js=this.model.get("code");if(js.length>0){var hints=JSHINT(js,{asi:!0,laxcomma:!0,laxbreak:!0,loopfunc:!0,smarttabs:!0,sub:!0});hints?this.model.trigger("nojshint"):this.model.trigger("jshint",JSHINT.errors)}try{eval(js)}catch(e){return this.model.trigger("error",e),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.CoffeeContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){var js=this.model.handle_coffee();try{eval(js)}catch(e){return this.model.trigger("error",e),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.CSVContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{var a=d3.csv.parse(this.model.get("code"));tributary[this.model.get("name")]=a}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.TSVContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{var a=d3.tsv.parse(this.model.get("code"));tributary[this.model.get("name")]=a}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.CSSContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{this.el.textContent=this.model.get("code")}catch(a){return this.model.trigger("error",a),!1}return this.model.trigger("noerror"),!0},render:function(){this.el=d3.select("head").selectAll("style.csscontext").data([this.model],function(a){return a.cid}).enter().append("style").classed("csscontext",!0).attr({type:"text/css"}).node()}}),tributary.HTMLContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",function(){tributary.events.trigger("execute")}),tributary.events.on("prerender",this.execute,this)},execute:function(){try{$(this.el).append(this.model.get("code"))}catch(a){return this.model.trigger("error",a),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.SVGContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",function(){tributary.events.trigger("execute")}),tributary.events.on("prerender",this.execute,this)},execute:function(){try{var a=d3.select(this.el).select("svg").node();tributary.appendSVGFragment(a,this.model.get("code"))}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.PanelView=Backbone.View.extend({initialize:function(){},render:function(){var a=this,b=["edit","config"],c=Handlebars.templates.panel,d=c(b);this.$el.html(d),panel=d3.select(".tb_panel"),panel_gui=d3.selectAll("div.tb_panel_gui");var e=60,f=panel_gui.selectAll("div.pb").on("click",function(a){tributary.events.trigger("show",this.dataset.name)});tributary.events.on("show",function(a){$(".tb_panel").children(".panel").css("display","none"),panel.select(".tb_"+a).style("display",""),panel_gui.selectAll("div.pb").classed("gui_active",!1),panel_gui.select(".tb_"+a+"_tab").classed("gui_active",!0)}),tributary.events.trigger("show","edit"),$(".tb_hide-panel-button").on("click",function(){tributary.events.trigger("hidepanel"),$("#display").addClass("fullscreen"),$("svg").addClass("fullscreen"),$("#header").addClass("dimheader")}),$("#show-codepanel-button").on("click",function(){tributary.events.trigger("showpanel"),$("#display").removeClass("fullscreen"),$("svg").removeClass("fullscreen"),$("#header").removeClass("dimheader")}),tributary.events.on("hidepanel",function(){$(".tb_panel").hide(),$(".tb_panel_gui").hide(),$(".tb_panel_handle").hide(),$(".tb_panelfiles_gui").hide(),$("#show-codepanel").show(),tributary.__config__&&tributary.__config__.set("hidepanel",!0)}),tributary.events.on("showpanel",function(){$(".tb_panel").show(),$(".tb_panel_gui").show(),$(".tb_panel_handle").show(),$(".tb_panelfiles_gui").show(),$("#show-codepanel").hide(),tributary.__config__&&tributary.__config__.set("hidepanel",!1)})}}),tributary.make_editor=function(a){var b=a.parent||tributary.edit,c=a.model;a.container?container=a.container:container=b.append("div").attr("id",c.cid);var d;return d=new tributary.Editor({el:container.node(),model:c}),d.render(),d},tributary.Editor=Backbone.View.extend({initialize:function(){this.model.on("show",function(){d3.select(this.el).style("display","")},this),this.model.on("hide",function(){d3.select(this.el).style("display","none")},this),this.model.on("delete",function(){this.$el.remove()},this)},getConfig:function(){var a=tributary.__config__.get("fileconfigs"),b=a[this.model.get("filename")];return b?b:this.defaultConfig()},setConfig:function(a,b){var c=tributary.__config__.get("fileconfigs"),d=c[this.model.get("filename")];d[a]=b;var c=tributary.__config__.set("fileconfigs",c)},defaultConfig:function(){var a=tributary.__config__.get("fileconfigs"),b={"default":!0,vim:!1,emacs:!1,fontSize:12};a[this.model.get("filename")]=b;var a=tributary.__config__.set("fileconfigs",a);return b},render:function(){var a=this,b=d3.select(this.el).classed("editor",!0),c=Handlebars.templates.editor,d=c(this.getConfig());this.$el.html(d),filetype=a.model.get("filename").split(".")[1];if(filetype=="js")var e="lesser-dark";else if(filetype=="svg")var e="vibrant-ink";else if(filetype=="html")var e="ambiance";else if(filetype=="coffee")var e="elegant";else if(filetype=="css")var e="elegant";else var e="lesser-dark";var f={mode:a.model.get("mode"),theme:e,lineNumbers:!0};a.model.get("mode")==="json"&&(f.mode="javascript",f.json=!0),this.cm=CodeMirror(this.el,f),this.cm.on("change",function(){var b=a.cm.getValue();a.model.set("code",b)}),this.cm.setValue(this.model.get("code")),this.inlet=Inlet(this.cm),this.model.on("error",function(){d3.select(a.el).select(".CodeMirror-gutter").classed("error",!0)}),this.model.on("noerror",function(){d3.select(a.el).select(".CodeMirror-gutter").classed("error",!1)});var g=b.select(".toolbar"),h=b.select(".settings").on("click",function(){g.classed("hidden",!g.classed("hidden")),h.classed("active-settings",!g.classed("hidden"))});g.selectAll(".radio").on("change",function(){a.setConfig("default",!1),a.setConfig("vim",!1),a.setConfig("emacs",!1),a.setConfig(this.value,!0),a.cm.setOption("keyMap",this.value)}),g.select(".plusFontSize").on("click",function(){var b=a.getConfig(),c=b.fontSize+1;a.setConfig("fontSize",c);var d=a.cm.getWrapperElement();d3.select(d).select(".CodeMirror-scroll").style({"font-size":c+"px","line-height":c+"px"}),a.cm.refresh()}),g.select(".minusFontSize").on("click",function(){var b=a.getConfig(),c=b.fontSize-1;a.setConfig("fontSize",c);var d=a.cm.getWrapperElement();d3.select(d).select(".CodeMirror-scroll").style({"font-size":c+"px","line-height":c+"px"}),a.cm.refresh()});var i=a.getConfig(),j=i.fontSize,k=a.cm.getWrapperElement();d3.select(k).select(".CodeMirror-scroll").style({"font-size":j+"px","line-height":j+"px"}),a.cm.refresh()}}),tributary.gist=function(a,b){function f(a){c.gist=a,a.user===null||a.user===undefined?c.user={login:"anon",url:"",userid:-1}:c.user=a.user;var d;try{d=a.files["config.json"]}catch(e){d=!1}if(d)try{c.config=new tributary.Config(JSON.parse(d.content))}catch(f){c.config=new tributary.Config}else c.config=new tributary.Config;var g=_.keys(a.files);fileconfigs=c.config.get("fileconfigs")||{},c.models=new tributary.CodeModels;var h,i,j,k=0,l;g.forEach(function(b){h=b.split("."),l=h[h.length-1],b!=="config.json"&&(i=new tributary.CodeModel({filename:b,name:h[0],code:a.files[b].content,type:l}),c.models.add(i)),fileconfigs[b]||(fileconfigs[b]={"default":!0,vim:!1,emacs:!1,fontSize:12})}),c.config.set("fileconfigs",fileconfigs),c.config.require(b,c)}tributary.gistid=a;var c={},d="?cachebust="+Math.random()*0xf12765df4c9b2,e="https://api.github.com/gists/"+a+d;$.ajax({url:e,contentType:"application/json",dataType:"json",success:f,error:function(b){console.log(b),e="/gist/"+a+d,$.ajax({url:e,contentType:"application/json",dataType:"json",success:f,error:function(a){console.log(a)}})}})},tributary.save_gist=function(a,b,c){var d=tributary.gistid||"",e={description:a.get("description"),"public":a.get("public"),files:{}};a.contexts.forEach(function(a){e.files[a.model.get("filename")]={content:a.model.get("code")}}),a.todelete&&a.todelete.forEach(function(a){e.files[a]=null}),e.files["config.json"]={content:JSON.stringify(a.toJSON())};var f;b==="save"?f="/tributary/save":b==="fork"&&(f="/tributary/fork"),d.length>4&&(f+="/"+d);var g=this;$.post(f,{gist:JSON.stringify(e)},function(a){typeof a=="string"&&(a=JSON.parse(a));var b=a.id,d="/inlet/"+b;c(d,b)})},tributary.login_gist=function(a,b){var c;a?c="/github-logout":c="/github-login",c+="/inlet",tributary.gistid&&(c+="/"+tributary.gistid),b(c)},tributary.FilesView=Backbone.View.extend({initialize:function(){},render:function(){var a=this,b=Handlebars.templates.files,c=_.map(tributary.__config__.contexts,function(a){return a.model.toJSON()});c=c.sort(function(a,b){return a.filename<b.filename?-1:1});var d=_.find(c,function(a){return a.filename==="inlet.js"||a.filename==="inlet.coffee"});d&&(c.splice(c.indexOf(d),1),c.unshift(d));var e={contexts:c};$(this.el).html(b(e));var f=d3.select(this.el).selectAll("div.fv");f.on("click",function(b){var c=this.dataset.filename;if(a.model){var d=_.find(tributary.__config__.contexts,function(a){return a.model.get("filename")===c});a.model.trigger("hide"),d.model.trigger("show")}tributary.events.trigger("show","edit")}),f.attr("class",function(a,b){var c=this.dataset.filename.split(".")[1];return"fv type-"+c}),f.select(".delete-file").style("z-index",1e3).on("click",function(){var b=this.parentNode.dataset,c=b.filename,d=b.filename.split(".")[0];delete a.model,tributary.__config__.unset(c);var e=_.find(tributary.__config__.contexts,function(a){return a.model.get("filename")===c});e.model.trigger("delete");var f=tributary.__config__.contexts.indexOf(e);tributary.__config__.contexts.splice(f,1),delete e,tributary.__config__.todelete||(tributary.__config__.todelete=[]),tributary.__config__.todelete.push(c),d3.select(".tb_files").selectAll("div.fv").each(function(){this.dataset.filename===c&&$(this).remove()});var g=tributary.__config__.contexts[0].model;g.trigger("show"),d3.event.stopPropagation()});var g=d3.select(this.el).selectAll("div.plus").on("click",function(){var b=d3.select(this).select("input").style("display","inline-block");b.node().focus(),b.on("keypress",function(){if(d3.event.charCode===13){var c=tributary.make_context({filename:b.node().value,config:tributary.__config__});if(c){tributary.__config__.contexts.push(c),c.render(),c.execute();var d=tributary.make_editor({model:c.model});a.$el.empty(),a.render(),tributary.__config__.contexts.forEach(function(a){a.model.trigger("hide")}),c.model.trigger("show"),d.cm.focus(),f.attr("class",function(a,b){var c=this.dataset.filename.split(".")[1];return"fv type-"+c})}else b.classed("input_error",!0)}})})}}),tributary.FileView=Backbone.View.extend({render:function(){}}),tributary.ControlsView=Backbone.View.extend({initialize:function(){this.model.on("change:play",this.play_button,this),this.model.on("change:loop",this.time_slider,this),this.model.on("change:restart",this.restart_button,this)},render:function(){var a=d3.select(this.el);a.append("div").attr("id","time_controls"),a.append("div").attr("id","user_controls"),a.append("div").attr("id","time_options"),this.play_button(),this.time_slider(),this.restart_button()},play_button:function(){var a=d3.select(this.el).select("#time_controls");if(this.model.get("play")){var b=a.append("button").classed("play",!0).classed("button_on",!0).text("Play");b.on("click",function(a){tributary.pause?tributary.pause&&(b.classed("playing",!0),b.text("Pause")):(b.classed("playing",!1),b.text("Play"));if(tributary.t<1||!tributary.loop)tributary.pause=!tributary.pause,tributary.pause||(tributary.timer.then=new Date,tributary.timer.duration=(1-tributary.t)*tributary.duration,tributary.timer.ctime=tributary.t)})}else a.select("button.play").remove()},time_slider:function(){tributary.loop=this.model.get("loop");var a=d3.select(this.el).select("#time_controls");if(tributary.loop){var b=a.append("input").attr({type:"range",min:0,max:1,step:.01,value:0,name:"time"}).classed("time_slider",!0);$(b.node()).on("change",function(){tributary.t=parseFloat(this.value),tributary.pause&&tributary.execute()}),this.model.on("tick",function(a){$(b.node()).attr("value",tributary.t)});if(this.model.get("display")==="svg"){var c=a.append("button").classed("bv",!0).classed("button_on",!0).text("BV");c.on("click",function(){tributary.bv=!tributary.bv,tributary.events.trigger("execute")})}}else tributary.bv=!1,a.select("input.time_slider").remove(),a.select("button.bv").remove()},restart_button:function(){var a=this,b=d3.select(this.el).select("#time_controls");if(this.model.get("restart")){tributary.autoinit=!1;var c=b.append("button").classed("restart",!0).classed("button_on",!0).text("Restart");c.on("click",function(a){tributary.clear(),tributary.initialize(tributary.g,tributary),tributary.init(tributary.g),tributary.execute()})}else tributary.autoinit=!0,b.select("button.restart").remove()}}),tributary.batch={},tributary.batch._execute=function(){var a=_.functions(this);_.each(a,function(a){a!=="_execute"&&tributary.batch[a]()})},tributary.ui={};var display,panel_gui,panel,panel_handle,page,header;return tributary.ui.setup=function(){tributary.panel=new tributary.PanelView({el:".tb_panel"}),tributary.panel.render(),display=d3.select("#display"),panel=d3.select(".tb_panel"),panel_gui=d3.selectAll("div.tb_panel_gui"),panelfile_gui=d3.select(".tb_panelfiles_gui"),panel_handle=d3.select(".tb_panel_handle"),page=d3.select("#page"),header=d3.select("#header"),tributary.dims={display_percent:.7,page_width:0,page_height:0,display_width:0,display_height:0,panel_width:0,panel_height:0,panel_gui_width:0,panel_gui_height:31},tributary.events.on("resize",function(){var a=parseInt(panel.style("min-width"),10);tributary.dims.page_width=parseInt(page.style("width"),10),tributary.dims.page_width-tributary.dims.page_width*tributary.dims.display_percent<a?(tributary.dims.display_width=tributary.dims.page_width-a,tributary.dims.panel_width=a):(tributary.dims.display_width=tributary.dims.page_width*tributary.dims.display_percent,tributary.dims.panel_width=tributary.dims.page_width-tributary.dims.display_width),tributary.dims.panel_gui_width=tributary.dims.panel_width,tributary.dims.page_height=parseInt(page.style("height"),10),tributary.dims.display_height=tributary.dims.page_height-parseInt(header.style("height"),10),tributary.dims.panel_height=tributary.dims.display_height-tributary.dims.panel_gui_height,display.style("width",tributary.dims.display_width+"px"),panel.style("width",tributary.dims.panel_width+"px"),panel_gui.style("width",tributary.dims.panel_gui_width+"px"),panelfile_gui.style("width",tributary.dims.panel_gui_width+"px"),panel.style("height",tributary.dims.panel_height+"px"),panel.selectAll(".panel").style("height",tributary.dims.panel_height+"px"),panel.selectAll(".CodeMirror").style("height",tributary.dims.panel_height-tributary.dims.panel_gui_height+"px"),display.style("height",tributary.dims.display_height+"px"),panel_gui.style("height",tributary.dims.panel_gui_height+"px"),panel_gui.style("margin-top",tributary.dims.panel_gui_height+"px"),panel_handle.style("right",tributary.dims.panel_width+"px"),tributary.sw=tributary.dims.display_width,tributary.sh=tributary.dims.display_height,tributary.events.trigger("execute")}),tributary.events.trigger("resize");var a=d3.behavior.drag().on("drag",function(){var a=d3.event.dx/tributary.dims.page_width;tributary.dims.display_percent+a>=0&&tributary.dims.display_percent+a<=1&&(tributary.dims.display_percent+=a)
-,tributary.events.trigger("resize")});panel_handle.call(a)},tributary.ui.assemble=function(a){tributary.trace=!1,tributary.hint=!1;if(a.length>0)tributary.gist(a,_assemble);else{var b={};b.config=new tributary.Config,b.models=new tributary.CodeModels(new tributary.CodeModel),_assemble(b)}},tributary};
+var Tributary=function(){function _assemble(a){var b=a.config;tributary.__config__=b,b.contexts=[];var c,d,e,f,g=b.get("endpoint");tributary.endpoint&&(g=tributary.endpoint),g==="delta"?(b.set("display","svg"),b.set("play",!0),b.set("loop",!0),b.set("autoinit",!0)):g==="cypress"?(b.set("display","canvas"),b.set("play",!0),b.set("autoinit",!0)):g==="hourglass"?(b.set("display","svg"),b.set("play",!0),b.set("autoinit",!0)):g==="curiosity"?(b.set("display","webgl"),b.set("play",!0),b.set("autoinit",!0)):g==="bigfish"?(b.set("display","svg"),b.set("play",!0),b.set("autoinit",!1),b.set("restart",!0)):g==="fly"?(b.set("display","canvas"),b.set("play",!0),b.set("autoinit",!1),b.set("restart",!0)):g==="ocean"&&b.set("display","div"),b.get("display")||b.set("display","svg"),b.set("endpoint","");var h=panel.select(".tb_edit");tributary.edit=h,a.models.each(function(a){f=a.get("type"),c=tributary.make_context({config:b,model:a,display:display}),c&&(b.contexts.push(c),c.render(),mainfiles.indexOf(a.get("filename"))<0&&c.execute(),c.editor=tributary.make_editor({model:a,parent:h}),a.trigger("hide"))}),b.contexts.forEach(function(a){mainfiles.indexOf(a.model.get("filename"))>=0&&(a.model.trigger("show"),tributary.autoinit=!0,a.execute(),tributary.autoinit=b.get("autoinit"))});var i=new tributary.ConfigView({el:".tb_config",model:b});i.render();var j=new tributary.FilesView({el:".tb_files",model:b});j.render();var k=new tributary.ControlsView({el:".tb_controls",model:b});k.render(),setup_header(a),tributary.events.trigger("show",b.get("tab")),tributary.events.on("show",function(a){b.set("tab",a)}),tributary.dims.display_percent=b.get("display_percent"),tributary.events.trigger("resize"),tributary.events.on("resize",function(){b.set("display_percent",tributary.dims.display_percent)}),b.get("hidepanel")?tributary.events.trigger("hidepanel"):tributary.events.trigger("showpanel")}function setup_header(a){setup_save(a.config);if(a.user){var b=a.user.id;if(b===tributary.userid)var c='<input id="gist-title" value="'+a.gist.description+'" > by <!-- ya boy -->';else var c='"<span id="gist-title-static"><a href="'+a.gist.html_url+'">'+a.gist.description+'</a></span>" by ';a.user.url===""?c+=a.user.login:c+='<a href="'+a.user.url+'">'+a.user.login+"</a>",d3.select("title").text(a.gist.description||"Tributary"),$("#gist_info").html(c),a.user.id!==tributary.userid&&($("#forkPanel").css("display","none"),$("#savePanel").attr("id","forkPanel"),setup_save(a.config))}else if(isNaN(tributary.userid)||!a.gist)$("#forkPanel").css("display","none"),$("#savePanel").attr("id","forkPanel"),setup_save(a.config);$("#gist-title").on("keyup",function(){a.config.set("description",$("#gist-title").val()),d3.select("title").text($("#gist-title").val())})}function setup_save(a){$("#savePanel").off("click"),$("#savePanel").on("click",function(b){console.log("saving!"),d3.select("#syncing").style("display","block"),tributary.save_gist(a,"save",function(a,b){d3.select("#syncing").style("display","none")})}),$("#forkPanel").off("click"),$("#forkPanel").on("click",function(b){console.log("forking!"),d3.select("#syncing").style("display","block"),tributary.save_gist(a,"fork",function(a,b){window.onunload=!1,window.onbeforeunload=!1,window.location=a})}),$("#loginPanel").on("click",function(a){tributary.login_gist(tributary.loggedin,function(a,b){window.onunload=!1,window.onbeforeunload=!1,window.location=a})})}var tributary={};tributary.events=_.clone(Backbone.Events),tributary.data={},window.trib={},window.trib_options={},window.addEventListener("resize",function(a){tributary.events.trigger("resize",a)});var mainfiles=["inlet.js","inlet.coffee","sinwaves.js","squarecircle.js"];tributary.displays=[{name:"svg",description:"creates an <svg> element for you to use"},{name:"canvas",description:"creates a <canvas> element and gives you a Context for the canvas"},{name:"webgl",description:"gives you a Three.js WebGLRenderer scene"},{name:"html",description:"gives you <div id=display>"}],tributary.time_controls=[{name:"play",description:"gives you a play button, and tributary.t. if you provide tributary.run(g,t) it will be executed in a run loop"},{name:"loop",description:"gives you a loop where tributary.t goes from 0 to 1."},{name:"restart",description:"assumes you only want tributary.init(g) to be run when the restart button is clicked"}],tributary.make_context=function(a){var b,c,d,e,f=a.config;if(a.model)c=a.model,g=c.get("filename"),e=c.get("type");else{var g,h;a.filename?g=a.filename:g="inlet.js",a.content?h=a.content:h="";var i=g.split(".");e=i[i.length-1],c=new tributary.CodeModel({name:i[0],filename:g,code:h})}return a.display?d=a.display:d=d3.select("#display"),c.set("type",e),mainfiles.indexOf(g)>=0?b=new tributary.TributaryContext({config:f,model:c,el:d.node()}):e==="json"?(c.set("mode","json"),b=new tributary.JSONContext({config:f,model:c})):e==="csv"?(c.set("mode","text"),b=new tributary.CSVContext({config:f,model:c})):e==="tsv"?(c.set("mode","text"),b=new tributary.TSVContext({config:f,model:c})):e==="js"?b=new tributary.JSContext({config:f,model:c}):e==="coffee"?(c.set("mode","coffeescript"),b=new tributary.CoffeeContext({config:f,model:c})):e==="css"?(c.set("mode","css"),b=new tributary.CSSContext({config:f,model:c})):e==="html"?(c.set("mode","text/html"),b=new tributary.HTMLContext({config:f,model:c,el:d.node()})):e==="svg"&&g!=="inlet.svg"&&(c.set("mode","text/html"),b=new tributary.SVGContext({config:f,model:c,el:d.node()})),b},d3.selection.prototype.moveToFront=function(){return this.each(function(){this.parentNode.appendChild(this)})},tributary.appendSVGFragment=function(a,b){var c="<svg xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink>",d="</svg>",e=document.createRange();e.selectNode(a);var f=e.createContextualFragment(c+b+d),g=f.childNodes[0].childNodes;for(var h=0,i=g.length;h<i;h++)a.appendChild(g[0])},Handlebars.getTemplate=function(a,b){(Handlebars.templates===undefined||Handlebars.templates[a]===undefined)&&$.ajax({url:"/static/templates/"+a+".handlebars",success:function(c){Handlebars.templates===undefined&&(Handlebars.templates={}),Handlebars.templates[a]=Handlebars.compile(c),b&&b(template)}})},tributary.CodeModel=Backbone.Model.extend({defaults:{code:"",filename:"inlet.js",name:"inlet",type:"js",mode:"javascript"},initialize:function(){this.binder()},binder:function(){this.on("error",this.handle_error)},handle_error:function(a){tributary.trace&&(console.trace(),console.log(a))},handle_coffee:function(){var a=this.get("code");return this.get("mode")==="coffeescript"&&(a=CoffeeScript.compile(a,{bare:!0})),a},local_storage:function(a){a||(a="");var b=this.get("filename")+"/code/"+a;return localStorage[b]},set_local_storage:function(a,b){var c=this.get("filename")+"/code/"+b;localStorage[c]=a}}),tributary.CodeModels=Backbone.Collection.extend({model:tributary.CodeModel}),tributary.Config=Backbone.Model.extend({defaults:{description:"An inlet to Tributary",endpoint:"tributary",display:"svg","public":!0,require:[],fileconfigs:{},tab:"edit",display_percent:.7,play:!1,loop:!1,restart:!1,autoinit:!0,pause:!0,loop_type:"period",bv:!1,nclones:15,clone_opacity:.4,duration:3e3,ease:"linear",dt:.01},require:function(a,b){var c=this.get("require"),d=_.pluck(c,"url"),e=function(){return a(b,arguments)};require(d,e)},initialize:function(){this.on("hide",function(){this.contexts.forEach(function(a){a.model.trigger("hide")})},this)}}),tributary.ConfigView=Backbone.View.extend({initialize:function(){},render:function(){var a=this,b=Handlebars.templates.config,c={displays:tributary.displays,time_controls:tributary.time_controls,requires:this.model.get("require")};$(this.el).html(b(c));var d=d3.select(this.el).select(".displaycontrols").selectAll("div.config"),e=this.model.get("display");d.datum(function(){return this.dataset}),d.filter(function(a){return a.name===e}).classed("config_active",!0),d.on("click",function(b){d3.select(this.parentNode).selectAll("div.config").classed("config_active",!1),d3.select(this).classed("config_active",!0),a.model.set("display",b.name),tributary.events.trigger("execute")});var f=d3.select(this.el).select(".timecontrols").selectAll("div.config");f.datum(function(){return this.dataset}),f.filter(function(b){return a.model.get(b.name)}).classed("config_active",!0),f.on("click",function(b){var c=!a.model.get(b.name);d3.select(this).classed("config_active",c),a.model.set(b.name,c)});var g=d3.select(this.el).select(".editorcontrols");g.selectAll("div.config").on("click",function(a){$(this).attr("data-name")=="log-errors"&&(tributary.hint==1&&tributary.trace==1?($(this).removeClass("config_active"),tributary.hint=!1,tributary.trace=!1,tributary.events.trigger("execute")):(tributary.hint=!0,tributary.trace=!0,tributary.events.trigger("execute"),$(this).addClass("config_active")))});var h=d3.select(this.el).select(".requirecontrols"),i=h.selectAll(".plus"),j=h.selectAll(".tb_add"),k=h.select(".tb_add").select("input.name"),l=h.select(".tb_add").select("input.url");h.selectAll("div.config").datum(function(){return this.dataset}).select("span.delete").datum(function(){return this.dataset}).on("click",function(b){var c=a.model.get("require"),d=c.indexOf(b);c.splice(d,1),a.model.set("require",c),a.$el.empty(),a.render(),j.style("display","none")}),h.selectAll("div.config").on("click",function(b){j.style("display",""),k.node().value=b.name,l.node().value=b.url;var c=function(){var c=a.model.get("require"),d=_.find(c,function(a){return a.name===b.name});d.name=k.node().value,d.url=l.node().value,a.model.set("require",c),a.model.require(function(){},c),a.$el.empty(),a.render()};k.on("keypress",function(){d3.event.charCode===13&&c()}),l.on("keypress",function(){d3.event.charCode===13&&c()})}),i.on("click",function(){j.style("display",""),k.node().focus();var b=function(){var b={name:k.node().value,url:l.node().value},c=a.model.get("require");c.push(b),a.model.set("require",c),a.model.require(function(){},c),a.$el.empty(),a.render()};k.on("keypress",function(){d3.event.charCode===13&&b()}),l.on("keypress",function(){d3.event.charCode===13&&b()})})}}),tributary.Context=Backbone.View.extend({initialize:function(){},execute:function(){},render:function(){}}),tributary.TributaryContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",function(){tributary.events.trigger("execute")}),tributary.events.on("execute",this.execute,this),tributary.__config__||(tributary.__config__=this.options.config),this.model.on("change:code",function(){window.onbeforeunload||$(window).on("beforeunload",function(){return"Are you sure you want to leave?"})},this),this.config=this.options.config,this.config.on("change:display",this.set_display,this);var a=this.config;tributary.init=undefined,tributary.run=undefined,tributary.loop=a.get("loop"),tributary.autoinit=a.get("autoinit"),tributary.pause=a.get("pause"),tributary.loop_type=a.get("loop_type"),tributary.bv=a.get("bv"),tributary.nclones=a.get("nclones"),tributary.clone_opacity=a.get("clone_opacity"),tributary.duration=a.get("duration"),tributary.ease=d3.ease(a.get("ease")),tributary.t=0,tributary.dt=a.get("dt"),tributary.reverse=!1,tributary.useThreejsControls=!0,tributary.render=function(){},tributary.execute=function(){if(tributary.run!==undefined){var a=tributary.t;tributary.loop&&(a=tributary.ease(tributary.t)),tributary.run(tributary.g,a,0)}},tributary.timer={then:new Date,duration:tributary.duration,ctime:tributary.t},d3.timer(function(){tributary.render();if(tributary.pause)return!1;var b=new Date,c=b-tributary.timer.then,d;if(tributary.loop){tributary.reverse?d=tributary.timer.ctime*c/tributary.timer.duration*-1:d=(1-tributary.timer.ctime)*c/tributary.timer.duration,tributary.t=tributary.timer.ctime+d;if(tributary.t>=1||tributary.t<=0||tributary.t==="NaN")tributary.loop_type==="period"?(tributary.t=0,tributary.timer.then=new Date,tributary.timer.duration=tributary.duration,tributary.timer.ctime=tributary.t,tributary.reverse=!1):tributary.loop_type==="pingpong"?(tributary.t=!tributary.reverse,tributary.timer.then=new Date,tributary.timer.duration=tributary.duration,tributary.timer.ctime=tributary.t,tributary.reverse=!tributary.reverse):tributary.t!==0&&(tributary.t=1,tributary.pause=!0);tributary.t===!0&&(tributary.t=1),tributary.t===!1&&(tributary.t=0)}else tributary.t+=tributary.dt;tributary.execute(),a.trigger("tick",tributary.t)})},execute:function(){var a=this.model.handle_coffee();if(a.length>0&&this.model.get("type")!=="coffee"){var b=JSHINT(a,{asi:!0,laxcomma:!0,laxbreak:!0,loopfunc:!0,smarttabs:!0,sub:!0});b?this.model.trigger("nojshint"):this.model.trigger("jshint",JSHINT.errors)}try{tributary.initialize=new Function("g","tributary",a)}catch(c){return this.model.trigger("error",c),!1}try{window.trib={},window.trib_options={},trib=window.trib,trib_options=window.trib_options,tributary.autoinit&&(tributary.clear(),tributary.events.trigger("prerender")),this.clones&&$(this.clones.node()).empty(),tributary.bv&&this.make_clones(),tributary.initialize(tributary.g,tributary),tributary.autoinit&&tributary.init!==undefined&&tributary.init(tributary.g,0),tributary.execute()}catch(d){return this.model.trigger("error",d),!1}return this.model.trigger("noerror"),!0},render:function(){this.set_display()},set_display:function(){var a=this;this.$el.empty();var b=this.config.get("display");b==="svg"?this.make_svg():b==="canvas"?this.make_canvas():b==="webgl"?this.make_webgl():b==="div"?(this.g=d3.select(this.el),tributary.g=this.g,tributary.clear=function(){a.$el.empty()}):tributary.clear=function(){a.$el.empty()}},make_svg:function(){this.svg=d3.select(this.el).append("svg").attr({xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink","class":"tributary_svg"}),tributary.g=this.svg,tributary.clear=function(){$(tributary.g.node()).empty()}},make_canvas:function(){tributary.clear=function(){tributary.canvas.width=tributary.sw,tributary.canvas.height=tributary.sh,tributary.ctx.clearRect(0,0,tributary.sw,tributary.sh)},tributary.canvas=d3.select(this.el).append("canvas").classed("tributary_canvas",!0).node(),tributary.ctx=tributary.canvas.getContext("2d"),tributary.g=tributary.ctx},make_clones:function(){this.clones=this.svg.selectAll("g.clones").data([0]),this.clones.enter().append("g").attr("class","clones"),tributary.g=this.svg.selectAll("g.delta").data([0]),tributary.g.enter().append("g").attr("class","delta");var a=d3.range(tributary.nclones),b=this.clones.selectAll("g.bvclone").data(a).enter().append("g").attr("class","bvclone").style("opacity",tributary.clone_opacity);b.each(function(a,b){var c=b+1,d=d3.select(this);tributary.init(d,c);var e=tributary.ease(c/(tributary.nclones+1));tributary.run(d,e,c)})},make_webgl:function(){function b(){windowHalfX=tributary.sw/2,windowHalfY=tributary.sh/2,tributary.camera.aspect=tributary.sw/tributary.sh,tributary.camera.updateProjectionMatrix(),tributary.renderer.setSize(tributary.sw,tributary.sh)}container=this.el,tributary.camera=new THREE.PerspectiveCamera(70,tributary.sw/tributary.sh,1,1e3),tributary.camera.position.y=150,tributary.camera.position.z=500,tributary.scene=new THREE.Scene,THREE.Object3D.prototype.clear=function(){var a=this.children,b;for(b=a.length-1;b>=0;b--){var c=a[b];c.clear(),this.remove(c)}},tributary.renderer=new THREE.WebGLRenderer,tributary.renderer.setSize(tributary.sw,tributary.sh),container.appendChild(tributary.renderer.domElement);var a=new THREE.TrackballControls(tributary.camera);a.target.set(0,0,0),a.rotateSpeed=1,a.zoomSpeed=1.2,a.panSpeed=.8,a.noZoom=!1,a.noPan=!1,a.staticMoving=!1,a.dynamicDampingFactor=.15,tributary.controls=a,tributary.render=function(){tributary.useThreejsControls&&tributary.controls.update(),tributary.renderer.render(tributary.scene,tributary.camera)},tributary.render(),tributary.events.on("resize",b,!1),tributary.clear=function(){tributary.scene.clear()}}}),tributary.JSONContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{var a=JSON.parse(this.model.get("code"));tributary[this.model.get("name")]=a}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.JSContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){var js=this.model.get("code");if(js.length>0){var hints=JSHINT(js,{asi:!0,laxcomma:!0,laxbreak:!0,loopfunc:!0,smarttabs:!0,sub:!0});hints?this.model.trigger("nojshint"):this.model.trigger("jshint",JSHINT.errors)}try{eval(js)}catch(e){return this.model.trigger("error",e),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.CoffeeContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){var js=this.model.handle_coffee();try{eval(js)}catch(e){return this.model.trigger("error",e),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.CSVContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{var a=d3.csv.parse(this.model.get("code"));tributary[this.model.get("name")]=a}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.TSVContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{var a=d3.tsv.parse(this.model.get("code"));tributary[this.model.get("name")]=a}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.CSSContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",this.execute,this),this.model.on("change:code",function(){tributary.events.trigger("execute")})},execute:function(){try{this.el.textContent=this.model.get("code")}catch(a){return this.model.trigger("error",a),!1}return this.model.trigger("noerror"),!0},render:function(){this.el=d3.select("head").selectAll("style.csscontext").data([this.model],function(a){return a.cid}).enter().append("style").classed("csscontext",!0).attr({type:"text/css"}).node()}}),tributary.HTMLContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",function(){tributary.events.trigger("execute")}),tributary.events.on("prerender",this.execute,this)},execute:function(){try{$(this.el).append(this.model.get("code"))}catch(a){return this.model.trigger("error",a),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.SVGContext=tributary.Context.extend({initialize:function(){this.model.on("change:code",function(){tributary.events.trigger("execute")}),tributary.events.on("prerender",this.execute,this)},execute:function(){try{var a=d3.select(this.el).select("svg").node();tributary.appendSVGFragment(a,this.model.get("code"))}catch(b){return this.model.trigger("error",b),!1}return this.model.trigger("noerror"),!0},render:function(){}}),tributary.PanelView=Backbone.View.extend({initialize:function(){},render:function(){var a=this,b=["edit","config"],c=Handlebars.templates.panel,d=c(b);this.$el.html(d),panel=d3.select(".tb_panel"),panel_gui=d3.selectAll("div.tb_panel_gui");var e=60,f=panel_gui.selectAll("div.pb").on("click",function(a){tributary.events.trigger("show",this.dataset.name)});tributary.events.on("show",function(a){$(".tb_panel").children(".panel").css("display","none"),panel.select(".tb_"+a).style("display",""),panel_gui.selectAll("div.pb").classed("gui_active",!1),panel_gui.select(".tb_"+a+"_tab").classed("gui_active",!0)}),tributary.events.trigger("show","edit"),$(".tb_hide-panel-button").on("click",function(){tributary.events.trigger("hidepanel"),$("#display").addClass("fullscreen"),$("svg").addClass("fullscreen"),$("#header").addClass("dimheader")}),$("#show-codepanel-button").on("click",function(){tributary.events.trigger("showpanel"),$("#display").removeClass("fullscreen"),$("svg").removeClass("fullscreen"),$("#header").removeClass("dimheader")}),tributary.events.on("hidepanel",function(){$(".tb_panel").hide(),$(".tb_panel_gui").hide(),$(".tb_panel_handle").hide(),$(".tb_panelfiles_gui").hide(),$("#show-codepanel").show(),tributary.__config__&&tributary.__config__.set("hidepanel",!0)}),tributary.events.on("showpanel",function(){$(".tb_panel").show(),$(".tb_panel_gui").show(),$(".tb_panel_handle").show(),$(".tb_panelfiles_gui").show(),$("#show-codepanel").hide(),tributary.__config__&&tributary.__config__.set("hidepanel",!1)})}}),tributary.make_editor=function(a){var b=a.parent||tributary.edit,c=a.model;a.container?container=a.container:container=b.append("div").attr("id",c.cid);var d;return d=new tributary.Editor({el:container.node(),model:c}),d.render(),d},tributary.Editor=Backbone.View.extend({initialize:function(){this.model.on("show",function(){d3.select(this.el).style("display","")},this),this.model.on("hide",function(){d3.select(this.el).style("display","none")},this),this.model.on("delete",function(){this.$el.remove()},this)},getConfig:function(){var a=tributary.__config__.get("fileconfigs"),b=a[this.model.get("filename")];return b?b:this.defaultConfig()},setConfig:function(a,b){var c=tributary.__config__.get("fileconfigs"),d=c[this.model.get("filename")];d[a]=b;var c=tributary.__config__.set("fileconfigs",c)},defaultConfig:function(){var a=tributary.__config__.get("fileconfigs"),b={"default":!0,vim:!1,emacs:!1,fontSize:12};a[this.model.get("filename")]=b;var a=tributary.__config__.set("fileconfigs",a);return b},render:function(){var a=this,b=d3.select(this.el).classed("editor",!0),c=Handlebars.templates.editor,d=c(this.getConfig());this.$el.html(d),filetype=a.model.get("filename").split(".")[1];if(filetype=="js")var e="lesser-dark";else if(filetype=="svg")var e="vibrant-ink";else if(filetype=="html")var e="ambiance";else if(filetype=="coffee")var e="elegant";else if(filetype=="css")var e="elegant";else var e="lesser-dark";var f={mode:a.model.get("mode"),theme:e,lineNumbers:!0};a.model.get("mode")==="json"&&(f.mode="javascript",f.json=!0),this.cm=CodeMirror(this.el,f),this.cm.on("change",function(){var b=a.cm.getValue();a.model.set("code",b)}),this.cm.setValue(this.model.get("code")),this.inlet=Inlet(this.cm),this.model.on("error",function(){d3.select(a.el).select(".CodeMirror-gutter").classed("error",!0)}),this.model.on("noerror",function(){d3.select(a.el).select(".CodeMirror-gutter").classed("error",!1)});var g=b.select(".toolbar"),h=b.select(".settings").on("click",function(){g.classed("hidden",!g.classed("hidden")),h.classed("active-settings",!g.classed("hidden"))});g.selectAll(".radio").on("change",function(){a.setConfig("default",!1),a.setConfig("vim",!1),a.setConfig("emacs",!1),a.setConfig(this.value,!0),a.cm.setOption("keyMap",this.value)}),g.select(".plusFontSize").on("click",function(){var b=a.getConfig(),c=b.fontSize+1;a.setConfig("fontSize",c);var d=a.cm.getWrapperElement();d3.select(d).select(".CodeMirror-scroll").style({"font-size":c+"px","line-height":c+"px"}),a.cm.refresh()}),g.select(".minusFontSize").on("click",function(){var b=a.getConfig(),c=b.fontSize-1;a.setConfig("fontSize",c);var d=a.cm.getWrapperElement();d3.select(d).select(".CodeMirror-scroll").style({"font-size":c+"px","line-height":c+"px"}),a.cm.refresh()});var i=a.getConfig(),j=i.fontSize,k=a.cm.getWrapperElement();d3.select(k).select(".CodeMirror-scroll").style({"font-size":j+"px","line-height":j+"px"}),a.cm.refresh()}}),tributary.gist=function(a,b){function f(a){c.gist=a,a.user===null||a.user===undefined?c.user={login:"anon",url:"",userid:-1}:c.user=a.user;var d;try{d=a.files["config.json"]}catch(e){d=!1}if(d)try{c.config=new tributary.Config(JSON.parse(d.content))}catch(f){c.config=new tributary.Config}else c.config=new tributary.Config;var g=_.keys(a.files);fileconfigs=c.config.get("fileconfigs")||{},c.models=new tributary.CodeModels;var h,i,j,k=0,l;g.forEach(function(b){h=b.split("."),l=h[h.length-1],b!=="config.json"&&(i=new tributary.CodeModel({filename:b,name:h[0],code:a.files[b].content,type:l}),c.models.add(i)),fileconfigs[b]||(fileconfigs[b]={"default":!0,vim:!1,emacs:!1,fontSize:12})}),c.config.set("fileconfigs",fileconfigs),c.config.require(b,c)}tributary.gistid=a;var c={},d="?cachebust="+Math.random()*0xf12765df4c9b2,e="https://api.github.com/gists/"+a+d;$.ajax({url:e,contentType:"application/json",dataType:"json",success:f,error:function(b){console.log(b),e="/gist/"+a+d,$.ajax({url:e,contentType:"application/json",dataType:"json",success:f,error:function(a){console.log(a)}})}})},tributary.save_gist=function(a,b,c){var d=tributary.gistid||"",e={description:a.get("description"),"public":a.get("public"),files:{}};a.contexts.forEach(function(a){e.files[a.model.get("filename")]={content:a.model.get("code")}}),a.todelete&&a.todelete.forEach(function(a){e.files[a]=null}),e.files["config.json"]={content:JSON.stringify(a.toJSON())};var f;b==="save"?f="/tributary/save":b==="fork"&&(f="/tributary/fork"),d.length>4&&(f+="/"+d);var g=this;$.post(f,{gist:JSON.stringify(e)},function(a){typeof a=="string"&&(a=JSON.parse(a));var b=a.id,d="/inlet/"+b;c(d,b)})},tributary.login_gist=function(a,b){var c;a?c="/github-logout":c="/github-login",c+="/inlet",tributary.gistid&&(c+="/"+tributary.gistid),b(c)},tributary.FilesView=Backbone.View.extend({initialize:function(){},render:function(){var a=this,b=Handlebars.templates.files,c=_.map(tributary.__config__.contexts,function(a){return a.model.toJSON()});c=c.sort(function(a,b){return a.filename<b.filename?-1:1});var d=_.find(c,function(a){return a.filename==="inlet.js"||a.filename==="inlet.coffee"});d&&(c.splice(c.indexOf(d),1),c.unshift(d));var e={contexts:c};$(this.el).html(b(e));var f=d3.select(this.el).selectAll("div.fv");f.on("click",function(b){var c=this.dataset.filename;if(a.model){var d=_.find(tributary.__config__.contexts,function(a){return a.model.get("filename")===c});a.model.trigger("hide"),d.model.trigger("show")}tributary.events.trigger("show","edit")}),f.attr("class",function(a,b){var c=this.dataset.filename.split(".")[1];return"fv type-"+c}),f.select(".delete-file").style("z-index",1e3).on("click",function(){var b=this.parentNode.dataset,c=b.filename,d=b.filename.split(".")[0];delete a.model,tributary.__config__.unset(c);var e=_.find(tributary.__config__.contexts,function(a){return a.model.get("filename")===c});e.model.trigger("delete");var f=tributary.__config__.contexts.indexOf(e);tributary.__config__.contexts.splice(f,1),delete e,tributary.__config__.todelete||(tributary.__config__.todelete=[]),tributary.__config__.todelete.push(c),d3.select(".tb_files").selectAll("div.fv").each(function(){this.dataset.filename===c&&$(this).remove()});var g=tributary.__config__.contexts[0].model;g.trigger("show"),d3.event.stopPropagation()});var g=d3.select(this.el).selectAll("div.plus").on("click",function(){var b=d3.select(this).select("input").style("display","inline-block");b.node().focus(),b.on("keypress",function(){if(d3.event.charCode===13){var c=tributary.make_context({filename:b.node().value,config:tributary.__config__});if(c){tributary.__config__.contexts.push(c),c.render(),c.execute();var d=tributary.make_editor({model:c.model});a.$el.empty(),a.render(),tributary.__config__.contexts.forEach(function(a){a.model.trigger("hide")}),c.model.trigger("show"),d.cm.focus(),f.attr("class",function(a,b){var c=this.dataset.filename.split(".")[1];return"fv type-"+c})}else b.classed("input_error",!0)}})})}}),tributary.FileView=Backbone.View.extend({render:function(){}}),tributary.ControlsView=Backbone.View.extend({initialize:function(){this.model.on("change:play",this.play_button,this),this.model.on("change:loop",this.time_slider,this),this.model.on("change:restart",this.restart_button,this)},render:function(){var a=d3.select(this.el);a.append("div").attr("id","time_controls"),a.append("div").attr("id","user_controls"),a.append("div").attr("id","time_options"),this.play_button(),this.time_slider(),this.restart_button()},play_button:function(){var a=d3.select(this.el).select("#time_controls");if(this.model.get("play")){var b=a.append("button").classed("play",!0).classed("button_on",!0).text("Play");b.on("click",function(a){tributary.pause?tributary.pause&&(b.classed("playing",!0),b.text("Pause")):(b.classed("playing",!1),b.text("Play"));if(tributary.t<1||!tributary.loop)tributary.pause=!tributary.pause,tributary.pause||(tributary.timer.then=new Date,tributary.timer.duration=(1-tributary.t)*tributary.duration,tributary.timer.ctime=tributary.t)})}else a.select("button.play").remove()},time_slider:function(){tributary.loop=this.model.get("loop");var a=d3.select(this.el).select("#time_controls");if(tributary.loop){var b=a.append("input").attr({type:"range",min:0,max:1,step:.01,value:0,name:"time"}).classed("time_slider",!0);$(b.node()).on("change",function(){tributary.t=parseFloat(this.value),tributary.pause&&tributary.execute()}),this.model.on("tick",function(a){$(b.node()).attr("value",tributary.t)});if(this.model.get("display")==="svg"){var c=a.append("button").classed("bv",!0).classed("button_on",!0).text("BV");c.on("click",function(){tributary.bv=!tributary.bv,tributary.events.trigger("execute")})}}else tributary.bv=!1,a.select("input.time_slider").remove(),a.select("button.bv").remove()},restart_button:function(){var a=this,b=d3.select(this.el).select("#time_controls");if(this.model.get("restart")){tributary.autoinit=!1;var c=b.append("button").classed("restart",!0).classed("button_on",!0).text("Restart");c.on("click",function(a){tributary.clear(),tributary.initialize(tributary.g,tributary),tributary.init(tributary.g),tributary.execute()})}else tributary.autoinit=!0,b.select("button.restart").remove()}}),tributary.batch={},tributary.batch._execute=function(){var a=_.functions(this);_.each(a,function(a){a!=="_execute"&&tributary.batch[a]()})},tributary.ui={};var display,panel_gui,panel,panel_handle,page,header;return tributary.ui.setup=function(){tributary.panel=new tributary.PanelView({el:".tb_panel"}),tributary.panel.render(),display=d3.select("#display"),panel=d3.select(".tb_panel"),panel_gui=d3.selectAll("div.tb_panel_gui"),panelfile_gui=d3.select(".tb_panelfiles_gui"),panel_handle=d3.select(".tb_panel_handle"),page=d3.select("#page"),header=d3.select("#header"),tributary.dims={display_percent:.7,page_width:0,page_height:0,display_width:0,display_height:0,panel_width:0,panel_height:0,panel_gui_width:0,panel_gui_height:31},tributary.events.on("resize",function(){var a=parseInt(panel.style("min-width"),10);tributary.dims.page_width=parseInt(page.style("width"),10),tributary.dims.page_width-tributary.dims.page_width*tributary.dims.display_percent<a?(tributary.dims.display_width=tributary.dims.page_width-a,tributary.dims.panel_width=a):(tributary.dims.display_width=tributary.dims.page_width*tributary.dims.display_percent,tributary.dims.panel_width=tributary.dims.page_width-tributary.dims.display_width),tributary.dims.panel_gui_width=tributary.dims.panel_width,tributary.dims.page_height=parseInt(page.style("height"),10),tributary.dims.display_height=tributary.dims.page_height-parseInt(header.style("height"),10),tributary.dims.panel_height=tributary.dims.display_height-tributary.dims.panel_gui_height,display.style("width",tributary.dims.display_width+"px"),panel.style("width",tributary.dims.panel_width+"px"),panel_gui.style("width",tributary.dims.panel_gui_width+"px"),panelfile_gui.style("width",tributary.dims.panel_gui_width+"px"),panel.style("height",tributary.dims.panel_height+"px"),panel.selectAll(".panel").style("height",tributary.dims.panel_height+"px"),panel.selectAll(".CodeMirror").style("height",tributary.dims.panel_height-tributary.dims.panel_gui_height+"px"),display.style("height",tributary.dims.display_height+"px"),panel_gui.style("height",tributary.dims.panel_gui_height+"px"),panel_gui.style("margin-top",tributary.dims.panel_gui_height+"px"),panel_handle.style("right",tributary.dims.panel_width+"px"),tributary.sw=tributary.dims.display_width,tributary.sh=tributary.dims.display_height,tributary.events.trigger("execute")}),tributary.events.trigger("resize");var a=d3.behavior.drag().on("drag",function(){var a=d3.event.dx/tributary.dims.page_width;tributary.dims.display_percent+a>=0&&tributary.dims.display_percent+a<=1&&(tributary.dims.display_percent+=
+a),tributary.events.trigger("resize")});panel_handle.call(a)},tributary.ui.assemble=function(a){tributary.trace=!1,tributary.hint=!1;if(a.length>0)tributary.gist(a,_assemble);else{var b={};b.config=new tributary.Config,b.models=new tributary.CodeModels(new tributary.CodeModel),_assemble(b)}},tributary};

0 comments on commit 5eb4867

Please sign in to comment.