var __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/models/polling"],function(a,b){var c,d,e;return c=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.url=function(){var a;return a=b.__super__.url.apply(this,arguments),/\/$/.test(a)||(a+="/"),a},b.prototype.initialize=function(){return this.bind("change",function(){return App.hub.publish("report/change",this)})},b}(a.Model),d=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.url=App.endpoints.reports,b.prototype.model=c,b.prototype.comparator=function(a){return-Number(new Date(a.get("modified")))},b}(b.Collection),e=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.url=App.endpoints.session.report,b.prototype.defaults={name:"click to give your report a name...",description:"click to give your report a description..."},b.prototype.initialize=function(){var a=this;return b.__super__.initialize.apply(this,arguments),App.hub.subscribe("report/clear",function(){return a.clear({silent:!0}),a.save(null,{success:function(){return window.location=App.endpoints.define}})}),App.hub.subscribe("report/change",function(b){if(b.id===a.get("reference_id"))return a.set(b.toJSON())})},b.prototype.push=function(){return this.save(null,{url:this.get("permalink"),success:function(){return App.hub.publish("report/push",this)}})},b.prototype.revert=function(){return this.save(null,{data:JSON.stringify({revert:!0}),contentType:"application/json",success:function(){return App.hub.publish("report/revert",this)}})},b}(b.Model),{Model:c,Collection:d,Session:e}})