var __bind=function(a,b){return function(){return a.apply(b,arguments)}},__hasProp=Object.prototype.hasOwnProperty,__extends=function(a,b){function d(){this.constructor=a}for(var c in b)__hasProp.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};define(["backbone","common/utils"],function(a,b){var c,d,e;return c=function(){function b(){this.update=__bind(this.update,this),this.destroy=__bind(this.destroy,this),this.remove=__bind(this.remove,this),this.reset=__bind(this.reset,this),this.add=__bind(this.add,this),this.all=__bind(this.all,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a.View),b.prototype.viewClass=a.View,b.prototype.defaultContent=null,b.prototype.initialize=function(){this.childViews={},this.collection.bind("add",this.add),this.collection.bind("reset",this.reset),this.collection.bind("remove",this.remove),this.collection.bind("destroy",this.destroy),this.collection.bind("change",this.update);if(this.defaultContent)return this.collection.bind("all",this.all),this.defaultContent=this.$(this.defaultContent).detach(),this.el.append(this.defaultContent)},b.prototype.insertChild=function(a){return this.el.append(a.el)},b.prototype.all=function(){return this.collection.length?this.defaultContent.hide():this.defaultContent.show()},b.prototype.add=function(a){var b;return(b=this.childViews[a.id||a.cid])?clearTimeout(b._destroyTimer):(b=this.childViews[a.id||a.cid]=(new this.viewClass({model:a})).render(),this.insertChild(b)),b},b.prototype.reset=function(a,b){return a.each(this.add)},b.prototype.remove=function(a){var b;return b=this.childViews[a.id||a.cid],b.el.detach(),b._destroyTimer=setTimeout(__bind(function(){return this.destroy(a)},this),1e4)},b.prototype.destroy=function(a){return this.childViews[a.id||a.cid].el.remove()},b.prototype.update=function(a){var b;return b=this.childViews[a.id||a.cid],!b&&(b=this.childViews[a.cid])&&(this.childViews[a.id]=b,delete this.childViews[a.cid]),b.render()},b}(),d={collapsedLength:5,getItems:function(){return this.el.children()},getHiddenItems:function(){return this.getItems().filter(":gt("+(this.collapsedLength-1)+")")},getExpanderText:function(){return"Show "+this.getHiddenItems().length+" more.."},renderExpander:function(){return this.expander=this.$('<a class="expand-list" href="#">'+this.getExpanderText()+"</a>").bind("click",__bind(function(){return this.expand(),!1},this)),this.el.after(this.expander)},expand:function(){return this.getHiddenItems().show(),this.expander.remove()},collapse:function(){this.expander&&this.expander.remove();if(this.getItems().length>this.collapsedLength)return this.getHiddenItems().hide(),this.renderExpander()}},e=function(){function b(){b.__super__.constructor.apply(this,arguments)}return __extends(b,a.View),b}(),b.include(e,d),{View:c,ExpandableListMixin:d,ExpandableList:e}})