(function(){!function(a){return"function"==typeof define&&define.amd?define(["underscore","backbone","exports"],a):"object"==typeof exports?a(require("underscore"),require("backbone"),exports):a(_,Backbone,{})}(function(a,b,c){return c=function(){function c(a){this.options=null!=a?a:{},this.genes=this.options.genes||{},this.views=this.options.views||[]}return c.prototype.bind=function(a){if(!(a||a instanceof b.View))throw"No view to bind to, please pass along your view as bind(view)";return this.setViewEvents(a),this.setGenes(a),this.views.push(a)},c.prototype.setViewEvents=function(a){return a.listenTo(a,"dom:refresh",function(b){return function(){return b.setGenes(a)}}(this)),a.listenTo(a,"destroy",function(b){return function(){return b.remove(a)}}(this))},c.prototype.setGenes=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;for(e=b.$("[data-gene]"),h=!0,n=[],j=0,l=e.length;l>j;j++){for(d=e[j],g=$(d).data("gene").split(" "),k=0,m=g.length;m>k;k++)f=g[k],(!a.isUndefined(this.genes[""+f])||this.genes[""+f])&&(h=!1);h?($(d).remove(),n.push(function(){var a;a=[];for(f in g)a.push(b.bindings?function(){var a;a=[];for(c in b.bindings)i=b.bindings[c].selector||b.bindings[c],a.push(i==="[data-gene="+f+"]"?delete b.bindings[c]:void 0);return a}():void 0);return a}())):n.push(void 0)}return n},c.prototype.remove=function(b){return this.views=a.without(this.views,b)},c.prototype.set=function(a){var b,c;c=[];for(b in a)c.push(this.genes[""+b]=a[b]);return c},c}(),b.Genetics=c,b.Genetics})}).call(this);