todomvc
Version:
> Helping you select an MV\* framework
2 lines • 95.6 kB
JavaScript
(function(){var t=function(e,n){var r=t.resolve(e,n||"/"),i=t.modules[r];if(!i)throw Error("Failed to resolve module "+e+", tried "+r);var o=t.cache[r],s=o?o.exports:i();return s};t.paths=[],t.modules={},t.cache={},t.extensions=[".js",".coffee",".json"],t._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},t.resolve=function(){return function(e,n){function r(e){if(e=a.normalize(e),t.modules[e])return e;for(var n=0;t.extensions.length>n;n++){var r=t.extensions[n];if(t.modules[e+r])return e+r}}function i(e){e=e.replace(/\/+$/,"");var n=a.normalize(e+"/package.json");if(t.modules[n]){var i=t.modules[n](),o=i.browserify;if("object"==typeof o&&o.main){var s=r(a.resolve(e,o.main));if(s)return s}else if("string"==typeof o){var s=r(a.resolve(e,o));if(s)return s}else if(i.main){var s=r(a.resolve(e,i.main));if(s)return s}}return r(e+"/index")}function o(t,e){for(var n=s(e),o=0;n.length>o;o++){var a=n[o],l=r(a+"/"+t);if(l)return l;var h=i(a+"/"+t);if(h)return h}var l=r(t);return l?l:void 0}function s(t){var e;e="/"===t?[""]:a.normalize(t).split("/");for(var n=[],r=e.length-1;r>=0;r--)if("node_modules"!==e[r]){var i=e.slice(0,r+1).join("/")+"/node_modules";n.push(i)}return n}if(n||(n="/"),t._core[e])return e;var a=t.modules.path();n=a.resolve("/",n);var l=n||"/";if(e.match(/^(?:\.\.?\/|\/)/)){var h=r(a.resolve(l,e))||i(a.resolve(l,e));if(h)return h}var u=o(e,l);if(u)return u;throw Error("Cannot find module '"+e+"'")}}(),t.alias=function(e,n){var r=t.modules.path(),i=null;try{i=t.resolve(e+"/package.json","/")}catch(o){i=t.resolve(e,"/")}for(var s=r.dirname(i),a=(Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e})(t.modules),l=0;a.length>l;l++){var h=a[l];if(h.slice(0,s.length+1)===s+"/"){var u=h.slice(s.length);t.modules[n+u]=t.modules[s+u]}else h===s&&(t.modules[n]=t.modules[s])}},function(){var e={},n="undefined"!=typeof window?window:{},r=!1;t.define=function(i,o){!r&&t.modules.__browserify_process&&(e=t.modules.__browserify_process(),r=!0);var s=t._core[i]?"":t.modules.path().dirname(i),a=function(e){var n=t(e,s),r=t.cache[t.resolve(e,s)];return r&&null===r.parent&&(r.parent=l),n};a.resolve=function(e){return t.resolve(e,s)},a.modules=t.modules,a.define=t.define,a.cache=t.cache;var l={id:i,filename:i,exports:{},loaded:!1,parent:null};t.modules[i]=function(){return t.cache[i]=l,o.call(l.exports,a,l,l.exports,s,i,e,n),l.loaded=!0,l.exports}}}(),t.define("path",function(t,e,n,r,i,o){function s(t,e){for(var n=[],r=0;t.length>r;r++)e(t[r],r,t)&&n.push(t[r]);return n}function a(t,e){for(var n=0,r=t.length;r>=0;r--){var i=t[r];"."==i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var l=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){for(var t="",e=!1,n=arguments.length;n>=-1&&!e;n--){var r=n>=0?arguments[n]:o.cwd();"string"==typeof r&&r&&(t=r+"/"+t,e="/"===r.charAt(0))}return t=a(s(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."},n.normalize=function(t){var e="/"===t.charAt(0),n="/"===t.slice(-1);return t=a(s(t.split("/"),function(t){return!!t}),!e).join("/"),t||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(s(t,function(t){return t&&"string"==typeof t}).join("/"))},n.dirname=function(t){var e=l.exec(t)[1]||"",n=!1;return e?1===e.length||n&&3>=e.length&&":"===e.charAt(1)?e:e.substring(0,e.length-1):"."},n.basename=function(t,e){var n=l.exec(t)[2]||"";return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){return l.exec(t)[3]||""}}),t.define("__browserify_process",function(t,e,n,r,i,o){var o=e.exports={};o.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){if(t.source===window&&"browserify-tick"===t.data&&(t.stopPropagation(),n.length>0)){var e=n.shift();e()}},!0),function(t){n.push(t),window.postMessage("browserify-tick","*")}}return function(t){setTimeout(t,0)}}(),o.title="browser",o.browser=!0,o.env={},o.argv=[],o.binding=function(e){if("evals"===e)return t("vm");throw Error("No such module. (Possibly not yet loaded)")},function(){var e,n="/";o.cwd=function(){return n},o.chdir=function(r){e||(e=t("path")),n=e.resolve(r,n)}}()}),t.define("/collection.coffee",function(t,e,n){(function(){var e,r,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty,l=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=t("./view").View,i=t("./util"),n.Collection=r=function(t){function e(){return this.draw=s(this.draw,this),this.createView=s(this.createView,this),this.refresh=s(this.refresh,this),this.afterRender=s(this.afterRender,this),this.release=s(this.release,this),this.init=s(this.init,this),e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.tag="ul",e.prototype.skipTemplate=!0,e.prototype.init=function(){var t,n;return e.__super__.init.apply(this,arguments),i.log("collection","init"),this.itemViews={},this.localMozartModel=i._getPath("Mozart.Model"),this.localMozartInstanceCollection=i._getPath("Mozart.InstanceCollection"),null!=this.filterAttribute&&(this.bind("change:filterAttribute",this.draw),this.bind("change:filterText",this.draw)),null!=this.sortAttribute&&(this.bind("change:sortAttribute",this.draw),this.bind("change:sortDescending",this.draw)),null==this.pageSize&&this.set("pageSize",1e4),null==this.pageCurrent&&this.set("pageCurrent",0),this.bind("change:pageSize",this.draw),this.bind("change:pageCurrent",this.draw),null==(n=this.method)&&(this.method="all"),this.bind("change:collection",this.afterRender),this.bind("change:method",this.afterRender),"function"==typeof(t=this.collection).bind?t.bind("change",this.afterRender):void 0},e.prototype.release=function(){var t;return"function"==typeof(t=this.collection).unbind&&t.unbind("change",this.afterRender),e.__super__.release.apply(this,arguments)},e.prototype.afterRender=function(){return this.refresh(),this.draw()},e.prototype.refresh=function(){var t,e,n,r,o,s,a,l,h,u,c,d,p,f,g,y;if(i.log("collection","refresh"),this.dataSet={},null!=this.collection)if(i.isObject(this.collection)){if(i.isFunction(this.collection[this.method+"AsMap"]))this.dataSet=this.collection[this.method+"AsMap"]();else if(i.isFunction(this.collection[this.method]))for(c=this.collecton[this.method](),o=0,l=c.length;l>o;o++)e=c[o],this.dataSet[e.id]=e}else if(i.isFunction(this.collection))for(d=this.collection(),s=0,h=d.length;h>s;s++)e=d[s],this.dataSet[e.id]=e;else if(i.isArray(this.collection))for(p=this.collection,a=0,u=p.length;u>a;a++)e=p[a],this.dataSet[e.id]=e;else console.error("Collection: "+typeof this.collection+" can't be iterated");n=[],f=this.itemViews;for(t in f)r=f[t],null==this.dataSet[t]&&n.push(t);for(y=[];n.length>0;)t=n.pop(),i.log("collection","destroyView",t,this.itemViews[t]),this.removeView(this.itemViews[t]),null!=(g=this.itemViews[t].element)&&g.remove(),this.layout.queueReleaseView(this.itemViews[t]),y.push(delete this.itemViews[t]);return y},e.prototype.createView=function(t){var e,n;return i.log("collection","createView",t,"layout",this.layout.rootElement),e={content:t,parent:this},this.viewClass===o&&(e.tag="li"),null!=this.viewClassTemplateName&&(e.templateName=this.viewClassTemplateName),null!=this.viewClassTemplateFunction&&(e.templateFunction=this.viewClassTemplateFunction),null!=this.collectionTag&&(e.tag=this.collectionTag),null!=this.collectionClassNames&&(e.classNames=this.collectionClassNames),null!=this.tooltips&&(e.tooltips=this.tooltips),n=this.layout.createView(this.viewClass,e),this.element.append(n.createElement()),this.itemViews[t.id]=n,this.addView(n),this.layout.queueRenderView(n)},e.prototype.draw=function(){var t,e,n,r,o,s,a,l,h,u,c,d,p,f,g,y,m,v,w,b,C,M;v=this.itemViews;for(o in v)u=v[o],null!=(w=u.element)&&w.detach();if(this.displayOrder=_(this.dataSet).values(),this.hidden={},null!=this.sortAttribute&&i.sortBy(this.displayOrder,this.sortAttribute),this.sortDescending&&this.displayOrder.reverse(),null!=this.filterText&&null!=this.filterAttribute&&this.filterText.length>0)for(a=(""+this.filterText).toLowerCase(),b=this.displayOrder,d=0,g=b.length;g>d;d++)for(s=b[d],r=!0,C=this.filterAttribute.split(","),p=0,y=C.length;y>p;p++)n=C[p],c=i.getPath(s,n),null!=c&&(r=r&&-1===(""+c).toLowerCase().indexOf(a)),r&&(this.hidden[s.id]=1);for(l=this.pageCurrent*this.pageSize,t=0,h=0,e=0,M=this.displayOrder,f=0,m=M.length;m>f;f++)s=M[f],null==this.hidden[s.id]&&(l>t||e>=this.pageSize||(null==this.itemViews[s.id]&&this.createView(s),this.element.append(this.itemViews[s.id].element),e++),h++),t++;return this.set("pageTotal",Math.ceil(h/this.pageSize)),this.pageCurrent>this.pageTotal?this.set("pageCurrent",this.pageTotal-1):void 0},e}(o),n.BoundView=e=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.init=function(){return e.__super__.init.apply(this,arguments),this.content.bind("change",this.redraw)},e.prototype.release=function(){return this.content.unbind("change",this.redraw),e.__super__.release.apply(this,arguments)},e}(o)}).call(this)}),t.define("/view.coffee",function(t,e,n){(function(){var e,r,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};e=t("./object").MztObject,r=t("./util"),n.View=i=function(t){function e(){return this.copyHtmlAttrsToElement=o(this.copyHtmlAttrsToElement,this),this.getHtmlAttrsMap=o(this.getHtmlAttrsMap,this),this.createElement=o(this.createElement,this),this.release=o(this.release,this),this.hasAncestor=o(this.hasAncestor,this),this.removeView=o(this.removeView,this),this.namedChildViewExists=o(this.namedChildViewExists,this),this.childView=o(this.childView,this),this.addView=o(this.addView,this),this.redraw=o(this.redraw,this),this.postRender=o(this.postRender,this),this.replaceElement=o(this.replaceElement,this),this.findElementInPreparedContent=o(this.findElementInPreparedContent,this),this.reassignElements=o(this.reassignElements,this),this.prepareElement=o(this.prepareElement,this),this.init=o(this.init,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.tag="div",e.prototype.disableHtmlAttributes=!1,e.prototype.idPrefix="view",e.prototype.init=function(){var t,e,n;return null==(t=this.id)&&(this.id=""+this.idPrefix+"-"+this._mozartId),this.childViews={},null==(e=this.context)&&(this.context={}),this.namedChildViews={},this.valid=!0,this.domBindings={},null==(n=this.display)&&(this.display=!0),null!=this.parent&&this.parent.addView(this),null==this.templateFunction&&null==this.skipTemplate&&(null==this.templateName&&r.error("View: View has no templateName or templateFunction","view",this),this.templateFunction=HandlebarsTemplates[this.templateName]),r.log("views","view "+this.id+" init"),this.bind("change:display",this.redraw)},e.prototype.prepareElement=function(){return this.released?void 0:(this.newElement=this.createElement(),!this.skipTemplate&&this.display?this.newElement.innerHTML=this.templateFunction(this,{data:this}):void 0)},e.prototype.reassignElements=function(){var t,e,n;n=this.childViews;for(t in n)e=n[t],e.reassignElements();return null!=this.parent?this.el=this.parent.findElementInPreparedContent(this.id):void 0},e.prototype.findElementInPreparedContent=function(t){var e;return this.newElement?e=this._find(this.newElement,t):null},e.prototype._find=function(t,e){var n,r,i,o,s;if(t.id===e)return t;for(s=t.children,i=0,o=s.length;o>i;i++)if(n=s[i],r=this._find(n,e),null!=r)return r;return null},e.prototype.replaceElement=function(){var t,e,n;if(!this.released&&this.el){n=this.childViews;for(t in n)e=n[t],e.replaceElement();return this.el!==this.newElement&&(this.oldEl=this.el,this.el.parentNode.replaceChild(this.newElement,this.el),null!=this.layout&&this.el===this.layout.rootEl&&(this.layout.rootEl=this.newElement),this.el=this.newElement,delete this.oldEl),this.element=$(this.el)}},e.prototype.beforeRender=function(){},e.prototype.afterRender=function(){},e.prototype.postRender=function(){return this.released?void 0:(this.createDomBinds(),this.afterRender())},e.prototype.redraw=function(){return this.released?void 0:this.layout.queueRenderView(this)},e.prototype.addView=function(t){return this.childViews[t.id]=t,null!=t.name?this.namedChildViews[t.name]=t:void 0},e.prototype.childView=function(t){return this.namedChildViews[t]},e.prototype.namedChildViewExists=function(t){return null!=this.namedChildViews[t]},e.prototype.releaseChildren=function(){var t,e,n;n=this.childViews;for(t in n)e=n[t],this.layout.queueReleaseView(e);return this.childViews={},this.namedChildViews={}},e.prototype.removeView=function(t){return null!=this.childViews?delete this.childViews[t.id]:void 0},e.prototype.hasAncestor=function(t){var e;for(e=this.parent;null!=e;){if(e.id===t.id)return!0;e=e.parent}return!1},e.prototype.release=function(){return this.released?void 0:(r.log("views",this.layout,"releasing view "+this.id),this.removeDomBinds(),this.unbind(),null!=this.parent&&this.parent.removeView(this),this.releaseChildren(),this.layout.releaseView(this),e.__super__.release.apply(this,arguments))},e.prototype.createElement=function(){var t,e,n,r;if(this.display===!1)return t=document.createElement("script"),t.setAttribute("id",this.id),t;if(t=document.createElement(this.tag),t.setAttribute("id",this.id),t.setAttribute("view",""),!this.disableHtmlAttributes){r=this.getHtmlAttrsMap();for(e in r)n=r[e],t.setAttribute(e,n)}return t},e.prototype.getHtmlAttrsMap=function(){var t,e,n;e={};for(t in this)n=this[t],"string"==typeof this[t]&&r.stringEndsWith(t,"Html")&&(e[r.sliceStringBefore(t,"Html")]=n);return e},e.prototype.copyHtmlAttrsToElement=function(t){return t.attr(this.getHtmlAttrsMap()),t},e.prototype.registerDomBind=function(t,e){var n,i,o,s;return s=r.parsePath(e),o=s[0],n=s[1],i=null!=o?r.getPath(this,o):this,null==i&&r.error("View.registerDomBind (bind helper) - cannot find object "+o),this.domBindings[t]={view:this,target:i,attribute:n,element:null}},e.prototype.createDomBinds=function(){var t,e,n,i;n=this.domBindings,i=[];for(t in n)e=n[t],e.element=$("#"+t),null==e.element&&r.error("View.createDomBinds - cannot find element "+t),e.target.bind("change:"+e.attribute,this.onDomBindChange,e),i.push(e.element.text(e.target[e.attribute]));return i},e.prototype.onDomBindChange=function(t,e){return e.element.text(e.target[e.attribute])},e.prototype.removeDomBinds=function(){var t,e,n;n=this.domBindings;for(t in n)e=n[t],true===e.element&&e.target.unbind("change:"+e.attribute,this.onDomBindChange);return this.domBindings={}},e}(e)}).call(this)}),t.define("/object.coffee",function(t,e,n){(function(){var e,r,i,o=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},s=[].slice,a={}.hasOwnProperty;i=t("./util"),e=t("./events").Events,n.MztObject=r=function(){function t(){this._mozartId=i.getId()}var n;return n=["extended","included"],t.NOTIFY=2,t.OBSERVE=1,t.SYNC=0,t.include=function(t){var e,r,i;for(e in t)r=t[e],0>o.call(n,e)&&(this[e]=r);return null!=(i=t.extended)&&i.apply(this),this},t.extend=function(t){var e,r,i;for(e in t)r=t[e],0>o.call(n,e)&&(this.prototype[e]=r);return null!=(i=t.included)&&i.apply(this),this},t.create=function(t){var e,n,r;e=new this;for(n in t)r=t[n],e[n]=r;return e._bindings={},e._bindings.notify={},e._bindings.observe={},e._bindings.stored={},e._createDeclaredBinds(),e._createLookups(),"function"==typeof e.init&&e.init(),e},t.prototype.toString=function(){return"obj-"+this._mozartId},t.prototype.get=function(t){return i.isFunction(this[t])?this[t].call(this):this[t]},t.prototype.set=function(t,e){var n,r,i,o,s,a,l;if(o=this[t],o!==e){if(o instanceof Mozart.MztObject&&(this._bindings.stored[t]={notify:o._stripNotifyBindings(!0),observe:o._stripObserveBindings(!0)},this._bindings.stored[t].notify==={}&&this._bindings.stored[t].observe==={}&&delete this._bindings.stored[t]),null!=this._bindings.stored[t]&&null!=this._bindings.stored[t].notify&&null===e){l=this._bindings.stored[t].notify;for(i in l)for(r=l[i],s=0,a=r.length;a>s;s++)n=r[s],n.target.set(n.attr,null)}return e instanceof Mozart.MztObject&&null!=this._bindings.stored[t]&&(this._bindings.stored[t].notify!=={}&&e._addNotifyBindings(this._bindings.stored[t].notify),this._bindings.stored[t].observe!=={}&&e._addObserveBindings(this._bindings.stored[t].observe),delete this._bindings.stored[t]),this[t]=e,this._doNotifyBinding(t),this.trigger("change"),this.trigger("change:"+t)}},t.prototype.bind=function(){var t;return t=arguments.length>=1?s.call(arguments,0):[],e.bind.apply(e,[this._mozartId].concat(s.call(t))),this},t.prototype.one=function(){var t;return t=arguments.length>=1?s.call(arguments,0):[],e.one.apply(e,[this._mozartId].concat(s.call(t))),this},t.prototype.trigger=function(){var t;return t=arguments.length>=1?s.call(arguments,0):[],e.trigger.apply(e,[this._mozartId].concat(s.call(t))),this},t.prototype.unbind=function(){var t;return t=arguments.length>=1?s.call(arguments,0):[],e.unbind.apply(e,[this._mozartId].concat(s.call(t))),this},t.prototype.release=function(){var t,e;if(!this.released){this._removeAllBindings(),this.unbind();for(t in this)a.call(this,t)&&(e=this[t],this[t]=void 0,delete this[t]);return this.released=!0}},t.prototype._stripNotifyBindings=function(e){var n,r,i,o,s,a;null==e&&(e=!1),r={},a=this._bindings.notify;for(i in a)for(r=a[i],r[i]=[],o=0,s=r.length;s>o;o++)n=r[o],(!e||n.transferable)&&(r[i].push(n),this._removeBinding(i,n.target,n.attr,t.NOTIFY));return r},t.prototype._addNotifyBindings=function(e){var n,r,i,o;o=[];for(i in e)r=e[i],o.push(function(){var e,o,s;for(s=[],e=0,o=r.length;o>e;e++)n=r[e],s.push(this._createBinding(i,n.target,n.attr,t.NOTIFY,n.transferable));return s}.call(this));return o},t.prototype._stripObserveBindings=function(e){var n,r,i,o,s,a;null==e&&(e=!1),r={},a=this._bindings.observe;for(i in a)for(r=a[i],r[i]=[],o=0,s=r.length;s>o;o++)n=r[o],(!e||n.transferable)&&(r[i].push(n),this._removeBinding(i,n.source,n.attr,t.OBSERVE,n.transferable));return r},t.prototype._addObserveBindings=function(e){var n,r,i,o;o=[];for(i in e)r=e[i],o.push(function(){var e,o,s;for(s=[],e=0,o=r.length;o>e;e++)n=r[e],s.push(this._createBinding(i,n.source,n.attr,t.OBSERVE,n.transferable));return s}.call(this));return o},t.prototype._createDeclaredBinds=function(){var e,n,r,o,s,a,l,h;h=[];for(n in this)a=this[n],!i.isFunction(this[n])&&i.stringEndsWith(n,"Binding")&&(n=i.sliceStringBefore(n,"Binding"),s=t.SYNC,i.stringEndsWith(n,"Observe")?(n=i.sliceStringBefore(n,"Observe"),s=t.OBSERVE):i.stringEndsWith(n,"Notify")&&(n=i.sliceStringBefore(n,"Notify"),s=t.NOTIFY),l=i.parsePath(a),o=l[0],e=l[1],r=null!=o?i._getPath(this,o):this,h.push(this._createBinding(n,r,e,s,i.isAbsolutePath(a))));return h},t.prototype._createBinding=function(e,n,r,i,o){var s,a,l,h;switch(i){case t.NOTIFY:return null==(l=(s=this._bindings.notify)[e])&&(s[e]=[]),this._bindings.notify[e].push({attr:r,target:n,transferable:o}),n instanceof t&&(null==(h=(a=n._bindings.observe)[r])&&(a[r]=[]),n._bindings.observe[r].push({attr:e,source:this,transferable:o})),this._doNotifyBinding(e);case t.OBSERVE:return n instanceof t?n._createBinding(r,this,e,t.NOTIFY,o):console.warn("Binding "+e+"ObserveBinding on",this,": target",n,"is not a MztObject");case t.SYNC:return this._createBinding(e,n,r,t.OBSERVE,o),this._createBinding(e,n,r,t.NOTIFY,o)}},t.prototype._removeBinding=function(e,n,r,i){var o,s,a,l,h,u,c,d,p,f,g,y;switch(i){case t.NOTIFY:a={},p=this._bindings.notify;for(l in p)for(s=p[l],h=0,c=s.length;c>h;h++)o=s[h],o.attr!==r&&o.target!==n&&(null==(f=a[l])&&(a[l]=[]),a[l].push(o));if(this._bindings.notify=a,n instanceof t){a={},g=n._bindings.observe;for(l in g)for(s=g[l],u=0,d=s.length;d>u;u++)o=s[u],o.attr!==e&&o.source!==this&&(null==(y=a[l])&&(a[l]=[]),a[l].push(o));return n._bindings.observe=a}break;case t.OBSERVE:if(n instanceof t)return n._removeBinding(r,this,e,t.NOTIFY);break;case t.SYNC:return this._removeBinding(e,n,r,t.NOTIFY),this._removeBinding(e,n,r,t.OBSERVE)}},t.prototype._removeAllBindings=function(){return this._stripObserveBindings(!1),this._stripNotifyBindings(!1)},t.prototype._doNotifyBinding=function(t){var e,n,r,o,s;if(n=this._bindings.notify[t],null!=n){for(s=[],r=0,o=n.length;o>r;r++)e=n[r],null!=e?i.isFunction(e.target.set)?s.push(e.target.set(e.attr,this.get(t))):s.push(e.target[e.attr]=this.get(t)):s.push(void 0);return s}},t.prototype._createLookups=function(){var t,e,n;n=[];for(t in this)e=this[t],!i.isFunction(this[t])&&i.stringEndsWith(t,"Lookup")&&(t=i.sliceStringBefore(t,"Lookup"),n.push(this[t]=i._getPath(e)));return n},t}()}).call(this)}),t.define("/util.coffee",function(t,e){(function(){var t,n,r,i=[].slice,o={}.hasOwnProperty;r={},n=0,t=e.exports={toString:Object.prototype.toString,getType:function(t){return this.toString.call(t).match(/^\[object\s(.*)\]$/)[1]},isObject:function(t){return"Object"===this.getType(t)},isFunction:function(t){return"Function"===this.getType(t)},isArray:function(t){return"Array"===this.getType(t)},isString:function(t){return"String"===this.getType(t)},isBoolean:function(t){return"Boolean"===this.getType(t)},log:function(){var t,e;return e=arguments[0],t=arguments.length>=2?i.call(arguments,1):[],null!=r[e]&&"undefined"!=typeof console&&null!==console?console.log.apply(console,[e+":"].concat(i.call(t))):void 0},showLog:function(t){return r[t]=!0},hideLog:function(t){return r[t]=!1},error:function(){var t,e;throw e=arguments[0],t=arguments.length>=2?i.call(arguments,1):[],"undefined"!=typeof console&&null!==console&&console.error("Exception:",e,t),e},warn:function(){var t,e;return e=arguments[0],t=arguments.length>=2?i.call(arguments,1):[],"undefined"!=typeof console&&null!==console?console.log("Warning:",e,t):void 0},clone:function(t){return $.extend({},t)},getPath:function(t,e){var n;if(n=this._getPath(t,e),void 0===n)throw Error("Object "+t+" has no "+e);return n},isAbsolutePath:function(t){return t[0].toUpperCase()===t[0]},_getPath:function(e,n){var r,i,o;for(null!=e&&null==n&&(n=e,e=Mozart.root),t.isAbsolutePath(n)&&(e=Mozart.root),r=n.split(".");r.length>0;){if(i=r.shift(),"this"!==i){if(void 0===e[i])return void 0;if(o=t.isFunction(e.get)?e.get.call(e,i):e[i],null===o&&r.length>0)return void 0}else o=e;e=o}return o},getId:function(){return++n},parsePath:function(t){var e,n;return-1===t.indexOf(".")?[null,t]:(n=t.split("."),e=n.pop(),[n.join("."),e])},toMap:function(t,e){var n,r,i,o;for(null==e&&(e="id"),r={},i=0,o=t.length;o>i;i++)n=t[i],r[n[e]]=n;return r},sortBy:function(e,n){return n=t.parseSort(n),e.sort(function(t,e){var r,i,o,s,a;for(s=0,a=n.length;a>s;s++)if(o=n[s],r="function"==typeof t[o]?t[o]():t[o],i="function"==typeof e[o]?e[o]():e[o],null!=r&&null!=i){if(null==r)return-1;if(null==i)return 1;if(r=(""+r).toLowerCase(),i=(""+i).toLowerCase(),r>i)return 1;if(i>r)return-1}})},parseSort:function(t,e){var n,r,i;for(null==e&&(e={pos:0}),i=[],r="";e.pos<t.length;)switch(n=t[e.pos++]){case",":r.length>0&&(i.push(r),r="");break;case"[":if(r.length>0)throw Error("parseSort: Unexpected Character [ at "+(""+e.pos));i.push(this.parseSort(t,e));break;case"]":return r.length>0&&i.push(r),i;default:r+=n}return r.length>0&&(i.push(r),r=""),i},toCapsCase:function(t){var e;return e=t.replace(/^[a-z]{1,1}/g,function(t){return t.toUpperCase()}),e=e.replace(/_[a-z]{1,1}/g,function(t){return t.toUpperCase()}),e=e.replace(/_/g," ")},toSnakeCase:function(t){var e;return e=t.replace(/[A-Z]{1,1}/g,function(t){return"_"+t.toLowerCase()}),e.replace(/^_/,"")},sliceStringBefore:function(t,e){return t.slice(0,t.length-e.length)},sliceStringAfter:function(t,e){return t.slice(e.length)},stringEndsWith:function(t,e){var n;return n=e.length,t.length>=n&&t.slice(-n)===e},stringStartsWith:function(t,e){var n;return n=e.length,t.length>=n&&t.slice(0,n)===e},addBindingsParent:function(e){var n,r,i;i=[];for(n in e)o.call(e,n)&&(r=e[n],t.stringEndsWith(n,"Binding")&&null!=r&&null!=r.length&&r.length>0&&r[0]!==r[0].toUpperCase()?i.push(e[n]="parent."+e[n]):i.push(void 0));return i}}}).call(this)}),t.define("/events.coffee",function(t,e,n){(function(){var e,r;r=t("./util"),n.Events=e=function(){function t(){}return t.callbacks={},t.eventInit=function(e,n){var r,i,o,s;return null==(o=(r=t.callbacks)[e])&&(r[e]={count:0,events:{}}),null!=(s=(i=t.callbacks[e].events)[n])?s:i[n]={}},t.trigger=function(e,n,i){var o,s,a,l,h,u,c;if(null!=t.callbacks[e]&&null!=t.callbacks[e].events[n]){a=[],u=t.callbacks[e].events[n];for(s in u)o=u[s],null==o.fn.call&&r.log("general","callback issue ",o.fn),o.fn.call(this,i,o.binddata),o.once&&a.push({objectId:e,eventName:n,id:s});for(c=[],l=0,h=a.length;h>l;l++)o=a[l],c.push(delete t.callbacks[o.objectId].events[o.eventName][o.id]);return c}},t.one=function(e,n,r,i){return t.eventInit(e,n),t.callbacks[e].events[n][t.callbacks[e].count++]={fn:r,binddata:i,once:!0}},t.bind=function(e,n,r,i){return t.eventInit(e,n),t.callbacks[e].events[n][t.callbacks[e].count++]={fn:r,binddata:i}},t.unbind=function(e,n,r){var i,o,s,a,l,h;{if(null==r||null==t.callbacks[e]||null==t.callbacks[e].events[n])return null!=n&&null!=t.callbacks[e]&&null!=t.callbacks[e].events[n]?(delete t.callbacks[e].events[n],void 0):delete t.callbacks[e];s=[],h=t.callbacks[e].events[n];for(o in h)i=h[o],i.fn===r&&s.push(o);for(a=0,l=s.length;l>a;a++)o=s[a],delete t.callbacks[e].events[n][o]}},t.getBinds=function(e,n){return _(t.callbacks[e].events[n]).values()},t}()}).call(this)}),t.define("/control.coffee",function(t,e,n){(function(){var e,r,i=function(t,e){return function(){return t.apply(e,arguments)}},o={}.hasOwnProperty,s=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=t("./view").View,n.Control=e=function(t){function e(){return this.afterRender=i(this.afterRender,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.idPrefix="control",e.prototype.error=function(t){return this.help=t,this.errorState=!0},e.prototype.afterRender=function(){return this.errorState?this.element.addClass("error"):void 0},e}(r)}).call(this)}),t.define("/controller.coffee",function(t,e,n){(function(){var e,r,i={}.hasOwnProperty,o=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=t("./object").MztObject,n.Controller=e=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(r)}).call(this)}),t.define("/data-index.coffee",function(t,e,n){(function(){var e,r,i,o,s={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=t("./object").MztObject,n.DataIndex=r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.indexTypes={},e.prototype.load=function(){throw Error("Mozart.DataIndex: Abstract, Not Implemented")},e.prototype.add=function(){throw Error("Mozart.DataIndex: Abstract, Not Implemented")},e.prototype.remove=function(){throw Error("Mozart.DataIndex: Abstract, Not Implemented")},e.prototype.update=function(){throw Error("Mozart.DataIndex: Abstract, Not Implemented")},e.prototype.rebuild=function(){throw Error("Mozart.DataIndex: Abstract, Not Implemented")},e.registerIndexClassType=function(t,e){return this.indexTypes[t]=e},e.getIndexClassType=function(t){return this.indexTypes[t]},e}(o),n.MapIndex=i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.init=function(){return this.map={},this.rebuild()},e.prototype.load=function(t){return null!=this.map[t]?this.map[t]:{}},e.prototype.update=function(t,e,n){var r,i;return null!=this.map[e]&&(delete this.map[e][t.id],0===_(this.map[e]).keys().length&&delete this.map[e]),null==(i=(r=this.map)[n])&&(r[n]={}),this.map[n][t.id]=t},e.prototype.add=function(t){var e,n,r;return null==(r=(e=this.map)[n=t[this.attribute]])&&(e[n]={}),this.map[t[this.attribute]][t.id]=t},e.prototype.remove=function(t){var e,n,r,i;r=this.map,i=[];for(n in r)e=r[n],delete e[t.id],0===_(e).keys().length?i.push(delete this.map[n]):i.push(void 0);return i},e.prototype.rebuild=function(){var t,e,n,r,i;for(this.map={},r=this.modelClass.all(),i=[],e=0,n=r.length;n>e;e++)t=r[e],i.push(this.add(t));return i},e}(r),r.registerIndexClassType("map",i),n.BooleanIndex=e=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.init=function(){return this.value=this.options.value,this.rebuild()},e.prototype.load=function(t){return t===this.value?this.valueIds:this.nonValueIds},e.prototype.update=function(t,e,n){return e===this.value?delete this.valueIds[t.id]:delete this.nonValueIds[t.id],n===this.value?this.valueIds[t.id]=t:this.nonValueIds[t.id]=t},e.prototype.add=function(t){return t[this.attribute]===this.value?this.valueIds[t.id]=t:this.nonValueIds[t.id]=t},e.prototype.remove=function(t){return delete this.valueIds[t.id],delete this.nonValueIds[t.id]},e.prototype.rebuild=function(){var t,e,n,r,i;for(this.valueIds={},this.nonValueIds={},r=this.modelClass.all(),i=[],e=0,n=r.length;n>e;e++)t=r[e],i.push(this.add(t));return i},e}(r),r.registerIndexClassType("boolean",e)}).call(this)}),t.define("/dom-manager.coffee",function(t,e,n){(function(){var e,r,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i=t("./util"),r=t("./object").MztObject,n.DOMManager=e=function(t){function e(){return this.getControlOptionsValues=o(this.getControlOptionsValues,this),this.onControlEvent=o(this.onControlEvent,this),this.onViewEvent=o(this.onViewEvent,this),this.onApplicationEvent=o(this.onApplicationEvent,this),this.release=o(this.release,this),this.checkClickOutside=o(this.checkClickOutside,this),this.checkClickInside=o(this.checkClickInside,this),this.find=o(this.find,this),e.__super__.constructor.apply(this,arguments)}var n;return a(e,t),n={click:"click",dblclick:"dblClick",focus:"focus",blur:"blur",keyup:"keyUp",keydown:"keyDown",keypress:"keyPress",focusout:"focusOut",focusin:"focusIn",change:"change",mouseover:"mouseOver",mouseout:"mouseOut"},e.prototype.init=function(){var t,e,r,i,o;this.element=$(this.rootElement);for(t in n)i=n[t],this.element.on(t,null,{eventName:i},this.onApplicationEvent);return e=function(){var t;t=[];for(r in n)o=n[r],t.push(r);return t}().join(" "),this.element.on(e,"[view]",this.onViewEvent),this.element.on(e,"[data-mozart-action]",this.onControlEvent),this.openElements={}},e.prototype.find=function(t){var e,n,r,o,s,a;for(a=this.layouts,o=0,s=a.length;s>o;o++){if(r=a[o],null!=r.views[t])return i.log("general",""+t+": view of",r.rootElement),r.views[t];if(e=r.getControl(t),null!=e)return i.log("general",""+t+": control of",r.rootElement),e}return n=$("#"+t),n.length>0?(i.log("general",""+t+" is a an element"),n[0]):i.log("general","Cannot find ID "+t)},e.prototype.checkClickInside=function(t){var e,n,r,o,s,a,l;if("click"===t.type){for(a=this.layouts,l=[],o=0,s=a.length;s>o;o++)n=a[o],l.push(function(){var o,s;o=n.hasClickInside,s=[];for(e in o)r=o[e],$(t.target).parents("#"+e).length>0?(i.log("events","clickInside on",r,"(",t,")"),s.push(r.clickInside())):s.push(void 0);
return s}());return l}},e.prototype.checkClickOutside=function(t){var e,n,r,o,s,a,l;if("click"===t.type){for(a=this.layouts,l=[],o=0,s=a.length;s>o;o++)n=a[o],l.push(function(){var o,s;o=n.hasClickOutside,s=[];for(e in o)r=o[e],0===$(t.target).parents("#"+e).length?(i.log("events","clickOutside on",r,"(",t,")"),s.push(r.clickOutside())):s.push(void 0);return s}());return l}},e.prototype.release=function(){var t,r,i,o,s;for(t in n)o=n[t],this.element.off(t,null,this._checkRootEvent);return r=function(){var t;t=[];for(i in n)s=n[i],t.push(i);return t}().join(" "),this.element.off(r,"[view]",this.onViewEvent),this.element.off(r,"[data-mozart-action]",this.onControlEvent),e.__super__.release.apply(this,arguments)},e.prototype.onApplicationEvent=function(t){return this.trigger(t.data.eventName,t)},e.prototype.onViewEvent=function(t){var e,r,o,s,a,l,h,u;if(this.checkClickInside(t),a=null,e=s=t.currentTarget,null!=e){for(u=this.layouts,l=0,h=u.length;h>l;l++)r=u[l],a=r.views[e.id],null!=a&&(o=n[t.type],this.trigger("viewEvent",t,a),"function"==typeof a[o]&&(i.log("events",o,"on",a,"(",t,")"),a[o](t,a)));return this.checkClickOutside(t),!0}},e.prototype.onControlEvent=function(t){var e,n,r,o,s,a,h,u;for(this.checkClickInside(t),n=$(t.currentTarget),r=n.attr("data-mozart-action"),i.log("controls","action",t),h=this.layouts,s=0,a=h.length;a>s;s++)o=h[s],e=o.getControl(r),null!=e&&(null===e.events||(u=t.type,l.call(e.events,u)>=0))&&("function"==typeof e.view[e.action]?(i.log("events","method",e.action,"on",e.view,"(",t,")"),i.log("controls","action on control",e,t),this.trigger("controlEvent",t,e),e.view[e.action](n,this.getControlOptionsValues(e.view,e.options),t),e.allowDefault||t.preventDefault()):i.warn("Action "+e.action+" does not exist on view "+e.view.id+", "+e.view.name,e));return this.checkClickOutside(t),t.stopImmediatePropagation()},e.prototype.getControlOptionsValues=function(t,e){var n,r,o,s;o={};for(n in e)s=e[n],i.stringEndsWith(n,"Lookup")?(r=i.sliceStringBefore(n,"Lookup"),o[r]=i._getPath(t,s)):o[n]=s;return o},e}(r)}).call(this)}),t.define("/handlebars.coffee",function(t){(function(){var e,n,r,i,o,s;r=t("./util"),i=t("./view").View,n=t("./i18n-view").I18nView,e=t("./collection").Collection,o=function(t,e){return r._getPath(t,e)},s=function(t,e){var n;return"string"==typeof e?n=r._getPath(t,e):"function"==typeof e&&(n=e.call(t)),n},Handlebars.registerHelper("site",function(){return new Handlebars.SafeString("/#")}),Handlebars.registerHelper("bind",function(t,e){var n,i,o,s,a,l,h;r.log("handlebars","handlebars helper 'bind':",this,t,e),1===arguments.length&&r.error("Bind helper must have a target."),n="bind"+r.getId(),s=null!=(l=e.hash.tag)?l:"span",i="<"+s+" id='"+n+"'",h=e.hash;for(o in h)a=h[o],r.stringEndsWith(o,"Html")&&(i+=" "+r.sliceStringBefore(o,"Html")+'="'+a+'"');return i+="></"+s+">",e.data.registerDomBind(n,t),new Handlebars.SafeString(i)}),Handlebars.registerHelper("i18n",function(t,e){var n,i,o;return r.log("handlebars","handlebars helper 'i18n':",this,t,e),1===arguments.length?(n="",r.error("i18n helper usage must reference a key.")):(i=r._getPath(window,"i18n."+t),null==i?(r.error("i18n helper: key '"+t+"' does not exist in current language file."),n=""):(o=null!=e&&null!=e.hash?Mozart.MztObject.create(e.hash):{},n=r.getPath(window,"i18n."+t)(o))),new Handlebars.SafeString(n)}),Handlebars.registerHelper("bindI18n",function(t,e){var i,o,s,a,l,h,u;if(r.log("handlebars","handlebars helper 'bindI18n':",this,t,e),1===arguments.length&&r.error("bindI18n helper must have a target."),l={context:this,i18nTemplate:t,parent:e.data},null!=e.hash){r.addBindingsParent(e.hash),u=e.hash;for(o in u)a=u[o],l[o]=a}return h=l.parent.layout.createView(n,l),l.parent.addView(h),s=h.createElement(),i=s.outerHTML,null==i&&(i=""),l.parent.layout.queueRenderView(h),new Handlebars.SafeString(i)}),Handlebars.registerHelper("view",function(t,e){var n,o,s,a,l,h,u,c,d;if(r.log("handlebars","handlebars helper 'view':",this,t,e),1===arguments.length&&(e=t,t=null),s=e.data,u=null!=t?"string"==typeof t?r._getPath(t):t:i,null==u&&r.error("view handlebars helper: viewClass does not exist","context",t,"this",this),c={context:this,parent:s},null!=e.fn&&(c.templateFunction=e.fn),null!=e.hash){r.addBindingsParent(e.hash),d=e.hash;for(o in d)l=d[o],c[o]=l}return h=s.layout.createView(u,c),s.addView(h),a=h.createElement(),n=a.outerHTML,null==n&&(n=""),s.layout.queueRenderView(h),new Handlebars.SafeString(n)}),Handlebars.registerHelper("collection",function(t,n){var o,s,a,l,h,u,c,d,p,f;r.log("handlebars","handlebars helper 'collection':",this,r.clone(t),n),1===arguments.length?(n=t,t=null,d=i):(d=r.getPath(t),null==d&&r.error("View for collection does not exist","view name",t)),l=n.data,p={context:this,viewClass:d,parent:l},null!=n.fn&&(p.viewClassTemplateFunction=n.fn),r.addBindingsParent(n.hash),f=n.hash;for(a in f)u=f[a],p[a]=u;return o=null!=n.hash.collectionClass?r.getPath(n.hash.collectionClass):e,c=l.layout.createView(o,p),c.parent=l,l.addView(c),h=c.createElement(),s=h.outerHTML,null==s&&(s=""),l.layout.queueRenderView(c),new Handlebars.SafeString(s)}),Handlebars.registerHelper("linkTo",function(t,e){var n,i,o;return r.log("handlebars","handlebars helper 'linkTo':",this,t,e),1===arguments.length&&(e=t),"string"==typeof t?t=r._getPath(this,t):"function"==typeof t&&(t=t.call(this)),null!=t?(n="<a href='/#"+t.showUrl()+"'",null!=(null!=(o=e.hash)?o.classNames:void 0)&&(n+=" class='"+e.hash.classNames+"'"),n+=">",i=e.fn(this),null!=i&&i.length>0||(i="(Empty Value)"),n+=i,n+="</a>",new Handlebars.SafeString(n)):""}),Handlebars.registerHelper("valueOf",function(t,e){var n;return r.log("handlebars","handlebars helper 'valueOf':",this,t,e),1===arguments.length&&(e=t),n=r._getPath(this,t),null==n&&(n=""),new Handlebars.SafeString(n)}),Handlebars.registerHelper("rawPath",function(t,e){var n;return 1===arguments.length&&(e=t),n=r._getPath(this,t),null==n&&(n=""),n}),Handlebars.registerHelper("uriPath",function(t,e){var n;return 1===arguments.length&&(e=t),n=r._getPath(this,t),null==n&&(n=""),encodeURI(n)}),Handlebars.registerHelper("valueEach",function(t,e){var n,i,o,s,a,l;if(r.log("handlebars","handlebars helper 'valueEach':",this,t,e),1===arguments.length&&(e=t),t=r.getPath(this,t),null==t)return"";for(i="",o=0,s=t.length;s>o;o++)n=t[o],i+=e.fn(n),null!=(null!=e?null!=(a=e.hash)?a.seperator:void 0:void 0)&&(i+=e.hash.seperator);return null!=(null!=e?null!=(l=e.hash)?l.seperator:void 0:void 0)&&i.length>0&&(i=i.slice(0,i.length-e.hash.seperator.length)),new Handlebars.SafeString(i)}),Handlebars.registerHelper("yesNo",function(t,e){return r.log("handlebars","handlebars helper 'yesNo':",this,t,e),1===arguments.length&&(e=t),"string"==typeof t&&(t=r.getPath(this,t)),null==t?"No":t?"Yes":"No"}),Handlebars.registerHelper("valueIf",function(t,e){return r.log("handlebars","handlebars helper 'valueOf':",this,t,e),"string"==typeof t&&(t=r._getPath(this,t)),t?e.fn(this):e.inverse(this)}),Handlebars.registerHelper("valueUnless",function(t,e){return"string"==typeof t&&(t=r.getPath(this,t)),t?e.inverse(this):e.fn(this)}),Handlebars.registerHelper("action",function(t,e){var n,i,o,s,a;return r.log("handlebars","handlebars helper 'action':",this,t,e),1===arguments.length&&(e=record),a=e.data,null!=e.hash.target&&(a="parent"===e.hash.target?e.data.parent:r.getPath(e.data,e.hash.target)),n=r.getId(),s='data-mozart-action="'+n+'"',o=null!=e.hash.events?e.hash.events.split(","):["click"],i=e.hash.allowDefault&&!0,e.data.layout.addControl(n,{action:t,view:a,options:e.hash,events:o,allowDefault:i}),new Handlebars.SafeString(s)}),Handlebars.registerHelper("date",function(t){var e,n;return n=s(this,t),e=r.serverToLocalDate(n)||"(none)",new Handlebars.SafeString(e)}),Handlebars.registerHelper("dateTime",function(t){var e,n;return n=s(this,t),e=r.serverToLocalDateTime(n),new Handlebars.SafeString(e)}),Handlebars.registerHelper("timeAgo",function(t){var e,n;return n=s(this,t),e=r.serverToLocalTimeAgo(n),new Handlebars.SafeString(e)}),Handlebars.registerHelper("mozartversion",function(){return new Handlebars.SafeString(Mozart.version)}),Handlebars.registerHelper("mozartversiondate",function(){return new Handlebars.SafeString(Mozart.versionDate.toLocaleDateString())})}).call(this)}),t.define("/i18n-view.coffee",function(t,e,n){(function(){var e,r,i,o={}.hasOwnProperty,s=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};i=t("./view").View,r=t("./util"),n.I18nView=e=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.tag="span",e.prototype.idPrefix="i18nview",e.prototype.init=function(){if(e.__super__.init.apply(this,arguments),null==this.i18nTemplate)throw Error("Mozart.I18nView must have a i18nTemplate");return this.bind("change",this.redraw)},e.prototype.templateFunction=function(){try{return r.getPath(window,"i18n."+this.i18nTemplate)(this)}catch(t){return r.warn("MessageFormat failed with Error:",t),""}},e}(i)}).call(this)}),t.define("/http.coffee",function(t,e,n){(function(){var e,r,i,o={}.hasOwnProperty,s=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=t("./object").MztObject,i=t("./util"),n.HTTP=e=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.handleError=function(t,e,n,r){switch(t.status){case 401:return Mozart.Ajax.trigger("httpAuthorizationRequired",n,t);case 404:return Mozart.Ajax.trigger("httpForbidden",n,t);default:return i.error("Model.Ajax.handleError",t,e,r)}},e.prototype._xhrHandler=function(t,e,n,r,o){var s,a,l,h,u;return this.support.ajax?(u="object"==typeof t?this.support.cors?t.cors||t.proxy:t.proxy:t,l=e||"GET",h=r||{},s=o||{},a=n||{},o.success=o.success||function(t,n,r){return i.log("Mozart.HTTP",e,"success",t,n,r)},o.error=o.error||function(t,n,r){return i.log("Mozart.HTTP",e,"error",t,n,r)},o.complete=o.complete||function(t,n){return i.log("Mozart.HTTP",e,"complete",t,n)},this._request(u,l,a,h,s)):i.log("Mozart.HTTP","AJAX is not supported. Exiting")},e.prototype._request=function(t,e,n,r,i){return $.ajax({url:t,type:e,success:i.success,error:i.error,complete:i.complete,data:n,context:r.context||this,dataType:r.dataType||"json",contentType:r.contentType||"application/json"})},e.prototype.support={ajax:function(){try{return!!new XMLHttpRequest}catch(t){return!1}},cors:function(){return this.ajax&&"withCredentials"in new XMLHttpRequest}},e.prototype.get=function(t,e){var n,r,i;return e=e||{},r=e.data||{},i=e.options||{},n=e.callbacks||{},this._xhrHandler(t,"GET",r,i,n)},e.prototype.post=function(t,e){var n,r,i;return e=e||{},r=e.data||{},i=e.options||{},n=e.callbacks||{},this._xhrHandler(t,"POST",r,i,n)},e.prototype.put=function(t,e){var n,r,i;return e=e||{},r=e.data||{},i=e.options||{},n=e.callbacks||{},this._xhrHandler(t,"PUT",r,i,n)},e.prototype["delete"]=function(t,e){var n,r,i;return e=e||{},r=e.data||{},i=e.options||{},n=e.callbacks||{},this._xhrHandler(t,"DELETE",r,i,n)},e}(r)}).call(this)}),t.define("/layout.coffee",function(t,e,n){(function(){var e,r,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};i=t("./util"),r=t("./router").Router,n.Layout=e=function(t){function e(){return this.releaseViewControls=o(this.releaseViewControls,this),this.removeControl=o(this.removeControl,this),this.getControl=o(this.getControl,this),this.addControl=o(this.addControl,this),this.releaseViews=o(this.releaseViews,this),this.releaseView=o(this.releaseView,this),this.queueReleaseView=o(this.queueReleaseView,this),this.release=o(this.release,this),this.processRenderQueue=o(this.processRenderQueue,this),this.queueRenderView=o(this.queueRenderView,this),this._transition=o(this._transition,this),this.doRoute=o(this.doRoute,this),this.resetRoute=o(this.resetRoute,this),this.bindRoot=o(this.bindRoot,this),this.createView=o(this.createView,this),this.init=o(this.init,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.init=function(){var t,n,r,i,o;for(e.__super__.init.apply(this,arguments),this.viewRenderQueue=[],this.releaseMap={},this.views={},this.currentState=null,this.controls={},this.hasClickOutside={},this.hasClickInside={},i=this.states,o=[],n=0,r=i.length;r>n;n++)t=i[n],null!=t.path&&null!=t.viewClass&&o.push(this.register(t.path,this.doRoute,t));return o},e.prototype.createView=function(t,e){var n;return null==e&&(e={}),e.layout=this,n=t.create(e),this.views[n.id]=n,null!=n.clickInside&&(this.hasClickInside[n.id]=n),null!=n.clickOutside&&(this.hasClickOutside[n.id]=n),n},e.prototype.bindRoot=function(){return this.rootEl=$(this.rootElement)[0]},e.prototype.resetRoute=function(){return this.viewRenderQueue=[],this.currentState=null,this.releaseViews()},e.prototype.doRoute=function(t,e){return null==this.currentState||this.currentState.canExit()?(this.currentState=null,t.canEnter(e)?(this._transition(t),!0):(i.log("layout","cannot enter state",t,e),!1)):(i.log("layout","cannot exit state",this.currentState),!1)},e.prototype._transition=function(t){return this.resetRoute(),this.currentState=t,this.currentState.doTitle(),null!=this.currentState.viewClass?(null!=this.currentView&&(this.releaseMap[this.currentView.id]=this.currentView),this.currentView=this.createView(this.currentState.viewClass,this.currentState.viewOptions),this.currentView.el=this.rootEl,this.queueRenderView(this.currentView)):void 0},e.prototype.queueRenderView=function(t){var e,n,r;return i.log("layout",""+this._mozartId+" queueRenderView",t),null==(r=(e=this.views)[n=t.id])&&(e[n]=t),0===this.viewRenderQueue.length&&_.delay(this.processRenderQueue,0),this.viewRenderQueue.push(t)},e.prototype.processRenderQueue=function(){var t,e,n,r,o,s,a,l,h,u,c,d,p,f,g,y,m,v,w;if(!this.released&&0!==this.viewRenderQueue.length){for(i.log("layout",""+this._mozartId+" processRenderQueue with "+this.viewRenderQueue.length+" views"),e=[],n=[];this.viewRenderQueue.length>0;)s=this.viewRenderQueue.shift(),s.beforeRender(),s.releaseChildren(),s.prepareElement(),n.push(s);for(r=[],h=0,p=n.length;p>h;h++)for(a=n[h],u=0,f=n.length;f>u;u++)l=n[u],l!==a&&a.hasAncestor(l)&&!_.contains(r,a)&&r.push(a);for(o=_.difference(n,r),c=0,g=o.length;g>c;c++)s=o[c],s.reassignElements();for(d=0,y=o.length;y>d;d++)s=o[d],s.replaceElement();for(v=0,m=n.length;m>v;v++)s=n[v],s.postRender();w=this.releaseMap;for(t in w)s=w[t],null!=s&&s.release();return this.releaseMap={},i.log("layout",""+this._mozartId+" render finished"),this.trigger("render:complete")}},e.prototype.release=function(){return this.releaseViews(),e.__super__.release.apply(this,arguments)},e.prototype.queueReleaseView=function(t){return this.releaseMap[t.id]=t},e.prototype.releaseView=function(t){return this.releaseViewControls(t),delete this.views[t.id],delete this.hasClickOutside[t.id],delete this.hasClickInside[t.id]},e.prototype.releaseViews=function(){var t,e,n,r;n=this.views,r=[];for(t in n)e=n[t],i.log("layout","processRenderQueue:releasing",e.id,e),this.releaseMap[t]=e,r.push(this.processRenderQueue());return r},e.prototype.addControl=function(t,e){return i.log("layout","adding control",t,e),this.controls[t]=e},e.prototype.getControl=function(t){return this.controls[t]},e.prototype.removeControl=function(t){return i.log("layout","removing control",t),delete this.controls[t]},e.prototype.releaseViewControls=function(t){var e,n,r,o;r=this.controls,o=[];for(n in r)e=r[n],e.view===t&&(i.log("layout","releasing control for view",t,"control",e.action,e),o.push(delete this.controls[n]));return o},e}(r)}).call(this)}),t.define("/router.coffee",function(t,e,n){(function(){var e,r,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};e=t("./object").MztObject,i=t("./util"),n.Router=r=function(t){function e(){return this.release=o(this.release,this),this.navigateRoute=o(this.navigateRoute,this),this.onPopState=o(this.onPopState,this),this.onNavigationEvent=o(this.onNavigationEvent,this),this.onHashChange=o(this.onHashChange,this),this.register=o(this.register,this),this.stop=o(this.stop,this),this.start=o(this.start,this),this.init=o(this.init,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.init=function(){var t;return this.routes={},null!=(t=this.useHashRouting)?t:this.useHashRouting=!1},e.prototype.start=function(){return this.useHashRouting?($(window).bind("hashchange",this.onHashChange),this.onHashChange()):($("body").on("click","a",this.onNavigationEvent),$(window).on("popstate",this.onPopState),-1!==navigator.userAgent.indexOf("Firefox")?this.onPopState():void 0)},e.prototype.stop=function(){return this.useHashRouting?$(window).unbind("hashchange",this.onHashChange):($("body").off("click","a",this.onNavigationEvent),$(window).off("popstate",this.onPopState))},e.prototype.register=function(t,e,n){var r,o,s,a,l,h;for(i.log("routes","registering route",t,n),a=t.split("/"),r=[],o="",l=0,h=a.length;h>l;l++)s=a[l],":"===s[0]?(o+="([^\\/]+)\\/",r.push(s.substr(1))):o+=this._escForRegEx(s)+"\\/";return o.length>2&&(o=o.substr(0,o.length-2)),this.routes[t]={regex:RegExp("^"+o+"$","i"),params:r,callback:e,data:n}},e.prototype.onHashChange=function(){var t;return t=window.location.hash,t.length>0&&"#"===t[0]&&(t=t.substr(1)),this.navigateRoute(t)},e.prototype.onNavigationEvent=function(t){return t.target.host