Commit 90ab24a4 authored by Arthur Verschaeve's avatar Arthur Verschaeve

Drop `mozart` app

Fix #1317
parent 3d3c37eb
html,
body {
margin: 0;
padding: 0;
}
button {
margin: 0;
padding: 0;
border: 0;
background: none;
font-size: 100%;
vertical-align: baseline;
font-family: inherit;
color: inherit;
-webkit-appearance: none;
/*-moz-appearance: none;*/
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
body {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em;
background: #eaeaea url('bg.png');
color: #4d4d4d;
width: 550px;
margin: 0 auto;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#todoapp {
background: #fff;
background: rgba(255, 255, 255, 0.9);
margin: 130px 0 40px 0;
border: 1px solid #ccc;
position: relative;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.15);
}
#todoapp:before {
content: '';
border-left: 1px solid #f5d6d6;
border-right: 1px solid #f5d6d6;
width: 2px;
position: absolute;
top: 0;
left: 40px;
height: 100%;
}
#todoapp input::-webkit-input-placeholder {
font-style: italic;
}
#todoapp input:-moz-placeholder {
font-style: italic;
color: #a9a9a9;
}
#todoapp h1 {
position: absolute;
top: -120px;
width: 100%;
font-size: 70px;
font-weight: bold;
text-align: center;
color: #b3b3b3;
color: rgba(255, 255, 255, 0.3);
text-shadow: -1px -1px rgba(0, 0, 0, 0.2);
-webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility;
-ms-text-rendering: optimizeLegibility;
-o-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility;
}
#header {
padding-top: 15px;
border-radius: inherit;
}
#header:before {
content: '';
position: absolute;
top: 0;
right: 0;
left: 0;
height: 15px;
z-index: 2;
border-bottom: 1px solid #6c615c;
background: #8d7d77;
background: -webkit-gradient(linear, left top, left bottom, from(rgba(132, 110, 100, 0.8)),to(rgba(101, 84, 76, 0.8)));
background: -webkit-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -moz-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -o-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -ms-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');
border-top-left-radius: 1px;
border-top-right-radius: 1px;
}
#new-todo,
.edit {
position: relative;
margin: 0;
width: 100%;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
color: inherit;
padding: 6px;
border: 1px solid #999;
box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#new-todo {
padding: 16px 16px 16px 60px;
border: none;
background: rgba(0, 0, 0, 0.02);
z-index: 2;
box-shadow: none;
}
#main {
position: relative;
z-index: 2;
border-top: 1px dotted #adadad;
}
label[for='toggle-all'] {
display: none;
}
#toggle-all {
position: absolute;
top: -42px;
left: -4px;
width: 40px;
text-align: center;
border: none; /* Mobile Safari */
}
#toggle-all:before {
content: '»';
font-size: 28px;
color: #d9d9d9;
padding: 0 25px 7px;
}
#toggle-all:checked:before {
color: #737373;
}
#todo-list {
margin: 0;
padding: 0;
list-style: none;
}
#todo-list li {
position: relative;
font-size: 24px;
border-bottom: 1px dotted #ccc;
}
#todo-list li:last-child {
border-bottom: none;
}
#todo-list li.editing {
border-bottom: none;
padding: 0;
}
#todo-list li.editing .edit {
display: block;
width: 506px;
padding: 13px 17px 12px 17px;
margin: 0 0 0 43px;
}
#todo-list li.editing .view {
display: none;
}
#todo-list li .toggle {
text-align: center;
width: 40px;
/* auto, since non-WebKit browsers doesn't support input styling */
height: auto;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
border: none; /* Mobile Safari */
-webkit-appearance: none;
/*-moz-appearance: none;*/
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
#todo-list li .toggle:after {
content: '✔';
line-height: 43px; /* 40 + a couple of pixels visual adjustment */
font-size: 20px;
color: #d9d9d9;
text-shadow: 0 -1px 0 #bfbfbf;
}
#todo-list li .toggle:checked:after {
color: #85ada7;
text-shadow: 0 1px 0 #669991;
bottom: 1px;
position: relative;
}
#todo-list li label {
word-break: break-word;
padding: 15px;
margin-left: 45px;
display: block;
line-height: 1.2;
-webkit-transition: color 0.4s;
-moz-transition: color 0.4s;
-ms-transition: color 0.4s;
-o-transition: color 0.4s;
transition: color 0.4s;
}
#todo-list li.completed label {
color: #a9a9a9;
text-decoration: line-through;
}
#todo-list li .destroy {
display: none;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
width: 40px;
height: 40px;
margin: auto 0;
font-size: 22px;
color: #a88a8a;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
#todo-list li .destroy:hover {
text-shadow: 0 0 1px #000,
0 0 10px rgba(199, 107, 107, 0.8);
-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
-ms-transform: scale(1.3);
-o-transform: scale(1.3);
transform: scale(1.3);
}
#todo-list li .destroy:after {
content: '✖';
}
#todo-list li:hover .destroy {
display: block;
}
#todo-list li .edit {
display: none;
}
#todo-list li.editing:last-child {
margin-bottom: -1px;
}
#footer {
color: #777;
padding: 0 15px;
position: absolute;
right: 0;
bottom: -31px;
left: 0;
height: 20px;
z-index: 1;
text-align: center;
}
#footer:before {
content: '';
position: absolute;
right: 0;
bottom: 31px;
left: 0;
height: 50px;
z-index: -1;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3),
0 6px 0 -3px rgba(255, 255, 255, 0.8),
0 7px 1px -3px rgba(0, 0, 0, 0.3),
0 43px 0 -6px rgba(255, 255, 255, 0.8),
0 44px 2px -6px rgba(0, 0, 0, 0.2);
}
#todo-count {
float: left;
text-align: left;
}
#filters {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
right: 0;
left: 0;
}
#filters li {
display: inline;
}
#filters li a {
color: #83756f;
margin: 2px;
text-decoration: none;
}
#filters li a.selected {
font-weight: bold;
}
#clear-completed {
float: right;
position: relative;
line-height: 20px;
text-decoration: none;
background: rgba(0, 0, 0, 0.1);
font-size: 11px;
padding: 0 10px;
border-radius: 3px;
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.2);
}
#clear-completed:hover {
background: rgba(0, 0, 0, 0.15);
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.3);
}
#info {
margin: 65px auto 0;
color: #a6a6a6;
font-size: 12px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
text-align: center;
}
#info a {
color: inherit;
}
/*
Hack to remove background from Mobile Safari.
Can't use it globally since it destroys checkboxes in Firefox and Opera
*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
#toggle-all,
#todo-list li .toggle {
background: none;
}
#todo-list li .toggle {
height: 40px;
}
#toggle-all {
top: -56px;
left: -15px;
width: 65px;
height: 41px;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
-webkit-appearance: none;
appearance: none;
}
}
.hidden{
display:none;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Mozart • TodoMVC</title>
<link href="css/app.css" rel="stylesheet">
</head>
<body>
<section id="todoapp"></section>
<footer id="info"></info>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.rc.2/handlebars.runtime.js"></script>
<script src="http://cdn.bigcommerce.com/mozart/0.1.8/mozart.js"></script>
<script src="js/i18n/en.js"></script>
<script src="js/app.js"></script>
</body>
</html>
(function() {
window.Todo = {};
Todo.log = function(status) {
if (typeof console !== "undefined" && console !== null) {
return console.log("LOG:", status);
}
};
Todo.warn = function(status) {
if (typeof console !== "undefined" && console !== null) {
return console.log("WARNING:", status);
}
};
Todo.title = function(title) {
if (typeof window !== "undefined" && window !== null) {
return window.title = title;
}
};
}).call(this);
(function() {
Todo.Item = Mozart.Model.create({
modelName: 'TodoItem'
});
Todo.Item.attributes({
'title': 'string',
'completed': 'boolean'
});
Todo.Item.index('completed');
Todo.Item.localStorage({
prefix: 'todos-mozart'
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.AppController = (function(_super) {
__extends(AppController, _super);
function AppController() {
this.clearCompleted = __bind(this.clearCompleted, this);
this.createItem = __bind(this.createItem, this);
this.itemsChanged = __bind(this.itemsChanged, this);
this.setMode = __bind(this.setMode, this);
this.modeChanged = __bind(this.modeChanged, this);
return AppController.__super__.constructor.apply(this, arguments);
}
AppController.prototype.init = function() {
Todo.Item.loadAllLocalStorage();
this.set('items', Todo.Item);
this.set('completedfilter', null);
this.bind('change:mode', this.modeChanged);
this.set('mode', 'all');
Todo.Item.bind('change', this.itemsChanged);
return this.itemsChanged();
};
AppController.prototype.modeChanged = function() {
switch (this.mode) {
case 'completed':
return this.set('completedfilter', 'true');
case 'active':
return this.set('completedfilter', 'false');
default:
return this.set('completedfilter', '');
}
};
AppController.prototype.setMode = function(mode) {
return this.set('mode', mode);
};
AppController.prototype.itemsChanged = function() {
this.set('displayItems', Todo.Item.count() !== 0);
this.set('itemCount', Todo.Item.findByAttribute('completed', false).length);
this.set('completedItemCount', Todo.Item.count() - this.itemCount);
return this.set('allChecked', this.itemCount === 0);
};
AppController.prototype.createItem = function(title) {
if (!((title != null) && title.length > 0)) {
return;
}
Todo.Item.createFromValues({
title: title.trim(),
completed: false
});
return this.itemsChanged();
};
AppController.prototype.clearCompleted = function() {
var item, _i, _len, _ref, _results;
_ref = Todo.Item.all();
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
if (item.completed) {
_results.push(item.destroy());
}
}
return _results;
};
AppController.prototype.setCheckAll = function(view, checked) {
var item, _i, _len, _ref, _results;
_ref = Todo.Item.all();
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
item.set('completed', checked);
_results.push(item.save());
}
return _results;
};
return AppController;
})(Mozart.Controller);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.AppView = (function(_super) {
__extends(AppView, _super);
function AppView() {
return AppView.__super__.constructor.apply(this, arguments);
}
AppView.prototype.templateName = 'app/templates/todo_app_view';
AppView.prototype.tag = 'section';
AppView.prototype.id = 'todoapp';
return AppView;
})(Mozart.View);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.FiltersView = (function(_super) {
__extends(FiltersView, _super);
function FiltersView() {
this.modeChanged = __bind(this.modeChanged, this);
this.afterRender = __bind(this.afterRender, this);
return FiltersView.__super__.constructor.apply(this, arguments);
}
FiltersView.prototype.templateName = 'app/templates/todo_filters_view';
FiltersView.prototype.tag = 'ul';
FiltersView.prototype.id = 'filters';
FiltersView.prototype.init = function() {
FiltersView.__super__.init.apply(this, arguments);
return this.bind('change:mode', this.modeChanged);
};
FiltersView.prototype.afterRender = function() {
return this.modeChanged();
};
FiltersView.prototype.modeChanged = function() {
if (this.element == null) {
return;
}
this.element.find("a").removeClass('selected');
switch (this.mode) {
case 'completed':
return this.element.find("#" + this.id + "-completed").addClass('selected');
case 'active':
return this.element.find("#" + this.id + "-active").addClass('selected');
default:
return this.element.find("#" + this.id + "-all").addClass('selected');
}
};
return FiltersView;
})(Mozart.View);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.InfoView = (function(_super) {
__extends(InfoView, _super);
function InfoView() {
return InfoView.__super__.constructor.apply(this, arguments);
}
InfoView.prototype.templateName = 'app/templates/todo_info_view';
InfoView.prototype.tag = 'footer';
InfoView.prototype.id = 'info';
return InfoView;
})(Mozart.View);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.ItemLabelView = (function(_super) {
__extends(ItemLabelView, _super);
function ItemLabelView() {
this.dblClick = __bind(this.dblClick, this);
this.itemChanged = __bind(this.itemChanged, this);
this.afterRender = __bind(this.afterRender, this);
return ItemLabelView.__super__.constructor.apply(this, arguments);
}
ItemLabelView.prototype.skipTemplate = true;
ItemLabelView.prototype.tag = "label";
ItemLabelView.prototype.init = function() {
ItemLabelView.__super__.init.apply(this, arguments);
return this.bind('change:value', this.itemChanged);
};
ItemLabelView.prototype.afterRender = function() {
return this.itemChanged();
};
ItemLabelView.prototype.itemChanged = function() {
if (!this.element) {
return;
}
return this.element.html(this.value);
};
ItemLabelView.prototype.dblClick = function(e) {
if (this.parent.editItem != null) {
return this.parent.editItem();
}
};
return ItemLabelView;
})(Mozart.View);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__slice = [].slice;
Todo.ItemView = (function(_super) {
__extends(ItemView, _super);
function ItemView() {
this.save = __bind(this.save, this);
this.load = __bind(this.load, this);
this.isDirty = __bind(this.isDirty, this);
this.checkKey = __bind(this.checkKey, this);
this.removeItem = __bind(this.removeItem, this);
this.itemChanged = __bind(this.itemChanged, this);
this.focusOut = __bind(this.focusOut, this);
this.editItem = __bind(this.editItem, this);
this.afterRender = __bind(this.afterRender, this);
return ItemView.__super__.constructor.apply(this, arguments);
}
ItemView.prototype.templateName = 'app/templates/todo_item_view';
ItemView.prototype.tag = 'li';
ItemView.prototype.init = function() {
ItemView.__super__.init.apply(this, arguments);
this.content.bind('change', this.itemChanged);
return this.bind('change:completed', this.focusOut);
};
ItemView.prototype.afterRender = function() {
return this.itemChanged();
};
ItemView.prototype.editItem = function() {
this.element.addClass('editing');
return this.childView('textBox').focus();
};
ItemView.prototype.focusOut = function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (this.element == null) {
return;
}
this.element.removeClass('editing');
if (this.title.length === 0) {
return this.removeItem();
} else {
if (this.isDirty()) {
return this.save();
}
}
};
ItemView.prototype.itemChanged = function() {
if (!((this.content != null) && (this.element != null))) {
return;
}
this.load();
if (this.completed) {
return this.element.addClass('completed');
} else {
return this.element.removeClass('completed');
}
};
ItemView.prototype.removeItem = function() {
return this.content.destroy();
};
ItemView.prototype.checkKey = function(e) {
switch (e.keyCode) {
case 13:
return this.childView('textBox').blur();
case 27:
this.load();
return this.childView('textBox').blur();
}
};
ItemView.prototype.isDirty = function() {
return this.content.title !== this.title || this.content.completed !== this.completed;
};
ItemView.prototype.load = function() {
this.set('title', this.content.title);
return this.set('completed', this.content.completed);
};
ItemView.prototype.save = function() {
this.content.set('title', this.title);
this.content.set('completed', this.completed);
return this.content.save();
};
return ItemView;
})(Mozart.View);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.CheckboxControl = (function(_super) {
__extends(CheckboxControl, _super);
function CheckboxControl() {
this.updateValue = __bind(this.updateValue, this);
this.afterRender = __bind(this.afterRender, this);
return CheckboxControl.__super__.constructor.apply(this, arguments);
}
CheckboxControl.prototype.tag = 'input';
CheckboxControl.prototype.typeHtml = 'checkbox';
CheckboxControl.prototype.skipTemplate = true;
CheckboxControl.prototype.init = function() {
var method, target, _ref,
_this = this;
CheckboxControl.__super__.init.apply(this, arguments);
this.bind('change:value', this.updateValue);
if (this.checkAction) {
_ref = Mozart.parsePath(this.checkAction), target = _ref[0], method = _ref[1];
if (target != null) {
target = Mozart.getPath(this.parent, target);
} else {
target = this.parent;
}
return this.bind('check', function(data) {
return target[method](_this, data);
});
}
};
CheckboxControl.prototype.afterRender = function() {
return this.updateValue();
};
CheckboxControl.prototype.updateValue = function() {
if (this.element == null) {
return;
}
return this.element[0].checked = this.value;
};
CheckboxControl.prototype.setValue = function() {
if (this.element == null) {
return;
}
this.trigger('check', this.element[0].checked);
return this.set('value', this.element[0].checked);
};
CheckboxControl.prototype.change = function() {
return this.setValue();
};
return CheckboxControl;
})(Mozart.Control);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.TextControl = (function(_super) {
__extends(TextControl, _super);
function TextControl() {
this.keyUp = __bind(this.keyUp, this);
this.updateInputValue = __bind(this.updateInputValue, this);
this.afterRender = __bind(this.afterRender, this);
return TextControl.__super__.constructor.apply(this, arguments);
}
TextControl.prototype.tag = "input";
TextControl.prototype.skipTemplate = true;
TextControl.prototype.init = function() {
TextControl.__super__.init.apply(this, arguments);
return this.bind('change:value', this.updateInputValue);
};
TextControl.prototype.afterRender = function() {
if (this.typeHtml != null) {
this.element.type = this.typeHtml;
}
this.updateInputValue();
return this.element;
};
TextControl.prototype.updateInputValue = function() {
if (this.element == null) {
return;
}
return this.element.val(this.value);
};
TextControl.prototype.focus = function() {
if (this.element == null) {
return;
}
return this.element.focus();
};
TextControl.prototype.blur = function() {
if (this.element == null) {
return;
}
return this.element.blur();
};
TextControl.prototype.keyUp = function(e) {
var _base, _name;
this.set('value', this.element.val());
if (this.keyUpAction != null) {
return typeof (_base = this.parent)[_name = this.keyUpAction] === "function" ? _base[_name](e) : void 0;
}
};
return TextControl;
})(Mozart.Control);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.ClearCompletedControl = (function(_super) {
__extends(ClearCompletedControl, _super);
function ClearCompletedControl() {
this.click = __bind(this.click, this);
this.beforeRender = __bind(this.beforeRender, this);
return ClearCompletedControl.__super__.constructor.apply(this, arguments);
}
ClearCompletedControl.prototype.templateName = 'app/templates/controls/todo_clear_completed_control';
ClearCompletedControl.prototype.tag = 'button';
ClearCompletedControl.prototype.id = "clear-completed";
ClearCompletedControl.prototype.init = function() {
ClearCompletedControl.__super__.init.apply(this, arguments);
return this.bind('change:value', this.redraw);
};
ClearCompletedControl.prototype.beforeRender = function() {
return this.display = this.value !== 0;
};
ClearCompletedControl.prototype.click = function() {
return Todo.appController.clearCompleted();
};
return ClearCompletedControl;
})(Mozart.View);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Todo.NewItemControl = (function(_super) {
__extends(NewItemControl, _super);
function NewItemControl() {
this.keyUp = __bind(this.keyUp, this);
return NewItemControl.__super__.constructor.apply(this, arguments);
}
NewItemControl.prototype.placeholderHtml = i18n.todo.whatNeedsDone();
NewItemControl.prototype.autofocusHtml = '';
NewItemControl.prototype.id = 'new-todo';
NewItemControl.prototype.keyUp = function(e) {
if (e.keyCode === 13) {
Todo.appController.createItem(this.value);
return this.set('value', null);
} else {
return NewItemControl.__super__.keyUp.apply(this, arguments);
}
};
return NewItemControl;
})(Todo.TextControl);
}).call(this);
(function() {
Todo.appController = Todo.AppController.create();
Mozart.root = window;
Todo.Application = Mozart.MztObject.create();
Todo.Application.set('appLayout', Mozart.Layout.create({
rootElement: '#todoapp',
states: [
Mozart.Route.create({
viewClass: Todo.AppView,
path: "/"
})
]
}));
Todo.Application.set('infoLayout', Mozart.Layout.create({
rootElement: '#info',
states: [
Mozart.Route.create({
viewClass: Todo.InfoView,
path: "/"
})
]
}));
Todo.Application.ready = function() {
Todo.Application.set('domManager', Mozart.DOMManager.create({
rootElement: 'body',
layouts: [Todo.Application.appLayout, Todo.Application.infoLayout]
}));
Todo.Application.appLayout.bindRoot();
Todo.Application.appLayout.navigateRoute('/');
Todo.Application.infoLayout.bindRoot();
Todo.Application.infoLayout.navigateRoute('/');
Todo.Application.set('router', Mozart.Router.create({
useHashRouting: true
}));
Todo.Application.router.register('/', Todo.appController.setMode, 'all');
Todo.Application.router.register('/active', Todo.appController.setMode, 'active');
Todo.Application.router.register('/completed', Todo.appController.setMode, 'completed');
Todo.Application.router.start();
return $(document).trigger('Mozart:loaded');
};
$(document).ready(Todo.Application.ready);
}).call(this);
this["HandlebarsTemplates"] = this["HandlebarsTemplates"] || {};
this["HandlebarsTemplates"]["app/templates/controls/todo_clear_completed_control"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
helpers = helpers || Handlebars.helpers; data = data || {};
var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.clearCompleted", options) : helperMissing.call(depth0, "i18n", "todo.clearCompleted", options)))
+ " (";
if (stack2 = helpers.value) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
else { stack2 = depth0.value; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
buffer += escapeExpression(stack2)
+ ")";
return buffer;
});
this["HandlebarsTemplates"]["app/templates/todo_app_view"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
helpers = helpers || Handlebars.helpers; data = data || {};
var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this;
function program1(depth0,data) {
var buffer = "", stack1, options;
buffer += "\n ";
options = {hash:{
'id': ("toggle-all"),
'valueObserveBinding': ("Todo.appController.allChecked"),
'checkAction': ("Todo.appController.setCheckAll")
},data:data};
buffer += escapeExpression(((stack1 = helpers.view),stack1 ? stack1.call(depth0, "Todo.CheckboxControl", options) : helperMissing.call(depth0, "view", "Todo.CheckboxControl", options)))
+ "\n <label for=\"toggle-all\">";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.markAllAsComplete", options) : helperMissing.call(depth0, "i18n", "todo.markAllAsComplete", options)))
+ "</label>\n ";
options = {hash:{
'collectionObserveBinding': ("Todo.appController.items"),
'id': ("todo-list"),
'filterAttribute': ("completed"),
'filterTextObserveBinding': ("Todo.appController.completedfilter")
},data:data};
buffer += escapeExpression(((stack1 = helpers.collection),stack1 ? stack1.call(depth0, "Todo.ItemView", options) : helperMissing.call(depth0, "collection", "Todo.ItemView", options)))
+ "\n";
return buffer;
}
function program3(depth0,data) {
var buffer = "", stack1, options;
buffer += "\n <span id=\"todo-count\">";
options = {hash:{
'ITEMSObserveBinding': ("Todo.appController.itemCount"),
'tag': ("strong")
},data:data};
buffer += escapeExpression(((stack1 = helpers.bindI18n),stack1 ? stack1.call(depth0, "todo.itemCount", options) : helperMissing.call(depth0, "bindI18n", "todo.itemCount", options)))
+ "</span>\n ";
options = {hash:{
'modeObserveBinding': ("Todo.appController.mode")
},data:data};
buffer += escapeExpression(((stack1 = helpers.view),stack1 ? stack1.call(depth0, "Todo.FiltersView", options) : helperMissing.call(depth0, "view", "Todo.FiltersView", options)))
+ "\n ";
options = {hash:{
'valueObserveBinding': ("Todo.appController.completedItemCount")
},data:data};
buffer += escapeExpression(((stack1 = helpers.view),stack1 ? stack1.call(depth0, "Todo.ClearCompletedControl", options) : helperMissing.call(depth0, "view", "Todo.ClearCompletedControl", options)))
+ "\n";
return buffer;
}
buffer += "<header id=\"header\">\n <h1>";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.todos", options) : helperMissing.call(depth0, "i18n", "todo.todos", options)))
+ "</h1>\n ";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.view),stack1 ? stack1.call(depth0, "Todo.NewItemControl", options) : helperMissing.call(depth0, "view", "Todo.NewItemControl", options)))
+ "\n</header>\n\n";
options = {hash:{
'id': ("main"),
'tag': ("section"),
'displayObserveBinding': ("Todo.appController.displayItems")
},inverse:self.noop,fn:self.program(1, program1, data),data:data};
stack2 = ((stack1 = helpers.view),stack1 ? stack1.call(depth0, options) : helperMissing.call(depth0, "view", options));
if(stack2 || stack2 === 0) { buffer += stack2; }
buffer += "\n\n";
options = {hash:{
'id': ("footer"),
'tag': ("footer"),
'displayObserveBinding': ("Todo.appController.displayItems")
},inverse:self.noop,fn:self.program(3, program3, data),data:data};
stack2 = ((stack1 = helpers.view),stack1 ? stack1.call(depth0, options) : helperMissing.call(depth0, "view", options));
if(stack2 || stack2 === 0) { buffer += stack2; }
return buffer;
});
this["HandlebarsTemplates"]["app/templates/todo_filters_view"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
helpers = helpers || Handlebars.helpers; data = data || {};
var buffer = "", stack1, stack2, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing;
buffer += "<li>\n <a id=\"";
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "-all\" href=\"#/\">";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.all", options) : helperMissing.call(depth0, "i18n", "todo.all", options)))
+ "</a>\n</li>\n<li>\n <a id=\"";
if (stack2 = helpers.id) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
else { stack2 = depth0.id; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
buffer += escapeExpression(stack2)
+ "-active\" href=\"#/active\">";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.active", options) : helperMissing.call(depth0, "i18n", "todo.active", options)))
+ "</a>\n</li>\n<li>\n <a id=\"";
if (stack2 = helpers.id) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
else { stack2 = depth0.id; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
buffer += escapeExpression(stack2)
+ "-completed\" href=\"#/completed\">";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.complete", options) : helperMissing.call(depth0, "i18n", "todo.complete", options)))
+ "</a>\n</li>";
return buffer;
});
this["HandlebarsTemplates"]["app/templates/todo_info_view"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
helpers = helpers || Handlebars.helpers; data = data || {};
var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
buffer += "<p>";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.doubleClickEdit", options) : helperMissing.call(depth0, "i18n", "todo.doubleClickEdit", options)))
+ "</p>\n<p>";
options = {hash:{
'NAME': ("Tom Cully"),
'URL': ("http://mozart.io")
},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.createdBy", options) : helperMissing.call(depth0, "i18n", "todo.createdBy", options)))
+ " - <a href=\"http://github.com/tomcully/todomvc-mozart\">";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.fullSource", options) : helperMissing.call(depth0, "i18n", "todo.fullSource", options)))
+ "</a></p>\n<p>";
options = {hash:{
'NAME': ("TodoMVC"),
'URL': ("http://todomvc.com")
},data:data};
buffer += escapeExpression(((stack1 = helpers.i18n),stack1 ? stack1.call(depth0, "todo.partOf", options) : helperMissing.call(depth0, "i18n", "todo.partOf", options)))
+ "</p>";
return buffer;
});
this["HandlebarsTemplates"]["app/templates/todo_item_view"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
helpers = helpers || Handlebars.helpers; data = data || {};
var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
buffer += "<div class=\"view\">\n ";
options = {hash:{
'valueBinding': ("completed"),
'classHtml': ("toggle")
},data:data};
buffer += escapeExpression(((stack1 = helpers.view),stack1 ? stack1.call(depth0, "Todo.CheckboxControl", options) : helperMissing.call(depth0, "view", "Todo.CheckboxControl", options)))
+ "\n ";
options = {hash:{
'valueObserveBinding': ("title")
},data:data};
buffer += escapeExpression(((stack1 = helpers.view),stack1 ? stack1.call(depth0, "Todo.ItemLabelView", options) : helperMissing.call(depth0, "view", "Todo.ItemLabelView", options)))
+ "\n <button class=\"destroy\" ";
options = {hash:{},data:data};
buffer += escapeExpression(((stack1 = helpers.action),stack1 ? stack1.call(depth0, "removeItem", options) : helperMissing.call(depth0, "action", "removeItem", options)))
+ "></button>\n</div>\n";
options = {hash:{
'name': ("textBox"),
'valueBinding': ("title"),
'classHtml': ("edit"),
'keyUpAction': ("checkKey")
},data:data};
buffer += escapeExpression(((stack1 = helpers.view),stack1 ? stack1.call(depth0, "Todo.TextControl", options) : helperMissing.call(depth0, "view", "Todo.TextControl", options)));
return buffer;
});
// lib/handlebars/base.js
/*jshint eqnull:true*/
this.Handlebars = {};
(function(Handlebars) {
Handlebars.VERSION = "1.0.rc.1";
Handlebars.helpers = {};
Handlebars.partials = {};
Handlebars.registerHelper = function(name, fn, inverse) {
if(inverse) { fn.not = inverse; }
this.helpers[name] = fn;
};
Handlebars.registerPartial = function(name, str) {
this.partials[name] = str;
};
Handlebars.registerHelper('helperMissing', function(arg) {
if(arguments.length === 2) {
return undefined;
} else {
throw new Error("Could not find property '" + arg + "'");
}
});
var toString = Object.prototype.toString, functionType = "[object Function]";
Handlebars.registerHelper('blockHelperMissing', function(context, options) {
var inverse = options.inverse || function() {}, fn = options.fn;
var ret = "";
var type = toString.call(context);
if(type === functionType) { context = context.call(this); }
if(context === true) {
return fn(this);
} else if(context === false || context == null) {
return inverse(this);
} else if(type === "[object Array]") {
if(context.length > 0) {
return Handlebars.helpers.each(context, options);
} else {
return inverse(this);
}
} else {
return fn(context);
}
});
Handlebars.K = function() {};
Handlebars.createFrame = Object.create || function(object) {
Handlebars.K.prototype = object;
var obj = new Handlebars.K();
Handlebars.K.prototype = null;
return obj;
};
Handlebars.registerHelper('each', function(context, options) {
var fn = options.fn, inverse = options.inverse;
var ret = "", data;
if (options.data) {
data = Handlebars.createFrame(options.data);
}
if(context && context.length > 0) {
for(var i=0, j=context.length; i<j; i++) {
if (data) { data.index = i; }
ret = ret + fn(context[i], { data: data });
}
} else {
ret = inverse(this);
}
return ret;
});
Handlebars.registerHelper('if', function(context, options) {
var type = toString.call(context);
if(type === functionType) { context = context.call(this); }
if(!context || Handlebars.Utils.isEmpty(context)) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
Handlebars.registerHelper('unless', function(context, options) {
var fn = options.fn, inverse = options.inverse;
options.fn = inverse;
options.inverse = fn;
return Handlebars.helpers['if'].call(this, context, options);
});
Handlebars.registerHelper('with', function(context, options) {
return options.fn(context);
});
Handlebars.registerHelper('log', function(context) {
Handlebars.log(context);
});
}(this.Handlebars));
;
// lib/handlebars/compiler/parser.js
/* Jison generated parser */
var handlebars = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"DATA":27,"param":28,"STRING":29,"INTEGER":30,"BOOLEAN":31,"hashSegments":32,"hashSegment":33,"ID":34,"EQUALS":35,"pathSegments":36,"SEP":37,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",27:"DATA",29:"STRING",30:"INTEGER",31:"BOOLEAN",34:"ID",35:"EQUALS",37:"SEP"},
productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[17,1],[25,2],[25,1],[28,1],[28,1],[28,1],[28,1],[28,1],[26,1],[32,2],[32,1],[33,3],[33,3],[33,3],[33,3],[33,3],[21,1],[36,3],[36,1]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
var $0 = $$.length - 1;
switch (yystate) {
case 1: return $$[$0-1];
break;
case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]);
break;
case 3: this.$ = new yy.ProgramNode($$[$0]);
break;
case 4: this.$ = new yy.ProgramNode([]);
break;
case 5: this.$ = [$$[$0]];
break;
case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
break;
case 7: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]);
break;
case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]);
break;
case 9: this.$ = $$[$0];
break;
case 10: this.$ = $$[$0];
break;
case 11: this.$ = new yy.ContentNode($$[$0]);
break;
case 12: this.$ = new yy.CommentNode($$[$0]);
break;
case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
break;
case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
break;
case 15: this.$ = $$[$0-1];
break;
case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
break;
case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true);
break;
case 18: this.$ = new yy.PartialNode($$[$0-1]);
break;
case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]);
break;
case 20:
break;
case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]];
break;
case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null];
break;
case 23: this.$ = [[$$[$0-1]], $$[$0]];
break;
case 24: this.$ = [[$$[$0]], null];
break;
case 25: this.$ = [[new yy.DataNode($$[$0])], null];
break;
case 26: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
break;
case 27: this.$ = [$$[$0]];
break;
case 28: this.$ = $$[$0];
break;
case 29: this.$ = new yy.StringNode($$[$0]);
break;
case 30: this.$ = new yy.IntegerNode($$[$0]);
break;
case 31: this.$ = new yy.BooleanNode($$[$0]);
break;
case 32: this.$ = new yy.DataNode($$[$0]);
break;
case 33: this.$ = new yy.HashNode($$[$0]);
break;
case 34: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
break;
case 35: this.$ = [$$[$0]];
break;
case 36: this.$ = [$$[$0-2], $$[$0]];
break;
case 37: this.$ = [$$[$0-2], new yy.StringNode($$[$0])];
break;
case 38: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])];
break;
case 39: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])];
break;
case 40: this.$ = [$$[$0-2], new yy.DataNode($$[$0])];
break;
case 41: this.$ = new yy.IdNode($$[$0]);
break;
case 42: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
break;
case 43: this.$ = [$$[$0]];
break;
}
},
table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,27:[1,24],34:[1,26],36:25},{17:27,21:23,27:[1,24],34:[1,26],36:25},{17:28,21:23,27:[1,24],34:[1,26],36:25},{17:29,21:23,27:[1,24],34:[1,26],36:25},{21:30,34:[1,26],36:25},{1:[2,1]},{6:31,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,32],21:23,27:[1,24],34:[1,26],36:25},{10:33,20:[1,34]},{10:35,20:[1,34]},{18:[1,36]},{18:[2,24],21:41,25:37,26:38,27:[1,45],28:39,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,25]},{18:[2,41],27:[2,41],29:[2,41],30:[2,41],31:[2,41],34:[2,41],37:[1,48]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],37:[2,43]},{18:[1,49]},{18:[1,50]},{18:[1,51]},{18:[1,52],21:53,34:[1,26],36:25},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:54,34:[1,26],36:25},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:41,26:55,27:[1,45],28:56,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,23]},{18:[2,27],27:[2,27],29:[2,27],30:[2,27],31:[2,27],34:[2,27]},{18:[2,33],33:57,34:[1,58]},{18:[2,28],27:[2,28],29:[2,28],30:[2,28],31:[2,28],34:[2,28]},{18:[2,29],27:[2,29],29:[2,29],30:[2,29],31:[2,29],34:[2,29]},{18:[2,30],27:[2,30],29:[2,30],30:[2,30],31:[2,30],34:[2,30]},{18:[2,31],27:[2,31],29:[2,31],30:[2,31],31:[2,31],34:[2,31]},{18:[2,32],27:[2,32],29:[2,32],30:[2,32],31:[2,32],34:[2,32]},{18:[2,35],34:[2,35]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],35:[1,59],37:[2,43]},{34:[1,60]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,61]},{18:[1,62]},{18:[2,21]},{18:[2,26],27:[2,26],29:[2,26],30:[2,26],31:[2,26],34:[2,26]},{18:[2,34],34:[2,34]},{35:[1,59]},{21:63,27:[1,67],29:[1,64],30:[1,65],31:[1,66],34:[1,26],36:25},{18:[2,42],27:[2,42],29:[2,42],30:[2,42],31:[2,42],34:[2,42],37:[2,42]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,36],34:[2,36]},{18:[2,37],34:[2,37]},{18:[2,38],34:[2,38]},{18:[2,39],34:[2,39]},{18:[2,40],34:[2,40]}],
defaultActions: {16:[2,1],24:[2,25],38:[2,23],55:[2,21]},
parseError: function parseError(str, hash) {
throw new Error(str);
},
parse: function parse(input) {
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
this.yy.parser = this;
if (typeof this.lexer.yylloc == "undefined")
this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
var ranges = this.lexer.options && this.lexer.options.ranges;
if (typeof this.yy.parseError === "function")
this.parseError = this.yy.parseError;
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || 1;
if (typeof token !== "number") {
token = self.symbols_[token] || token;
}
return token;
}
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
if (!recovering) {
expected = [];
for (p in table[state])
if (this.terminals_[p] && p > 2) {
expected.push("'" + this.terminals_[p] + "'");
}
if (this.lexer.showPosition) {
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
} else {
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
}
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(this.lexer.yytext);
lstack.push(this.lexer.yylloc);
stack.push(action[1]);
symbol = null;
if (!preErrorSymbol) {
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
if (recovering > 0)
recovering--;
} else {
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
if (ranges) {
yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
}
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
if (typeof r !== "undefined") {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}
};
/* Jison generated lexer */
var lexer = (function(){
var lexer = ({EOF:1,
parseError:function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
setInput:function (input) {
this._input = input;
this._more = this._less = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = '';
this.conditionStack = ['INITIAL'];
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
if (this.options.ranges) this.yylloc.range = [0,0];
this.offset = 0;
return this;
},
input:function () {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) this.yylloc.range[1]++;
this._input = this._input.slice(1);
return ch;
},
unput:function (ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
//this.yyleng -= len;
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length-1);
this.matched = this.matched.substr(0, this.matched.length-1);
if (lines.length-1) this.yylineno -= lines.length-1;
var r = this.yylloc.range;
this.yylloc = {first_line: this.yylloc.first_line,
last_line: this.yylineno+1,
first_column: this.yylloc.first_column,
last_column: lines ?
(lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
return this;
},
more:function () {
this._more = true;
return this;
},
less:function (n) {
this.unput(this.match.slice(n));
},
pastInput:function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
},
upcomingInput:function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20-next.length);
}
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
},
showPosition:function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c+"^";
},
next:function () {
if (this.done) {
return this.EOF;
}
if (!this._input) this.done = true;
var token,
match,
tempMatch,
index,
col,
lines;
if (!this._more) {
this.yytext = '';
this.match = '';
}
var rules = this._currentRules();
for (var i=0;i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (!this.options.flex) break;
}
}
if (match) {
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) this.yylineno += lines.length;
this.yylloc = {first_line: this.yylloc.last_line,
last_line: this.yylineno+1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
if (this.done && this._input) this.done = false;
if (token) return token;
else return;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
{text: "", token: null, line: this.yylineno});
}
},
lex:function lex() {
var r = this.next();
if (typeof r !== 'undefined') {
return r;
} else {
return this.lex();
}
},
begin:function begin(condition) {
this.conditionStack.push(condition);
},
popState:function popState() {
return this.conditionStack.pop();
},
_currentRules:function _currentRules() {
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
},
topState:function () {
return this.conditionStack[this.conditionStack.length-2];
},
pushState:function begin(condition) {
this.begin(condition);
}});
lexer.options = {};
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
var YYSTATE=YY_START
switch($avoiding_name_collisions) {
case 0:
if(yy_.yytext.slice(-1) !== "\\") this.begin("mu");
if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu");
if(yy_.yytext) return 14;
break;
case 1: return 14;
break;
case 2:
if(yy_.yytext.slice(-1) !== "\\") this.popState();
if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1);
return 14;
break;
case 3: return 24;
break;
case 4: return 16;
break;
case 5: return 20;
break;
case 6: return 19;
break;
case 7: return 19;
break;
case 8: return 23;
break;
case 9: return 23;
break;
case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;
break;
case 11: return 22;
break;
case 12: return 35;
break;
case 13: return 34;
break;
case 14: return 34;
break;
case 15: return 37;
break;
case 16: /*ignore whitespace*/
break;
case 17: this.popState(); return 18;
break;
case 18: this.popState(); return 18;
break;
case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 29;
break;
case 20: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 29;
break;
case 21: yy_.yytext = yy_.yytext.substr(1); return 27;
break;
case 22: return 31;
break;
case 23: return 31;
break;
case 24: return 30;
break;
case 25: return 34;
break;
case 26: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 34;
break;
case 27: return 'INVALID';
break;
case 28: return 5;
break;
}
};
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
lexer.conditions = {"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,28],"inclusive":true}};
return lexer;})()
parser.lexer = lexer;
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
return new Parser;
})();
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
exports.parser = handlebars;
exports.Parser = handlebars.Parser;
exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }
exports.main = function commonjsMain(args) {
if (!args[1])
throw new Error('Usage: '+args[0]+' FILE');
var source, cwd;
if (typeof process !== 'undefined') {
source = require('fs').readFileSync(require('path').resolve(args[1]), "utf8");
} else {
source = require("file").path(require("file").cwd()).join(args[1]).read({charset: "utf-8"});
}
return exports.parser.parse(source);
}
if (typeof module !== 'undefined' && require.main === module) {
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
}
};
;
// lib/handlebars/compiler/base.js
Handlebars.Parser = handlebars;
Handlebars.parse = function(string) {
Handlebars.Parser.yy = Handlebars.AST;
return Handlebars.Parser.parse(string);
};
Handlebars.print = function(ast) {
return new Handlebars.PrintVisitor().accept(ast);
};
Handlebars.logger = {
DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
// override in the host environment
log: function(level, str) {}
};
Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
;
// lib/handlebars/compiler/ast.js
(function() {
Handlebars.AST = {};
Handlebars.AST.ProgramNode = function(statements, inverse) {
this.type = "program";
this.statements = statements;
if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }
};
Handlebars.AST.MustacheNode = function(rawParams, hash, unescaped) {
this.type = "mustache";
this.escaped = !unescaped;
this.hash = hash;
var id = this.id = rawParams[0];
var params = this.params = rawParams.slice(1);
// a mustache is an eligible helper if:
// * its id is simple (a single part, not `this` or `..`)
var eligibleHelper = this.eligibleHelper = id.isSimple;
// a mustache is definitely a helper if:
// * it is an eligible helper, and
// * it has at least one parameter or hash segment
this.isHelper = eligibleHelper && (params.length || hash);
// if a mustache is an eligible helper but not a definite
// helper, it is ambiguous, and will be resolved in a later
// pass or at runtime.
};
Handlebars.AST.PartialNode = function(id, context) {
this.type = "partial";
// TODO: disallow complex IDs
this.id = id;
this.context = context;
};
var verifyMatch = function(open, close) {
if(open.original !== close.original) {
throw new Handlebars.Exception(open.original + " doesn't match " + close.original);
}
};
Handlebars.AST.BlockNode = function(mustache, program, inverse, close) {
verifyMatch(mustache.id, close);
this.type = "block";
this.mustache = mustache;
this.program = program;
this.inverse = inverse;
if (this.inverse && !this.program) {
this.isInverse = true;
}
};
Handlebars.AST.ContentNode = function(string) {
this.type = "content";
this.string = string;
};
Handlebars.AST.HashNode = function(pairs) {
this.type = "hash";
this.pairs = pairs;
};
Handlebars.AST.IdNode = function(parts) {
this.type = "ID";
this.original = parts.join(".");
var dig = [], depth = 0;
for(var i=0,l=parts.length; i<l; i++) {
var part = parts[i];
if(part === "..") { depth++; }
else if(part === "." || part === "this") { this.isScoped = true; }
else { dig.push(part); }
}
this.parts = dig;
this.string = dig.join('.');
this.depth = depth;
// an ID is simple if it only has one part, and that part is not
// `..` or `this`.
this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
};
Handlebars.AST.DataNode = function(id) {
this.type = "DATA";
this.id = id;
};
Handlebars.AST.StringNode = function(string) {
this.type = "STRING";
this.string = string;
};
Handlebars.AST.IntegerNode = function(integer) {
this.type = "INTEGER";
this.integer = integer;
};
Handlebars.AST.BooleanNode = function(bool) {
this.type = "BOOLEAN";
this.bool = bool;
};
Handlebars.AST.CommentNode = function(comment) {
this.type = "comment";
this.comment = comment;
};
})();;
// lib/handlebars/utils.js
Handlebars.Exception = function(message) {
var tmp = Error.prototype.constructor.apply(this, arguments);
for (var p in tmp) {
if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }
}
this.message = tmp.message;
};
Handlebars.Exception.prototype = new Error();
// Build out our basic SafeString type
Handlebars.SafeString = function(string) {
this.string = string;
};
Handlebars.SafeString.prototype.toString = function() {
return this.string.toString();
};
(function() {
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
var escapeChar = function(chr) {
return escape[chr] || "&amp;";
};
Handlebars.Utils = {
escapeExpression: function(string) {
// don't escape SafeStrings, since they're already safe
if (string instanceof Handlebars.SafeString) {
return string.toString();
} else if (string == null || string === false) {
return "";
}
if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
},
isEmpty: function(value) {
if (typeof value === "undefined") {
return true;
} else if (value === null) {
return true;
} else if (value === false) {
return true;
} else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
return true;
} else {
return false;
}
}
};
})();;
// lib/handlebars/compiler/compiler.js
/*jshint eqnull:true*/
Handlebars.Compiler = function() {};
Handlebars.JavaScriptCompiler = function() {};
(function(Compiler, JavaScriptCompiler) {
// the foundHelper register will disambiguate helper lookup from finding a
// function in a context. This is necessary for mustache compatibility, which
// requires that context functions in blocks are evaluated by blockHelperMissing,
// and then proceed as if the resulting value was provided to blockHelperMissing.
Compiler.prototype = {
compiler: Compiler,
disassemble: function() {
var opcodes = this.opcodes, opcode, out = [], params, param;
for (var i=0, l=opcodes.length; i<l; i++) {
opcode = opcodes[i];
if (opcode.opcode === 'DECLARE') {
out.push("DECLARE " + opcode.name + "=" + opcode.value);
} else {
params = [];
for (var j=0; j<opcode.args.length; j++) {
param = opcode.args[j];
if (typeof param === "string") {
param = "\"" + param.replace("\n", "\\n") + "\"";
}
params.push(param);
}
out.push(opcode.opcode + " " + params.join(" "));
}
}
return out.join("\n");
},
guid: 0,
compile: function(program, options) {
this.children = [];
this.depths = {list: []};
this.options = options;
// These changes will propagate to the other compiler components
var knownHelpers = this.options.knownHelpers;
this.options.knownHelpers = {
'helperMissing': true,
'blockHelperMissing': true,
'each': true,
'if': true,
'unless': true,
'with': true,
'log': true
};
if (knownHelpers) {
for (var name in knownHelpers) {
this.options.knownHelpers[name] = knownHelpers[name];
}
}
return this.program(program);
},
accept: function(node) {
return this[node.type](node);
},
program: function(program) {
var statements = program.statements, statement;
this.opcodes = [];
for(var i=0, l=statements.length; i<l; i++) {
statement = statements[i];
this[statement.type](statement);
}
this.isSimple = l === 1;
this.depths.list = this.depths.list.sort(function(a, b) {
return a - b;
});
return this;
},
compileProgram: function(program) {
var result = new this.compiler().compile(program, this.options);
var guid = this.guid++, depth;
this.usePartial = this.usePartial || result.usePartial;
this.children[guid] = result;
for(var i=0, l=result.depths.list.length; i<l; i++) {
depth = result.depths.list[i];
if(depth < 2) { continue; }
else { this.addDepth(depth - 1); }
}
return guid;
},
block: function(block) {
var mustache = block.mustache,
program = block.program,
inverse = block.inverse;
if (program) {
program = this.compileProgram(program);
}
if (inverse) {
inverse = this.compileProgram(inverse);
}
var type = this.classifyMustache(mustache);
if (type === "helper") {
this.helperMustache(mustache, program, inverse);
} else if (type === "simple") {
this.simpleMustache(mustache);
// now that the simple mustache is resolved, we need to
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('pushLiteral', '{}');
this.opcode('blockValue');
} else {
this.ambiguousMustache(mustache, program, inverse);
// now that the simple mustache is resolved, we need to
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('pushLiteral', '{}');
this.opcode('ambiguousBlockValue');
}
this.opcode('append');
},
hash: function(hash) {
var pairs = hash.pairs, pair, val;
this.opcode('push', '{}');
for(var i=0, l=pairs.length; i<l; i++) {
pair = pairs[i];
val = pair[1];
this.accept(val);
this.opcode('assignToHash', pair[0]);
}
},
partial: function(partial) {
var id = partial.id;
this.usePartial = true;
if(partial.context) {
this.ID(partial.context);
} else {
this.opcode('push', 'depth0');
}
this.opcode('invokePartial', id.original);
this.opcode('append');
},
content: function(content) {
this.opcode('appendContent', content.string);
},
mustache: function(mustache) {
var options = this.options;
var type = this.classifyMustache(mustache);
if (type === "simple") {
this.simpleMustache(mustache);
} else if (type === "helper") {
this.helperMustache(mustache);
} else {
this.ambiguousMustache(mustache);
}
if(mustache.escaped && !options.noEscape) {
this.opcode('appendEscaped');
} else {
this.opcode('append');
}
},
ambiguousMustache: function(mustache, program, inverse) {
var id = mustache.id, name = id.parts[0];
this.opcode('getContext', id.depth);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('invokeAmbiguous', name);
},
simpleMustache: function(mustache, program, inverse) {
var id = mustache.id;
if (id.type === 'DATA') {
this.DATA(id);
} else if (id.parts.length) {
this.ID(id);
} else {
// Simplified ID for `this`
this.addDepth(id.depth);
this.opcode('getContext', id.depth);
this.opcode('pushContext');
}
this.opcode('resolvePossibleLambda');
},
helperMustache: function(mustache, program, inverse) {
var params = this.setupFullMustacheParams(mustache, program, inverse),
name = mustache.id.parts[0];
if (this.options.knownHelpers[name]) {
this.opcode('invokeKnownHelper', params.length, name);
} else if (this.knownHelpersOnly) {
throw new Error("You specified knownHelpersOnly, but used the unknown helper " + name);
} else {
this.opcode('invokeHelper', params.length, name);
}
},
ID: function(id) {
this.addDepth(id.depth);
this.opcode('getContext', id.depth);
var name = id.parts[0];
if (!name) {
this.opcode('pushContext');
} else {
this.opcode('lookupOnContext', id.parts[0]);
}
for(var i=1, l=id.parts.length; i<l; i++) {
this.opcode('lookup', id.parts[i]);
}
},
DATA: function(data) {
this.options.data = true;
this.opcode('lookupData', data.id);
},
STRING: function(string) {
this.opcode('pushString', string.string);
},
INTEGER: function(integer) {
this.opcode('pushLiteral', integer.integer);
},
BOOLEAN: function(bool) {
this.opcode('pushLiteral', bool.bool);
},
comment: function() {},
// HELPERS
opcode: function(name) {
this.opcodes.push({ opcode: name, args: [].slice.call(arguments, 1) });
},
declare: function(name, value) {
this.opcodes.push({ opcode: 'DECLARE', name: name, value: value });
},
addDepth: function(depth) {
if(isNaN(depth)) { throw new Error("EWOT"); }
if(depth === 0) { return; }
if(!this.depths[depth]) {
this.depths[depth] = true;
this.depths.list.push(depth);
}
},
classifyMustache: function(mustache) {
var isHelper = mustache.isHelper;
var isEligible = mustache.eligibleHelper;
var options = this.options;
// if ambiguous, we can possibly resolve the ambiguity now
if (isEligible && !isHelper) {
var name = mustache.id.parts[0];
if (options.knownHelpers[name]) {
isHelper = true;
} else if (options.knownHelpersOnly) {
isEligible = false;
}
}
if (isHelper) { return "helper"; }
else if (isEligible) { return "ambiguous"; }
else { return "simple"; }
},
pushParams: function(params) {
var i = params.length, param;
while(i--) {
param = params[i];
if(this.options.stringParams) {
if(param.depth) {
this.addDepth(param.depth);
}
this.opcode('getContext', param.depth || 0);
this.opcode('pushStringParam', param.string);
} else {
this[param.type](param);
}
}
},
setupMustacheParams: function(mustache) {
var params = mustache.params;
this.pushParams(params);
if(mustache.hash) {
this.hash(mustache.hash);
} else {
this.opcode('pushLiteral', '{}');
}
return params;
},
// this will replace setupMustacheParams when we're done
setupFullMustacheParams: function(mustache, program, inverse) {
var params = mustache.params;
this.pushParams(params);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
if(mustache.hash) {
this.hash(mustache.hash);
} else {
this.opcode('pushLiteral', '{}');
}
return params;
}
};
var Literal = function(value) {
this.value = value;
};
JavaScriptCompiler.prototype = {
// PUBLIC API: You can override these methods in a subclass to provide
// alternative compiled forms for name lookup and buffering semantics
nameLookup: function(parent, name, type) {
if (/^[0-9]+$/.test(name)) {
return parent + "[" + name + "]";
} else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return parent + "." + name;
}
else {
return parent + "['" + name + "']";
}
},
appendToBuffer: function(string) {
if (this.environment.isSimple) {
return "return " + string + ";";
} else {
return "buffer += " + string + ";";
}
},
initializeBuffer: function() {
return this.quotedString("");
},
namespace: "Handlebars",
// END PUBLIC API
compile: function(environment, options, context, asObject) {
this.environment = environment;
this.options = options || {};
Handlebars.log(Handlebars.logger.DEBUG, this.environment.disassemble() + "\n\n");
this.name = this.environment.name;
this.isChild = !!context;
this.context = context || {
programs: [],
aliases: { }
};
this.preamble();
this.stackSlot = 0;
this.stackVars = [];
this.registers = { list: [] };
this.compileStack = [];
this.compileChildren(environment, options);
var opcodes = environment.opcodes, opcode;
this.i = 0;
for(l=opcodes.length; this.i<l; this.i++) {
opcode = opcodes[this.i];
if(opcode.opcode === 'DECLARE') {
this[opcode.name] = opcode.value;
} else {
this[opcode.opcode].apply(this, opcode.args);
}
}
return this.createFunctionContext(asObject);
},
nextOpcode: function() {
var opcodes = this.environment.opcodes, opcode = opcodes[this.i + 1];
return opcodes[this.i + 1];
},
eat: function(opcode) {
this.i = this.i + 1;
},
preamble: function() {
var out = [];
if (!this.isChild) {
var namespace = this.namespace;
var copies = "helpers = helpers || " + namespace + ".helpers;";
if (this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; }
if (this.options.data) { copies = copies + " data = data || {};"; }
out.push(copies);
} else {
out.push('');
}
if (!this.environment.isSimple) {
out.push(", buffer = " + this.initializeBuffer());
} else {
out.push("");
}
// track the last context pushed into place to allow skipping the
// getContext opcode when it would be a noop
this.lastContext = 0;
this.source = out;
},
createFunctionContext: function(asObject) {
var locals = this.stackVars.concat(this.registers.list);
if(locals.length > 0) {
this.source[1] = this.source[1] + ", " + locals.join(", ");
}
// Generate minimizer alias mappings
if (!this.isChild) {
var aliases = [];
for (var alias in this.context.aliases) {
this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
}
}
if (this.source[1]) {
this.source[1] = "var " + this.source[1].substring(2) + ";";
}
// Merge children
if (!this.isChild) {
this.source[1] += '\n' + this.context.programs.join('\n') + '\n';
}
if (!this.environment.isSimple) {
this.source.push("return buffer;");
}
var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
params.push("depth" + this.environment.depths.list[i]);
}
if (asObject) {
params.push(this.source.join("\n "));
return Function.apply(this, params);
} else {
var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + this.source.join("\n ") + '}';
Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n");
return functionSource;
}
},
// [blockValue]
//
// On stack, before: hash, inverse, program, value
// On stack, after: return value of blockHelperMissing
//
// The purpose of this opcode is to take a block of the form
// `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and
// replace it on the stack with the result of properly
// invoking blockHelperMissing.
blockValue: function() {
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
var params = ["depth0"];
this.setupParams(0, params);
this.replaceStack(function(current) {
params.splice(1, 0, current);
return current + " = blockHelperMissing.call(" + params.join(", ") + ")";
});
},
// [ambiguousBlockValue]
//
// On stack, before: hash, inverse, program, value
// Compiler value, before: lastHelper=value of last found helper, if any
// On stack, after, if no lastHelper: same as [blockValue]
// On stack, after, if lastHelper: value
ambiguousBlockValue: function() {
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
var params = ["depth0"];
this.setupParams(0, params);
var current = this.topStack();
params.splice(1, 0, current);
this.source.push("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }");
},
// [appendContent]
//
// On stack, before: ...
// On stack, after: ...
//
// Appends the string value of `content` to the current buffer
appendContent: function(content) {
this.source.push(this.appendToBuffer(this.quotedString(content)));
},
// [append]
//
// On stack, before: value, ...
// On stack, after: ...
//
// Coerces `value` to a String and appends it to the current buffer.
//
// If `value` is truthy, or 0, it is coerced into a string and appended
// Otherwise, the empty string is appended
append: function() {
var local = this.popStack();
this.source.push("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
if (this.environment.isSimple) {
this.source.push("else { " + this.appendToBuffer("''") + " }");
}
},
// [appendEscaped]
//
// On stack, before: value, ...
// On stack, after: ...
//
// Escape `value` and append it to the buffer
appendEscaped: function() {
var opcode = this.nextOpcode(), extra = "";
this.context.aliases.escapeExpression = 'this.escapeExpression';
if(opcode && opcode.opcode === 'appendContent') {
extra = " + " + this.quotedString(opcode.args[0]);
this.eat(opcode);
}
this.source.push(this.appendToBuffer("escapeExpression(" + this.popStack() + ")" + extra));
},
// [getContext]
//
// On stack, before: ...
// On stack, after: ...
// Compiler value, after: lastContext=depth
//
// Set the value of the `lastContext` compiler value to the depth
getContext: function(depth) {
if(this.lastContext !== depth) {
this.lastContext = depth;
}
},
// [lookupOnContext]
//
// On stack, before: ...
// On stack, after: currentContext[name], ...
//
// Looks up the value of `name` on the current context and pushes
// it onto the stack.
lookupOnContext: function(name) {
this.pushStack(this.nameLookup('depth' + this.lastContext, name, 'context'));
},
// [pushContext]
//
// On stack, before: ...
// On stack, after: currentContext, ...
//
// Pushes the value of the current context onto the stack.
pushContext: function() {
this.pushStackLiteral('depth' + this.lastContext);
},
// [resolvePossibleLambda]
//
// On stack, before: value, ...
// On stack, after: resolved value, ...
//
// If the `value` is a lambda, replace it on the stack by
// the return value of the lambda
resolvePossibleLambda: function() {
this.context.aliases.functionType = '"function"';
this.replaceStack(function(current) {
return "typeof " + current + " === functionType ? " + current + "() : " + current;
});
},
// [lookup]
//
// On stack, before: value, ...
// On stack, after: value[name], ...
//
// Replace the value on the stack with the result of looking
// up `name` on `value`
lookup: function(name) {
this.replaceStack(function(current) {
return current + " == null || " + current + " === false ? " + current + " : " + this.nameLookup(current, name, 'context');
});
},
// [lookupData]
//
// On stack, before: ...
// On stack, after: data[id], ...
//
// Push the result of looking up `id` on the current data
lookupData: function(id) {
this.pushStack(this.nameLookup('data', id, 'data'));
},
// [pushStringParam]
//
// On stack, before: ...
// On stack, after: string, currentContext, ...
//
// This opcode is designed for use in string mode, which
// provides the string value of a parameter along with its
// depth rather than resolving it immediately.
pushStringParam: function(string) {
this.pushStackLiteral('depth' + this.lastContext);
this.pushString(string);
},
// [pushString]
//
// On stack, before: ...
// On stack, after: quotedString(string), ...
//
// Push a quoted version of `string` onto the stack
pushString: function(string) {
this.pushStackLiteral(this.quotedString(string));
},
// [push]
//
// On stack, before: ...
// On stack, after: expr, ...
//
// Push an expression onto the stack
push: function(expr) {
this.pushStack(expr);
},
// [pushLiteral]
//
// On stack, before: ...
// On stack, after: value, ...
//
// Pushes a value onto the stack. This operation prevents
// the compiler from creating a temporary variable to hold
// it.
pushLiteral: function(value) {
this.pushStackLiteral(value);
},
// [pushProgram]
//
// On stack, before: ...
// On stack, after: program(guid), ...
//
// Push a program expression onto the stack. This takes
// a compile-time guid and converts it into a runtime-accessible
// expression.
pushProgram: function(guid) {
if (guid != null) {
this.pushStackLiteral(this.programExpression(guid));
} else {
this.pushStackLiteral(null);
}
},
// [invokeHelper]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of helper invocation
//
// Pops off the helper's parameters, invokes the helper,
// and pushes the helper's return value onto the stack.
//
// If the helper is not found, `helperMissing` is called.
invokeHelper: function(paramSize, name) {
this.context.aliases.helperMissing = 'helpers.helperMissing';
var helper = this.lastHelper = this.setupHelper(paramSize, name);
this.register('foundHelper', helper.name);
this.pushStack("foundHelper ? foundHelper.call(" +
helper.callParams + ") " + ": helperMissing.call(" +
helper.helperMissingParams + ")");
},
// [invokeKnownHelper]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of helper invocation
//
// This operation is used when the helper is known to exist,
// so a `helperMissing` fallback is not required.
invokeKnownHelper: function(paramSize, name) {
var helper = this.setupHelper(paramSize, name);
this.pushStack(helper.name + ".call(" + helper.callParams + ")");
},
// [invokeAmbiguous]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of disambiguation
//
// This operation is used when an expression like `{{foo}}`
// is provided, but we don't know at compile-time whether it
// is a helper or a path.
//
// This operation emits more code than the other options,
// and can be avoided by passing the `knownHelpers` and
// `knownHelpersOnly` flags at compile-time.
invokeAmbiguous: function(name) {
this.context.aliases.functionType = '"function"';
this.pushStackLiteral('{}');
var helper = this.setupHelper(0, name);
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
this.register('foundHelper', helperName);
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
var nextStack = this.nextStack();
this.source.push('if (foundHelper) { ' + nextStack + ' = foundHelper.call(' + helper.callParams + '); }');
this.source.push('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '() : ' + nextStack + '; }');
},
// [invokePartial]
//
// On stack, before: context, ...
// On stack after: result of partial invocation
//
// This operation pops off a context, invokes a partial with that context,
// and pushes the result of the invocation back.
invokePartial: function(name) {
var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"];
if (this.options.data) {
params.push("data");
}
this.context.aliases.self = "this";
this.pushStack("self.invokePartial(" + params.join(", ") + ");");
},
// [assignToHash]
//
// On stack, before: value, hash, ...
// On stack, after: hash, ...
//
// Pops a value and hash off the stack, assigns `hash[key] = value`
// and pushes the hash back onto the stack.
assignToHash: function(key) {
var value = this.popStack();
var hash = this.topStack();
this.source.push(hash + "['" + key + "'] = " + value + ";");
},
// HELPERS
compiler: JavaScriptCompiler,
compileChildren: function(environment, options) {
var children = environment.children, child, compiler;
for(var i=0, l=children.length; i<l; i++) {
child = children[i];
compiler = new this.compiler();
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
var index = this.context.programs.length;
child.index = index;
child.name = 'program' + index;
this.context.programs[index] = compiler.compile(child, options, this.context);
}
},
programExpression: function(guid) {
this.context.aliases.self = "this";
if(guid == null) {
return "self.noop";
}
var child = this.environment.children[guid],
depths = child.depths.list, depth;
var programParams = [child.index, child.name, "data"];
for(var i=0, l = depths.length; i<l; i++) {
depth = depths[i];
if(depth === 1) { programParams.push("depth0"); }
else { programParams.push("depth" + (depth - 1)); }
}
if(depths.length === 0) {
return "self.program(" + programParams.join(", ") + ")";
} else {
programParams.shift();
return "self.programWithDepth(" + programParams.join(", ") + ")";
}
},
register: function(name, val) {
this.useRegister(name);
this.source.push(name + " = " + val + ";");
},
useRegister: function(name) {
if(!this.registers[name]) {
this.registers[name] = true;
this.registers.list.push(name);
}
},
pushStackLiteral: function(item) {
this.compileStack.push(new Literal(item));
return item;
},
pushStack: function(item) {
this.source.push(this.incrStack() + " = " + item + ";");
this.compileStack.push("stack" + this.stackSlot);
return "stack" + this.stackSlot;
},
replaceStack: function(callback) {
var item = callback.call(this, this.topStack());
this.source.push(this.topStack() + " = " + item + ";");
return "stack" + this.stackSlot;
},
nextStack: function(skipCompileStack) {
var name = this.incrStack();
this.compileStack.push("stack" + this.stackSlot);
return name;
},
incrStack: function() {
this.stackSlot++;
if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
return "stack" + this.stackSlot;
},
popStack: function() {
var item = this.compileStack.pop();
if (item instanceof Literal) {
return item.value;
} else {
this.stackSlot--;
return item;
}
},
topStack: function() {
var item = this.compileStack[this.compileStack.length - 1];
if (item instanceof Literal) {
return item.value;
} else {
return item;
}
},
quotedString: function(str) {
return '"' + str
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r') + '"';
},
setupHelper: function(paramSize, name) {
var params = [];
this.setupParams(paramSize, params);
var foundHelper = this.nameLookup('helpers', name, 'helper');
return {
params: params,
name: foundHelper,
callParams: ["depth0"].concat(params).join(", "),
helperMissingParams: ["depth0", this.quotedString(name)].concat(params).join(", ")
};
},
// the params and contexts arguments are passed in arrays
// to fill in
setupParams: function(paramSize, params) {
var options = [], contexts = [], param, inverse, program;
options.push("hash:" + this.popStack());
inverse = this.popStack();
program = this.popStack();
// Avoid setting fn and inverse if neither are set. This allows
// helpers to do a check for `if (options.fn)`
if (program || inverse) {
if (!program) {
this.context.aliases.self = "this";
program = "self.noop";
}
if (!inverse) {
this.context.aliases.self = "this";
inverse = "self.noop";
}
options.push("inverse:" + inverse);
options.push("fn:" + program);
}
for(var i=0; i<paramSize; i++) {
param = this.popStack();
params.push(param);
if(this.options.stringParams) {
contexts.push(this.popStack());
}
}
if (this.options.stringParams) {
options.push("contexts:[" + contexts.join(",") + "]");
}
if(this.options.data) {
options.push("data:data");
}
params.push("{" + options.join(",") + "}");
return params.join(", ");
}
};
var reservedWords = (
"break else new var" +
" case finally return void" +
" catch for switch while" +
" continue function this with" +
" default if throw" +
" delete in try" +
" do instanceof typeof" +
" abstract enum int short" +
" boolean export interface static" +
" byte extends long super" +
" char final native synchronized" +
" class float package throws" +
" const goto private transient" +
" debugger implements protected volatile" +
" double import public let yield"
).split(" ");
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
for(var i=0, l=reservedWords.length; i<l; i++) {
compilerWords[reservedWords[i]] = true;
}
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
return true;
}
return false;
};
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
Handlebars.precompile = function(string, options) {
options = options || {};
var ast = Handlebars.parse(string);
var environment = new Handlebars.Compiler().compile(ast, options);
return new Handlebars.JavaScriptCompiler().compile(environment, options);
};
Handlebars.compile = function(string, options) {
options = options || {};
var compiled;
function compile() {
var ast = Handlebars.parse(string);
var environment = new Handlebars.Compiler().compile(ast, options);
var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
return Handlebars.template(templateSpec);
}
// Template is only compiled on first use and cached after that point.
return function(context, options) {
if (!compiled) {
compiled = compile();
}
return compiled.call(this, context, options);
};
};
;
// lib/handlebars/runtime.js
Handlebars.VM = {
template: function(templateSpec) {
// Just add water
var container = {
escapeExpression: Handlebars.Utils.escapeExpression,
invokePartial: Handlebars.VM.invokePartial,
programs: [],
program: function(i, fn, data) {
var programWrapper = this.programs[i];
if(data) {
return Handlebars.VM.program(fn, data);
} else if(programWrapper) {
return programWrapper;
} else {
programWrapper = this.programs[i] = Handlebars.VM.program(fn);
return programWrapper;
}
},
programWithDepth: Handlebars.VM.programWithDepth,
noop: Handlebars.VM.noop
};
return function(context, options) {
options = options || {};
return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
};
},
programWithDepth: function(fn, data, $depth) {
var args = Array.prototype.slice.call(arguments, 2);
return function(context, options) {
options = options || {};
return fn.apply(this, [context, options.data || data].concat(args));
};
},
program: function(fn, data) {
return function(context, options) {
options = options || {};
return fn(context, options.data || data);
};
},
noop: function() { return ""; },
invokePartial: function(partial, name, context, helpers, partials, data) {
var options = { helpers: helpers, partials: partials, data: data };
if(partial === undefined) {
throw new Handlebars.Exception("The partial " + name + " could not be found");
} else if(partial instanceof Function) {
return partial(context, options);
} else if (!Handlebars.compile) {
throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
} else {
partials[name] = Handlebars.compile(partial, {data: data !== undefined});
return partials[name](context, options);
}
}
};
Handlebars.template = Handlebars.VM.template;
;
(function(){window.i18n={};var MessageFormat={locale:{}};MessageFormat.locale.en = function ( n ) {
if ( n === 1 ) {
return "one";
}
return "other";
};
;window.i18n['todo']={};;window.i18n['todo']['todos']=function(d){
var r = "";
r += "todos";
return r;
};window.i18n['todo']['whatNeedsDone']=function(d){
var r = "";
r += "What needs to be done?";
return r;
};window.i18n['todo']['markAllAsComplete']=function(d){
var r = "";
r += "Mark all as complete";
return r;
};window.i18n['todo']['itemCount']=function(d){
var r = "";
if(!d){
throw new Error("MessageFormat: No data passed to function.");
}
r += d["ITEMS"];
r += " ";
if(!d){
throw new Error("MessageFormat: No data passed to function.");
}
var lastkey_1 = "ITEMS";
var k_1=d[lastkey_1];
var off_0 = 0;
var pf_0 = {
"one" : function(d){
var r = "";
r += "item";
return r;
},
"other" : function(d){
var r = "";
r += "items";
return r;
}
};
if ( pf_0[ k_1 + "" ] ) {
r += pf_0[ k_1 + "" ]( d );
}
else {
r += (pf_0[ MessageFormat.locale["en"]( k_1 - off_0 ) ] || pf_0[ "other" ] )( d );
}
r += " left";
return r;
};window.i18n['todo']['clearCompleted']=function(d){
var r = "";
r += "Clear completed";
return r;
};window.i18n['todo']['all']=function(d){
var r = "";
r += "All";
return r;
};window.i18n['todo']['active']=function(d){
var r = "";
r += "Active";
return r;
};window.i18n['todo']['complete']=function(d){
var r = "";
r += "Complete";
return r;
};window.i18n['todo']['doubleClickEdit']=function(d){
var r = "";
r += "Double-click to edit a todo";
return r;
};window.i18n['todo']['fullSource']=function(d){
var r = "";
r += "Full Source";
return r;
};window.i18n['todo']['createdBy']=function(d){
var r = "";
r += "Created by <a href=\"";
if(!d){
throw new Error("MessageFormat: No data passed to function.");
}
r += d["URL"];
r += "\">";
if(!d){
throw new Error("MessageFormat: No data passed to function.");
}
r += d["NAME"];
r += "</a>";
return r;
};window.i18n['todo']['partOf']=function(d){
var r = "";
r += "Part of <a href=\"";
if(!d){
throw new Error("MessageFormat: No data passed to function.");
}
r += d["URL"];
r += "\">";
if(!d){
throw new Error("MessageFormat: No data passed to function.");
}
r += d["NAME"];
r += "</a>";
return r;
}})();
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
(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===document.location.host&&t.target.port===document.location.port&&t.target.protocol===document.location.protocol?this.navigateRoute(t.target.pathname)?(history.pushState({one:1},null,t.target.href),t.preventDefault()):void 0:void 0},e.prototype.onPopState=function(){return this.navigateRoute(window.location.pathname)},e.prototype.navigateRoute=function(t){var e,n,r,o,s,a,l,h,u,c;if(this.isNavigating=!0,null==t||0===t.length){if(a=this.routes["/"],null!=a)return a.callback(a.data,r),this.isNavigating=!1,!1;i.log("routemanager","WARNING: No Default route defined, no route for path",t)}u=this.routes;for(o in u)if(a=u[o],r={},n=a.regex.exec(t),null!==n){for(e=1,c=a.params,l=0,h=c.length;h>l;l++)s=c[l],n.length>e&&(r[s]=n[e++]);return a.callback(a.data,r),this.isNavigating=!1,!0}return this.isNavigating=!1,this.trigger("noroute",window.location.hash),!1},e.prototype.release=function(){return this.stop(),e.__super__.release.apply(this,arguments)},e.prototype._escForRegEx=function(t){var e,n,r,i;for(t.replace("\\","\\\\"),e="./+{}()*",r=0,i=e.length;i>r;r++)n=e[r],t=t.replace(n,"\\"+n);return t},e}(e)}).call(this)}),t.define("/model-instance.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.Instance=e=function(t){function e(){return this.copyFrom=o(this.copyFrom,this),this.copyTo=o(this.copyTo,this),this.set=o(this.set,this),this.get=o(this.get,this),this.destroy=o(this.destroy,this),this.save=o(this.save,this),this.load=o(this.load,this),e.__super__.constructor.apply(this,arguments)}var n;return a(e,t),n=["id"],e.prototype.init=function(){return this._type=this.modelClass.modelName},e.prototype.load=function(t){return null==t&&(t={}),this.modelClass.loadInstance(this,t)},e.prototype.save=function(t){return null==t&&(t={}),this.modelClass.exists(this.id)?(this.modelClass.updateInstance(this,t),this.trigger("update")):(this.modelClass.createInstance(this,t),this.trigger("create")),this.trigger("change")},e.prototype.destroy=function(t){return null==t&&(t={}),this.trigger("destroy",t),this.trigger("change"),this.modelClass.destroyInstance(this,t)},e.prototype.get=function(t){if(this.modelClass.hasAttribute(t)||i.isFunction(this[t]))return i.isFunction(this[t])?this[t].apply(this):e.__super__.get.call(this,t);throw Error(""+this.modelClass.modelName+" has no attribute or relation '"+t+"' or foreign key '"+t+"_id'")},e.prototype.set=function(t,n){if(this.modelClass.hasAttribute(t)||i.isFunction(this[t]))return i.isFunction(this[t])?this[t](n):("id"!==t&&this.modelClass.hasIndex(t)&&this.modelClass.exists(this.id)&&this.modelClass.updateIndex(t,this,this[t],n),e.__super__.set.call(this,t,n));throw Error(""+this.modelClass.modelName+" has no attribute or relation '"+t+"' or foreign key '"+t+"_id'")},e.prototype.copyTo=function(t){var e,i,o;null==t&&(t=r.create()),o=this.modelClass.attrs;for(e in o)i=o[e],0>l.call(n,e)&&(null!=t.set?t.set(e,this[e]):t[e]=this[e]);return t},e.prototype.copyFrom=function(t){var e,r,i,o,s;r=!1;for(e in t)s=t[e],0>l.call(n,e)&&(o=this.modelClass.attrs[e],null!=o&&(i=s,"decimal"===o&&(i=parseFloat(i)),this[e]!==i&&(r=!0,this.set(e,i))));return r},e}(r)}).call(this)}),t.define("/model-instancecollection.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("./object").MztObject,n.InstanceCollection=e=function(t){function e(){return this.unBindEvents=o(this.unBindEvents,this),this.bindEvents=o(this.bindEvents,this),this.allAsMap=o(this.allAsMap,this),this.count=o(this.count,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.count=function(){return this.all().length},e.prototype.allAsMap=function(){return i.toMap(this.all())},e.prototype.all=function(){return[]},e.prototype.bindEvents=function(t){var e,n,r,i;for(i=[],n=0,r=t.length;r>n;n++)e=t[n],e.bind("create",this.onModelChange),e.bind("update",this.onModelChange),i.push(e.bind("destroy",this.onModelChange));return i},e.prototype.unBindEvents=function(t){var e,n,r,i;for(i=[],n=0,r=t.length;r>n;n++)e=t[n],e.unbind("create",this.onModelChange),e.unbind("update",this.onModelChange),i.push(e.unbind("destroy",this.onModelChange));return i},e}(r)}).call(this)}),t.define("/model-onetomanycollection.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};e=t("./model-instancecollection").InstanceCollection,n.OneToManyCollection=r=function(t){function e(){return this.release=i(this.release,this),this.onModelChange=i(this.onModelChange,this),this.contains=i(this.contains,this),this.remove=i(this.remove,this),this.createFromValues=i(this.createFromValues,this),this.add=i(this.add,this),this.all=i(this.all,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.init=function(){return this.bindEvents([this.otherModel])},e.prototype.all=function(){return this.otherModel.findByAttribute(this.fkname,this.record.id)},e.prototype.add=function(t){return t.set(this.fkname,this.record.id),t.save(),this.record.trigger("change:"+this.attribute)},e.prototype.createFromValues=function(t){var e;return e=this.otherModel.initInstance(t),this.add(e),e},e.prototype.remove=function(t){return t.set(this.fkname,null),this.record.trigger("change:"+this.attribute)},e.prototype.contains=function(){return this.otherModel.findByAttribute(this.fkname,this.record.id).length>0},e.prototype.onModelChange=function(t){return this.trigger("change",t)},e.prototype.release=function(){return this.unBindEvents([this.otherModel]),e.__super__.release.apply(this,arguments)},e}(e)}).call(this)}),t.define("/model-onetomanypolycollection.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};e=t("./model-instancecollection").InstanceCollection,n.OneToManyPolyCollection=r=function(t){function e(){return this.contains=i(this.contains,this),this.remove=i(this.remove,this),this.add=i(this.add,this),this.createFromValues=i(this.createFromValues,this),this.all=i(this.all,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.all=function(){var t;return t={},t[this.thatFkAttr]=this.record.id,t[this.thatTypeAttr]=this.model.modelName,this.otherModel.findByAttributes(t)},e.prototype.createFromValues=function(t){var e;return e=this.otherModel.initInstance(t),this.add(e),e},e.prototype.add=function(t){return t.set(this.thatFkAttr,this.record.id),t.set(this.thatTypeAttr,this.model.modelName),t.save()},e.prototype.remove=function(t){return t.set(this.thatFkAttr,null),t.set(this.thatTypeAttr,null),t.save()},e.prototype.contains=function(){var t;return t={},t[this.thatFkAttr]=this.record.id,t[this.thatTypeAttr]=this.model.modelName,0!==this.otherModel.findByAttributes(t).length},e}(e)}).call(this)}),t.define("/model-manytomanycollection.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};e=t("./model-instancecollection").InstanceCollection,n.ManyToManyCollection=r=function(t){function e(){return this.release=i(this.release,this),this.onModelChange=i(this.onModelChange,this),this.contains=i(this.contains,this),this.remove=i(this.remove,this),this.createFromValues=i(this.createFromValues,this),this.add=i(this.add,this),this.all=i(this.all,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.init=function(){return this.bindEvents([this.linkModel])},e.prototype.all=function(){var t,e,n,r,i;for(e=this.linkModel.findByAttribute(this.thisFkAttr,this.record.id),i=[],n=0,r=e.length;r>n;n++)t=e[n],i.push(this.otherModel.findById(t[this.thatFkAttr]));return i},e.prototype.add=function(t){var e,n;return n={},n[this.thisFkAttr]=this.record.id,n[this.thatFkAttr]=t.id,0===this.linkModel.findByAttributes(n).length?(e=this.linkModel.initInstance(),e.set(this.thisFkAttr,this.record.id),e.set(this.thatFkAttr,t.id),e.save(),e):void 0},e.prototype.createFromValues=function(t){var e;return e=this.otherModel.initInstance(t),e.save(),this.add(e),e},e.prototype.remove=function(t){var e,n,r,i,o,s;for(r={},r[this.thisFkAttr]=this.record.id,r[this.thatFkAttr]=t.id,n=this.linkModel.findByAttributes(r),s=[],i=0,o=n.length;o>i;i++)e=n[i],s.push(e.destroy());return s},e.prototype.contains=function(t){var e;return e={},e[this.thisFkAttr]=this.record.id,e[this.thatFkAttr]=t.id,0!==this.linkModel.findByAttributes(e).length},e.prototype.onModelChange=function(t){var e;return t.get(this.thisFkAttr)===this.record.id?(e=this.otherModel.findById(t[this.thatFkAttr]),this.trigger("change",e)):void 0},e.prototype.release=function(){return this.unBindEvents([this.linkModel]),e.__super__.release.apply(this,arguments)},e}(e)}).call(this)}),t.define("/model-manytomanypolycollection.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};e=t("./model-instancecollection").InstanceCollection,n.ManyToManyPolyCollection=r=function(t){function e(){return this.release=i(this.release,this),this.onModelChange=i(this.onModelChange,this),this.contains=i(this.contains,this),this.remove=i(this.remove,this),this.add=i(this.add,this),this.createFromValues=i(this.createFromValues,this),this.all=i(this.all,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.init=function(){return this.bindEvents([this.linkModel])},e.prototype.all=function(){var t,e,n,r,i,o;for(n={},n[this.thisFkAttr]=this.record.id,n[this.thatTypeAttr]=this.otherModel.modelName,e=this.linkModel.findByAttributes(n),o=[],r=0,i=e.length;i>r;r++)t=e[r],o.push(this.otherModel.findById(t[this.thatFkAttr]));return o},e.prototype.createFromValues=function(t){var e;return e=this.otherModel.initInstance(t),e.save(),this.add(e),e},e.prototype.add=function(t){var e,n;return n={},n[this.thisFkAttr]=this.record.id,n[this.thatFkAttr]=t.id,n[this.thatTypeAttr]=this.otherModel.modelName,0===this.linkModel.findByAttributes(n).length?(e=this.linkModel.initInstance(),e.set(this.thisFkAttr,this.record.id),e.set(this.thatFkAttr,t.id),e.set(this.thatTypeAttr,this.otherModel.modelName),e.save(),e):void 0},e.prototype.remove=function(t){var e,n,r,i,o,s;for(n={},n[this.thisFkAttr]=this.record.id,n[this.thatFkAttr]=t.id,n[this.thatTypeAttr]=this.otherModel.modelName,o=this.linkModel.findByAttributes(n),s=[],r=0,i=o.length;i>r;r++)e=o[r],s.push(e.destroy());return s},e.prototype.contains=function(t){var e;return e={},e[this.thisFkAttr]=this.record.id,e[this.thatFkAttr]=t.id,e[this.thatTypeAttr]=this.otherModel.modelName,0!==this.linkModel.findByAttributes(e).length},e.prototype.onModelChange=function(t){var e;return t[this.thisFkAttr]===this.record.id&&t[this.thatTypeAttr]===this.otherModel.modelName?(e=this.otherModel.findById(t[this.thatFkAttr]),this.trigger("change",e)):void 0},e.prototype.release=function(){return this.unBindEvents([this.linkModel]),e.__super__.release.apply(this,arguments)},e}(e)}).call(this)}),t.define("/model-manytomanypolyreversecollection.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};e=t("./model-instancecollection").InstanceCollection,n.ManyToManyPolyReverseCollection=r=function(t){function e(){return this.release=i(this.release,this),this.onModelChange=i(this.onModelChange,this),this.contains=i(this.contains,this),this.remove=i(this.remove,this),this.add=i(this.add,this),this.createFromValues=i(this.createFromValues,this),this.all=i(this.all,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.init=function(){return this.bindEvents([this.linkModel])},e.prototype.all=function(){var t,e,n,r,i,o;for(n={},n[this.thatFkAttr]=this.record.id,n[this.thatTypeAttr]=this.model.modelName,e=this.linkModel.findByAttributes(n),o=[],r=0,i=e.length;i>r;r++)t=e[r],o.push(this.otherModel.findById(t[this.thisFkAttr]));return o},e.prototype.createFromValues=function(t){var e;return e=this.otherModel.initInstance(t),e.save(),this.add(e),e},e.prototype.add=function(t){var e,n;return n={},n[this.thisFkAttr]=t.id,n[this.thatFkAttr]=this.record.id,n[this.thatTypeAttr]=this.model.modelName,0===this.linkModel.findByAttributes(n).length?(e=this.linkModel.initInstance(),e.set(this.thisFkAttr,t.id),e.set(this.thatFkAttr,this.record.id),e.set(this.thatTypeAttr,this.model.modelName),e.save(),e):void 0},e.prototype.remove=function(t){var e,n,r,i,o,s;for(n={},n[this.thisFkAttr]=t.id,n[this.thatFkAttr]=this.record.id,n[this.thatTypeAttr]=this.model.modelName,o=this.linkModel.findByAttributes(n),s=[],r=0,i=o.length;i>r;r++)e=o[r],s.push(e.destroy());return s},e.prototype.contains=function(t){var e;return e={},e[this.thisFkAttr]=t.id,e[this.thatFkAttr]=this.record.id,e[this.thatTypeAttr]=this.model.modelName,0!==this.linkModel.findByAttributes(e).length
},e.prototype.onModelChange=function(t){var e;return t[this.thatFkAttr]===this.record.id&&t[this.thatTypeAttr]===this.model.modelName?(e=this.model.findById(t[this.thisFkAttr]),this.trigger("change",e)):void 0},e.prototype.release=function(){return this.unBindEvents([this.linkModel]),e.__super__.release.apply(this,arguments)},e}(e)}).call(this)}),t.define("/model-ajax.coffee",function(t){(function(){var e,n,r,i;e=t("./model").Model,n=t("./util"),i={},r={},e.extend({ajax:function(t){var e,o,s,a,l,h,u,c,d;for(h=["url","interface","plural"],o=0,s=h.length;s>o;o++)e=h[o],null!=t[e]&&(this[e]=t[e]);return this.bind("load",this.loadServer),this.bind("create",this.createServer),this.bind("update",this.updateServer),this.bind("destroy",this.destroyServer),null==(u=i[a=this.modelName])&&(i[a]={}),null==(c=r[l=this.modelName])&&(r[l]={}),null==(d=Mozart.Ajax)&&(Mozart.Ajax=Mozart.MztObject.create({handleError:function(t,e,r,i){switch(t.status){case 401:return Mozart.Ajax.trigger("httpAuthorizationRequired",r,t);case 404:return Mozart.Ajax.trigger("httpForbidden",r,t);default:return n.error("Model.Ajax.handleError",t,e,i)}}})),this.instanceClass.extend({getServerId:function(){return this.modelClass.getServerId(this.id)},existsOnServer:function(){return null!=this.modelClass.getServerId(this.id)},loadServer:function(){return this.modelClass.load(this.modelClass.getServerId(this.id))}})},registerServerId:function(t,e){if(null==i[this.modelName])throw Error("Model.registerServerId: "+this.modelName+" is not registered for ajax.");return i[this.modelName][e]=t,r[this.modelName][t]=e},unRegisterServerId:function(t,e){return delete i[this.modelName][e],delete r[this.modelName][t]},getServerId:function(t){return r[this.modelName][t]},getClientId:function(t){return i[this.modelName][t]},toServerObject:function(t){var n,r,i,o,s,a,l,h;i={},a=this.attrs;for(n in a)o=a[n],"id"!==n&&(i[n]=t[n]);i.id=this.getServerId(t.id),l=this.fks;for(n in l)r=l[n],i[n]=r.getServerId(t[n]);h=this.polyFks;for(n in h)s=h[n],i[n]=null!=t[s]?e.models[t[s]].getServerId(t[n]):null;return i},toClientObject:function(t){var n,r,i,o,s,a,l,h;i={},a=this.attrs;for(n in a)o=a[n],"id"!==n&&t[n]!==void 0&&(i[n]=t[n]);i.id=this.getClientId(t.id),l=this.fks;for(n in l)r=l[n],t[n]!==void 0&&(i[n]=r.getClientId(t[n]),i[n]===void 0&&(i[n]=null));h=this.polyFks;for(n in h)s=h[n],i[n]=t[n]!==void 0&&null!=t[s]?e.models[t[s]].getClientId(t[n]):null;return i},loadServer:function(t){var e;return e=t.modelClass.getServerId(t.id),null!=e?t.modelClass.load(e):void 0},createServer:function(t){return t.modelClass.createAjax(t.id,t.modelClass.toServerObject(t))},updateServer:function(t){var e;return e=t.modelClass.getServerId(t.id),null!=e?t.modelClass.updateAjax(e,t.id,t.modelClass.toServerObject(t)):void 0},destroyServer:function(t){var e;return e=t.modelClass.getServerId(t.id),null!=e?t.modelClass.destroyAjax(t.modelClass.getServerId(t.id),t.id):void 0},loadAll:function(){var t,e,r,i;return i=function(t,e){var n,r,i;for(null!=this.model.plural&&(t=t[this.model.plural]),r=0,i=t.length;i>r;r++)n=t[r],this.model._processLoad(n,this.model,e);return this.model.trigger("loadAllComplete")},r=function(t,e,n){return Mozart.Ajax.handleError(t,e,this,n)},e=function(t,e){return n.log("ajax","Model.loadAll.onComplete",t,e)},t=Mozart.HTTP.create(),t.get(this.url,{options:{context:{model:this}},callbacks:{success:i,error:r,complete:e}})},load:function(t){var e,r,i,o;return o=function(t,e){return null!=this.model.plural&&(t=t[this.model.plural]),this.model._processLoad(t,this.model,e)},i=function(t,e,n){return Mozart.Ajax.handleError(t,e,this,n)},r=function(t,e){return n.log("ajax","Model.load.onComplete",t,e)},e=Mozart.HTTP.create(),e.get(this.url+"/"+t,{options:{context:{model:this,id:t}},callbacks:{success:o,error:i,complete:r}})},_processLoad:function(t,e,r){var i,o,s;return s=t.id,i=e.toClientObject(t),o=e.findById(i.id),null==o&&(o=e.initInstance(t)),e.registerServerId(o.id,s),o.copyFrom(i),o.save({disableModelCreateEvent:!0,disableModelUpdateEvent:!0}),n.log("ajax","Model._processLoad.onSuccess",r,t),e.trigger("loadComplete",o)},createAjax:function(t,e){var r,i,o,s;return s=function(e,r){return this.model.registerServerId(this.clientId,e.id),n.log("ajax","Model.createAjax.onSuccess",r,e),this.model.trigger("createComplete",this.model.findById(t))},o=function(t,e,n){return Mozart.Ajax.handleError(t,e,this,n)},i=function(t,e){return n.log("ajax","Model.createAjax.onComplete",t,e)},r=Mozart.HTTP.create(),r.post(this.url,{data:JSON.stringify(e),options:{context:{model:this,clientId:t}},callbacks:{success:s,error:o,complete:i}})},updateAjax:function(t,e,r){var i,o,s,a;return a=function(t,r){return n.log("ajax","Model.updateAjax.onSuccess",r,t),this.model.trigger("updateComplete",this.model.findById(e))},s=function(t,e,n){return Mozart.Ajax.handleError(t,e,this,n)},o=function(t,e){return n.log("ajax","Model.updateAjax.onComplete",t,e)},i=Mozart.HTTP.create(),i.put(this.url+"/"+t,{data:JSON.stringify(r),options:{context:{model:this,clientId:this.clientId,serverId:this.serverId}},callbacks:{success:a,error:s,complete:o}})},destroyAjax:function(t,e){var r,i,o,s;return s=function(r,i){return this.model.unRegisterServerId(e,t),n.log("ajax","Model.destroyAjax.onSuccess",i,r),this.model.trigger("destroyComplete",t)},o=function(t,e,n){return Mozart.Ajax.handleError(t,e,this,n)},i=function(t,e){return n.log("ajax","Model.destroyAjax.onComplete",t,e)},r=Mozart.HTTP.create(),r["delete"](this.url+"/"+t,{options:{context:{model:this,clientId:e,serverId:t}},callbacks:{success:s,error:o,complete:i}})}})}).call(this)}),t.define("/model.coffee",function(t,e,n){(function(){var e,r,i,o,s,a,l,h,u,c,d,p=function(t,e){return function(){return t.apply(e,arguments)}},f={}.hasOwnProperty,g=function(t,e){function n(){this.constructor=t}for(var r in e)f.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};d=t("./util"),h=t("./object").MztObject,e=t("./data-index").DataIndex,r=t("./model-instance").Instance,i=t("./model-instancecollection").InstanceCollection,u=t("./model-onetomanycollection").OneToManyCollection,c=t("./model-onetomanypolycollection").OneToManyPolyCollection,o=t("./model-manytomanycollection").ManyToManyCollection,s=t("./model-manytomanypolycollection").ManyToManyPolyCollection,a=t("./model-manytomanypolyreversecollection").ManyToManyPolyReverseCollection,n.Model=l=function(t){function n(){return this.index=p(this.index,this),this._generateId=p(this._generateId,this),this._getInstance=p(this._getInstance,this),this.toSnakeCase=p(this.toSnakeCase,this),this.destroyInstance=p(this.destroyInstance,this),this.updateInstance=p(this.updateInstance,this),this.createInstance=p(this.createInstance,this),this.loadInstance=p(this.loadInstance,this),this.createFromValues=p(this.createFromValues,this),this.initInstance=p(this.initInstance,this),this.exists=p(this.exists,this),this.findByAttributes=p(this.findByAttributes,this),this.findByAttribute=p(this.findByAttribute,this),this.selectAsMap=p(this.selectAsMap,this),this.selectIds=p(this.selectIds,this),this.select=p(this.select,this),this.findAll=p(this.findAll,this),this.findById=p(this.findById,this),this.count=p(this.count,this),this.allAsMap=p(this.allAsMap,this),this.all=p(this.all,this),this.hasManyThrough=p(this.hasManyThrough,this),this.hasMany=p(this.hasMany,this),this.belongsToPoly=p(this.belongsToPoly,this),this.belongsTo=p(this.belongsTo,this),this.polyForeignKeys=p(this.polyForeignKeys,this),this.foreignKeys=p(this.foreignKeys,this),this.attributes=p(this.attributes,this),this.reset=p(this.reset,this),n.__super__.constructor.apply(this,arguments)}return g(n,t),n.idCount=1,n.indexForeignKeys=!0,n.models={},n.prototype.toString=function(){return"Model: "+this.modelName},n.prototype.init=function(){var t;if(null==this.modelName)throw Error("Model must have a modelName");return this.records={},this.fks={},this.polyFks={},this.attrs={id:"integer"},this.relations={},this.indexes={},n.models[this.modelName]=this,this.instanceClass=t=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return g(e,t),e}(r)},n.prototype.reset=function(){var t,e,n;n=this.records;for(t in n)e=n[t],e.release();return this.records={},this.rebuildAllIndexes()},n.prototype.attributes=function(t){var e,n,r;r=[];for(e in t)n=t[e],r.push(this.attrs[e]=n);return r},n.prototype.hasAttribute=function(t){return null!=this.attrs[t]||null!=this.fks[t+"_id"]},n.prototype.hasRelation=function(t){return null!=this.relations[t]},n.prototype.foreignKeys=function(t){var e,r,i;i=[];for(e in t)r=t[e],this.fks[e]=r,n.DataIndexForeignKeys?i.push(this.index(e)):i.push(void 0);return i},n.prototype.polyForeignKeys=function(t){var e,r,i;i=[];for(e in t)r=t[e],this.polyFks[e]=r,n.DataIndexForeignKeys?i.push(this.index(e)):i.push(void 0);return i},n.prototype.belongsTo=function(t,e,n){var r,i,o,s,a;return null==e&&null==e&&(e=this.toSnakeCase(t.modelName)),i={},null==n&&(n=e+"_id"),i[n]="integer",this.attributes(i),o={},o[n]=t,this.foreignKeys(o),s={},s[e]=function(r){var i;if(1===arguments.length){if(null!==r&&(null==r.modelClass||r.modelClass!==t))throw Error("Cannot assign "+r+" to belongsTo "+this.modelClass.modelName+":"+e+" (Value is not an Instance or incorrect ModelClass)");return null!=r?this.set(n,r.id):this.set(n,null)}return i=this[n],null==i?null:t.findById(i)},this.instanceClass.extend(s),r=this,a=function(e){var r,i,o,s,a;for(s=t.findByAttribute(n,e.id),a=[],i=0,o=s.length;o>i;i++)r=s[i],r.set(n,null),a.push(r.save());return a},t.bind("destroy",a)},n.prototype.hasOne=function(t,e,n){var r,i,o,s;return null==e&&(e=this.toSnakeCase(this.modelName)),i={},null==n&&(n=e+"_id"),i[n]="integer",t.attributes(i),o={},o[n]=this,t.foreignKeys(o),this.instanceClass.prototype[e]=function(r){var i,o,s,a,l;if(1===arguments.length){for(l=t.findByAttribute(n,this.id),s=0,a=l.length;a>s;s++)i=l[s],i!==r&&(i.set(n,null),i.save());if(null===r)return;return r.set(n,this.id),r.save(),this.trigger("change:"+e),this.trigger("change")}return o=t.findByAttribute(n,this.id),o.length>0?o[0]:null},r=this,s=function(e){var r,i,o,s,a;for(s=t.findByAttribute(n,e.id),a=[],i=0,o=s.length;o>i;i++)r=s[i],r.set(n,null),a.push(r.save());return a},this.bind("destroy",s)},n.prototype.belongsToPoly=function(t,e,r,i){var o,s,a,l,h,u,c,p,f;for(null==e&&(e=this.toSnakeCase(l.modelName)),s={},null==r&&(r=e+"_id"),s[r]="integer",null==i&&(i=e+"_type"),s[i]="string",this[e+"_allowed_models"]=t,this.attributes(s),a={},a[r]=i,this.polyForeignKeys(a),h={},h[e]=function(e,o){var s,a;return arguments.length>0?(null!=e?(_.contains(t,e.modelClass)||d.error("Cannot assign a model of type {{value.modelClass.modelName}} to this belongsToPoly - allowed model types are "+t.join(", ")),this.set(r,e.id),this.set(i,e.modelClass.modelName)):(this[r]=null,this[i]=null),this.save(o)):(s=this[r],a=n.models[this[i]],null==s||null==a?null:a.findById(s))},this.instanceClass.extend(h),o=this,u=function(t,e){var n,s,a,l,h,u;for(null==e&&(e={}),s={},s[r]=t.id,s[i]=t.modelClass.modelName,h=o.findByAttributes(s),u=[],a=0,l=h.length;l>a;a++)n=h[a],n.set(r,null),n.set(i,null),u.push(n.save(e));return u},f=[],c=0,p=t.length;p>c;c++)l=t[c],f.push(l.bind("destroy",u));return f},n.prototype.hasMany=function(t,e,n){var r,i,o,s,a;return null==e&&(e=this.toSnakeCase(t.modelName)),i={},null==n&&(n=this.toSnakeCase(this.modelName+"_id")),i[n]="integer",t.attributes(i),o={},o[n]=this,t.foreignKeys(o),this.relations[e]={type:"hasMany",otherModel:t,foreignKeyAttribute:n},r=this,s={},s[e]=function(){if(arguments.length>0)throw Error("Cannot set a hasMany relation");return null==this[e+"_hasMany_collection"]&&(this[e+"_hasMany_collection"]=u.create({record:this,attribute:this.attribute,model:r,otherModel:t,fkname:n})),this[e+"_hasMany_collection"]},this.instanceClass.extend(s),a=function(e,r){var i,o,s,a,l;for(null==r&&(r={}),a=t.findByAttribute(n,e.id),l=[],o=0,s=a.length;s>o;o++)i=a[o],i.set(n,null),l.push(i.save(r));return l},this.bind("destroy",a)},n.prototype.hasManyPoly=function(t,e,n,r){var i,o,s,a;return null==e&&(e=this.toSnakeCase(t.modelName)),null==n&&(n=e+"_id"),null==r&&(r=e+"_type"),o={},o[n]="integer",o[r]="string",t.attributes(o),s={},s[n]=r,t.polyForeignKeys(s),this.relations[e]={type:"hasManyPoly",otherModel:t,foreignKeyAttribute:n,foreignModelTypeAttribute:r},i=this,this.instanceClass.prototype[e]=function(){if(arguments.length>0)throw Error("Cannot set a hasManyPoly relation");return null==this[e+"_hasManyPoly_collection"]&&(this[e+"_hasManyPoly_collection"]=c.create({record:this,model:i,otherModel:t,thatFkAttr:n,thatTypeAttr:r})),this[e+"_hasManyPoly_collection"]},a=function(e,o){var s,a,l,h,u,c;for(null==o&&(o={}),a={},a[n]=e.id,a[r]=i.modelName,u=t.findByAttributes(a),c=[],l=0,h=u.length;h>l;l++)s=u[l],s.set(n,null),s.set(r,null),c.push(s.save(o));return c},this.bind("destroy",a)},n.prototype.hasManyThrough=function(t,e,n,r,i){var s,a,l,h,u;return null==e&&(e=this.toSnakeCase(t.modelName)),a={},null==r&&(r=this.toSnakeCase(this.modelName+"_id")),null==i&&(i=this.toSnakeCase(t.modelName)+"_id"),a[r]="integer",a[i]="integer",n.attributes(a),l={},l[r]=this,l[i]=t,n.foreignKeys(l),this.relations[e]={type:"hasManyThrough",otherModel:t,linkModel:n,foreignKeyAttribute:r,otherModelForeignKeyAttribute:i},s=this,this.instanceClass.prototype[e]=function(){if(arguments.length>0)throw Error("Cannot set a hasManyThrough relation");return null==this[e+"_hasManyThrough_collection"]&&(this[e+"_hasManyThrough_collection"]=o.create({record:this,model:s,otherModel:t,linkModel:n,thisFkAttr:r,thatFkAttr:i})),this[e+"_hasManyThrough_collection"]},u=function(t,e){var i,o,s,a,l;for(null==e&&(e={}),a=n.findByAttribute(r,t.id),l=[],o=0,s=a.length;s>o;o++)i=a[o],l.push(i.destroy(e));return l},this.bind("destroy",u),h=function(t,e){var r,o,s,a,l;for(null==e&&(e={}),a=n.findByAttribute(i,t.id),l=[],o=0,s=a.length;s>o;o++)r=a[o],l.push(r.destroy(e));return l},t.bind("destroy",h)},n.prototype.hasManyThroughPoly=function(t,e,n,r,i,o){var a,l,h,u,c;return null==e&&(e=this.toSnakeCase(t.modelName)),null==r&&(r=this.toSnakeCase(this.modelName+"_id")),null==i&&(i=e+"_id"),null==o&&(o=e+"_type"),l={},l[r]="integer",l[i]="integer",l[o]="string",n.attributes(l),h={},h[r]=this,n.foreignKeys(h),h={},h[i]=o,n.polyForeignKeys(h),this.relations[e]={type:"hasManyThroughPoly",otherModel:t,linkModel:n,foreignKeyAttribute:r,otherModelForeignKeyAttribute:i,otherModelModelTypeAttribute:o},a=this,this.instanceClass.prototype[e]=function(){if(arguments.length>0)throw Error("Cannot set a hasManyThroughPoly relation");return null==this[e+"_hasManyThroughPoly_collection"]&&(this[e+"_hasManyThroughPoly_collection"]=s.create({record:this,model:a,otherModel:t,linkModel:n,thisFkAttr:r,thatFkAttr:i,thatTypeAttr:o})),this[e+"_hasManyThroughPoly_collection"]},c=function(t,e){var i,o,s,a,l,h;for(null==e&&(e={}),o={},o[r]=t.id,l=n.findByAttributes(o),h=[],s=0,a=l.length;a>s;s++)i=l[s],h.push(i.destroy(e));return h},this.bind("destroy",c),u=function(t,e){var r,s,a,l,h,u;for(null==e&&(e={}),s={},s[i]=t.id,s[o]=t.modelClass.modelName,h=n.findByAttributes(s),u=[],a=0,l=h.length;l>a;a++)r=h[a],u.push(r.destroy(e));return u},t.bind("destroy",u)},n.prototype.hasManyThroughPolyReverse=function(t,e,n,r,i,o){var s;return null==e&&(e=this.toSnakeCase(t.modelName)),null==r&&(r=this.toSnakeCase(this.modelName+"_id")),null==i&&(i=e+"_id"),null==o&&(o=e+"_type"),this.relations[e]={type:"hasManyThroughPolyReverse",otherModel:t,linkModel:n,foreignKeyAttribute:r,otherModelForeignKeyAttribute:i,otherModelModelTypeAttribute:o},(null==n.fks[r]||null==n.polyFks[i]||n.polyFks[i]===(null!=o))&&console.error("WARNING: hasManyThroughPolyReverse - "+r+", "+i+" or "+o+" do not exist on link model '"+n.modelName+"' - there should be an existing hasManyThroughPoly to support this hasManyThroughPolyReverse"),s=this,this.instanceClass.prototype[e]=function(){if(arguments.length>0)throw Error("Cannot set a hasManyThroughPolyReverse relation");return null==this[e+"_hasManyThroughPolyReverse_collection"]&&(this[e+"_hasManyThroughPolyReverse_collection"]=a.create({record:this,model:s,otherModel:t,linkModel:n,thisFkAttr:r,thatFkAttr:i,thatTypeAttr:o})),this[e+"_hasManyThroughPolyReverse_collection"]}},n.prototype.all=function(){return _(this.records).values()},n.prototype.allAsMap=function(){return this.records},n.prototype.count=function(){return _(this.records).keys().length},n.prototype.findById=function(t){return null==t?void 0:this.records[t]},n.prototype.findAll=function(t){var e,n,r,i;for(n=[],r=0,i=t.length;i>r;r++)e=t[r],null!=this.exists(e)&&n.push(this.records[e]);return n},n.prototype.select=function(t){return this.findAll(this.selectIds(t))},n.prototype.selectIds=function(t){var e,n,r,i;r=[],i=this.records;for(e in i)n=i[e],t(n)&&r.push(e);return r},n.prototype.selectAsMap=function(t){var e,n,r,i;r={},i=this.records;for(e in i)n=i[e],t(n)&&(r[e]=n);return r},n.prototype.findByAttribute=function(t,e){var n;return n={},n[t]=e,this.findByAttributes(n)},n.prototype.findByAttributes=function(t){var e,n,r,i,o,s,a,l;s=[];for(e in t)l=t[e],this.hasIndex(e)?s.push(this.getIndexFor(e,l)):s.push(this.selectAsMap(function(t){return t[e]===l}));for(i=s.pop()||{};s.length>0;){a=s.pop(),o={};for(n in a)r=a[n],null!=i[n]&&(o[n]=r);i=o}return _(i).values()},n.prototype.exists=function(t){return null!=this.records[t]},n.prototype.initInstance=function(t){var e,n,r,i;e=this._getInstance(),i=this.attrs;for(n in i)r=i[n],null!=t&&null!=t[n]?e.set(n,t[n]):e.set(n,null);return e.set("id",this._generateId()),e},n.prototype.createFromValues=function(t){var e;return e=this.initInstance(t),e.save(),e},n.prototype.loadInstance=function(t,e){return null==e&&(e={}),this.trigger("load",t)},n.prototype.createInstance=function(t,e){var n;return null==e&&(e={}),n=t.id,this.exists(n)&&d.error("createInstance: ID Already Exists","collection","model",this.name,"id",n),this.records[n]=t,this.addToIndexes(t),e.disableModelCreateEvent||this.trigger("create",t,e),e.disableModelChangeEvent||this.trigger("change",t,e),t},n.prototype.updateInstance=function(t,e){var n;return null==e&&(e={}),e.disableModelUpdateEvent||this.trigger("update",t,e),e.disableModelChangeEvent||this.trigger("change",t,e),n=t.id,this.exists(n)?void 0:d.error("updateInstance: ID does not exist","collection","model",this.name,"id",n)},n.prototype.destroyInstance=function(t,e){var n;return null==e&&(e={}),n=t.id,this.exists(n)||d.error("destroyInstance: ID does not exist","collection","model",this.name,"id",n),delete this.records[t.id],t.modelClass.removeFromIndexes(t),e.disableModelDestroyEvent||this.trigger("destroy",t,e),e.disableModelChangeEvent?void 0:this.trigger("change",t,e)},n.prototype.toSnakeCase=function(t){var e;return e=t.replace(/[A-Z]{1,1}/g,function(t){return"_"+t.toLowerCase()}),e.replace(/^_/,"")},n.prototype._getInstance=function(){return this.instanceClass.create({modelClass:this})},n.prototype._generateId=function(){return"c-"+n.idCount++},n.prototype.index=function(t,n,r){var i;if(null==n&&(n="map"),null==this.indexes[t]){if(i=e.getIndexClassType(n),null!=i)return this.indexes[t]=i.create({modelClass:this,attribute:t,options:r});throw Error("Model: Index Type "+n+" is not supported")}return this.rebuildIndex(t)},n.prototype.hasIndex=function(t){return null!=this.indexes[t]},n.prototype.getIndexFor=function(t,e){if(null==this.indexes[t])throw Error("Model.rebuildIndex: Index "+t+" does not exist");return this.indexes[t].load(e)},n.prototype.updateIndex=function(t,e,n,r){if(null==this.indexes[t])throw Error("Model.rebuildIndex: Index "+t+" does not exist");return this.indexes[t].update(e,n,r)},n.prototype.addToIndexes=function(t){var e,n,r,i;r=this.indexes,i=[];for(e in r)n=r[e],i.push(n.add(t));return i},n.prototype.removeFromIndexes=function(t){var e,n,r,i;r=this.indexes,i=[];for(e in r)n=r[e],i.push(n.remove(t));return i},n.prototype.rebuildIndex=function(t){if(null==this.indexes[t])throw Error("Model.rebuildIndex: Index "+t+" does not exist");return this.indexes[t].rebuild()},n.prototype.dropIndex=function(t){return delete this.indexes[t]},n.prototype.rebuildAllIndexes=function(){var t,e,n,r,i;for(r=_(this.indexes).keys(),i=[],e=0,n=r.length;n>e;e++)t=r[e],i.push(this.rebuildIndex(t));return i},n}(h)}).call(this)}),t.define("/model-localstorage.coffee",function(t){(function(){var e,n,r,i;e=t("./model").Model,n=t("./util"),i={},r={},e.extend({localStorage:function(t){var e,n,o,s,a,l,h,u,c;return null==window.localStorage&&Mozart.error(this.modelName+".localStorage - localStorage not available in this browser"),null==t&&(t={}),null==(l=t.prefix)&&(t.prefix="MozartLS"),this.localStorageOptions=t,this.bind("load",this.loadLocalStorage),this.bind("create",this.createLocalStorage),this.bind("update",this.updateLocalStorage),this.bind("destroy",this.destroyLocalStorage),null==(h=i[s=this.modelName])&&(i[s]={}),null==(u=r[a=this.modelName])&&(r[a]={}),null==(c=Mozart.LocalStorage)&&(Mozart.LocalStorage=Mozart.MztObject.create({handleError:function(t,e,n){return Mozart.LocalStorage.trigger("notFound",t,e,n)}})),o=this.getLocalStoragePrefix(),this.instanceClass.extend({getLocalStorageId:function(){return this.modelClass.getLocalStorageId(this.id)},existsInLocalStorage:function(){var t;return t=this.modelClass.getLocalStorageId(this.id),null!=window.localStorage[this+("-"+t)]},loadLocalStorage:function(){return this.modelClass.loadLocalStorage(this)}}),n=window.localStorage[o+"-nextPK"],null==n&&(window.localStorage[o+"-nextPK"]="1"),e=window.localStorage[o+"-index"],null==e?window.localStorage[o+"-index"]="[]":void 0},getLocalStoragePrefix:function(){return this.localStorageOptions.prefix+"-"+this.modelName},registerLocalStorageId:function(t,e){if(null==i[this.modelName])throw Error("Model.registerLocalStorageId: "+this.modelName+" is not registered for localStorage.");return i[this.modelName][e]=t,r[this.modelName][t]=e},unRegisterLocalStorageId:function(t,e){return delete i[this.modelName][e],delete r[this.modelName][t]},getLocalStorageId:function(t){return r[this.modelName][t]},getLocalStorageClientId:function(t){return i[this.modelName][t]},toLocalStorageObject:function(t){var n,r,i,o,s,a,l,h;i={},a=this.attrs;for(n in a)o=a[n],"id"!==n&&(i[n]=t[n]);i.id=this.getLocalStorageId(t.id),l=this.fks;for(n in l)r=l[n],i[n]=r.getLocalStorageId(t[n]);h=this.polyFks;for(n in h)s=h[n],i[n]=null!=t[s]?e.models[t[s]].getLocalStorageId(t[n]):null;return i},toLocalStorageClientObject:function(t){var n,r,i,o,s,a,l,h;i={},a=this.attrs;for(n in a)o=a[n],"id"!==n&&(i[n]=t[n]);i.id=this.getLocalStorageClientId(t.id),l=this.fks;for(n in l)r=l[n],i[n]=r.getLocalStorageClientId(t[n]),i[n]===void 0&&(i[n]=null);h=this.polyFks;for(n in h)s=h[n],i[n]=null!=t[s]?e.models[t[s]].getLocalStorageClientId(t[n]):null;return i},loadAllLocalStorage:function(){var t,e,r,i,o,s;for(i=this.getLocalStoragePrefix(),e=JSON.parse(window.localStorage[i+"-index"]),o=0,s=e.length;s>o;o++)r=e[o],t=JSON.parse(window.localStorage[i+("-"+r)]),this._processLocalStorageLoad(r,t,this);return this.trigger("loadAllLocalStorageComplete"),n.log("localStorage","Model.loadAllLocalStorage.onComplete")},loadLocalStorage:function(t){var e;return e=t.modelClass.getLocalStorageId(t.id),this.loadLocalStorageId(e)},loadLocalStorageId:function(t){var e,n;return n=this.getLocalStoragePrefix(),e=window.localStorage[n+("-"+t)],null==e&&Mozart.LocalStorage.handleError(this,t,"record does not exist"),e=JSON.parse(e),e.id=t,this._processLocalStorageLoad(t,e,this)},_processLocalStorageLoad:function(t,e,r){var i,o,s;return i=r.getLocalStorageClientId(t),o=r.toLocalStorageClientObject(e),null!=i?(s=r.findById(i),s.copyFrom(o)):s=r.initInstance(e),s.save({disableModelCreateEvent:!0,disableModelUpdateEvent:!0}),r.registerLocalStorageId(s.id,t),n.log("localStorage","Model._processLocalStorageLoad.onSuccess",e,r),r.trigger("loadLocalStorageComplete",s)},createLocalStorage:function(t){var e,r,i,o;return e=t.modelClass.toLocalStorageObject(t),o=t.modelClass.getLocalStoragePrefix(),i=parseInt(window.localStorage[o+"-nextPK"]),window.localStorage[o+"-nextPK"]=""+(i+1),window.localStorage[o+("-"+i)]=JSON.stringify(e),t.modelClass.registerLocalStorageId(t.id,i),r=JSON.parse(window.localStorage[o+"-index"]),r.push(i),window.localStorage[o+"-index"]=JSON.stringify(r),n.log("localStorage","Model.createLocalStorageComplete",t),t.modelClass.trigger("createLocalStorageComplete",t)},updateLocalStorage:function(t){var e,r,i;return r=t.modelClass.getLocalStorageId(t.id),null!=r?(e=t.modelClass.toLocalStorageObject(t),i=t.modelClass.getLocalStoragePrefix(),null==window.localStorage[i+("-"+r)]&&Mozart.LocalStorage.handleError(t.modelClass,r,"updateLocalStorage: record does not exist"),window.localStorage[i+("-"+r)]=JSON.stringify(e),t.modelClass.trigger("updateLocalStorageComplete",t),n.log("localStorage","Model.updateLocalStorage.onComplete",t)):void 0},destroyLocalStorage:function(t){var e,r,i;return r=t.modelClass.getLocalStorageId(t.id),null!=r?(i=t.modelClass.getLocalStoragePrefix(),null==window.localStorage[i+("-"+r)]&&Mozart.LocalStorage.handleError(t.modelClass,r,"destroyLocalStorage: record does not exist"),window.localStorage.removeItem(i+("-"+r)),t.modelClass.unRegisterLocalStorageId(t.id,r),e=JSON.parse(window.localStorage[i+"-index"]),e=_.without(e,r),window.localStorage[i+"-index"]=JSON.stringify(e),n.log("localStorage","Model.destroyLocalStorage.onSuccess",t),t.modelClass.trigger("destroyLocalStorageComplete",r)):void 0},destroyAllLocalStorage:function(){var t,e,n,o,s;for(n=this.getLocalStoragePrefix(),e=JSON.parse(window.localStorage[n+"-index"]),o=0,s=e.length;s>o;o++)t=e[o],window.localStorage.removeItem(n+("-"+t));return window.localStorage[n+"-index"]="[]",window.localStorage[n+"-nextPK"]="1",i[this.modelName]={},r[this.modelName]={}}})}).call(this)}),t.define("/route.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"),e=t("./object").MztObject,n.Route=r=function(t){function e(){return this.doTitle=o(this.doTitle,this),this.canEnter=o(this.canEnter,this),this.canExit=o(this.canExit,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.init=function(){return null!=this.path&&this.path.length>0||i.warn("Route must have a path",this),null==this.viewClass?i.warn("Route must have a viewClass",this):void 0},e.prototype.canExit=function(){return!(null!=this.exit)||this.exit()===!0},e.prototype.canEnter=function(t){return!(null!=this.enter)||this.enter(t)===!0},e.prototype.doTitle=function(){return null!=this.title?document.title="function"==typeof this.title?this.title(this):this.title:void 0},e}(e)}).call(this)}),t.define("/switch-view.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.SwitchView=e=function(t){function e(){return this.beforeRender=i(this.beforeRender,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.beforeRender=function(){var t;return t=HandlebarsTemplates[this.templateBase+"/"+this.content[this.templateField]],null!=t?this.templateFunction=t:(Util.log("views","SwitchView: No view found for "+this.templateBase+"/"+this.content[this.templateField]),this.templateFunction=function(){return""})},e}(r)}).call(this)}),t.define("/dynamic-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};i=t("./view").View,r=t("./util"),n.DynamicView=e=function(t){function e(){return this.createText=o(this.createText,this),this.createView=o(this.createView,this),this.afterRender=o(this.afterRender,this),this.init=o(this.init,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.skipTemplate=!0,e.prototype.init=function(){return e.__super__.init.apply(this,arguments),r.log("dynamicview","init"),null!=this.schema?this.bind("change:schema",this.afterRender):void 0},e.prototype.afterRender=function(){var t,e,n,i,o;if(this.releaseChildren(),this.element.empty(),!r.isArray(this.schema))return r.warn("DynamicView "+id+": schema is not an array"),void 0;for(i=this.schema,o=[],e=0,n=i.length;n>e;e++)t=i[e],null!=t.viewClass?o.push(this.createView(t)):o.push(this.createText(t));return o},e.prototype.createView=function(t){var e,n;return n=r._getPath(t.viewClass),delete t.viewClass,t.parent=this,e=this.layout.createView(n,t),this.element.append(e.createElement()),this.addView(e),this.layout.queueRenderView(e)},e.prototype.createText=function(t){return this.element.append(t)},e}(i)}).call(this)}),t.define("/cookies.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.Cookies=e=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.setCookie=function(t,e,n){var r,i,o,s,a,l;return n=n||{},void 0!==document.cookie&&(n.path||(n.path="/"),s=""+encodeURIComponent(t)+"="+encodeURIComponent(e),a=n.path?";path="+n.path:"",r=n.domain?";domain="+n.domain:"",o=n["max-age"]?";max-age="+n["max-age"]:"",i="",n.expires instanceof Date&&(i=";expires="+n.expires.toUTCString()),l=n.secure?";secure":"",document.cookie=s+a+r+o+i+l),this},e.getCookie=function(t){var e,n,r,i,o,s;for(n=document.cookie.split(/;\s*/),o=0,s=n.length;s>o;o++)if(e=n[o],i=e.split("="),r=decodeURIComponent(i[0]),r===t)return decodeURIComponent(i[1]);return null},e.removeCookie=function(t){var e;return e=new Date,e.setTime(e.getTime()-1),this.setCookie(t,"",{expires:e}),this},e.hasCookie=function(t){return null!==this.getCookie(t)},e}(r)}).call(this)}),t.define("/mozart.coffee",function(t,e,n,r,i,o,s){(function(){var e,n,r,i,o,a,l,h,u={}.hasOwnProperty;for(e={version:"0.1.8",versionDate:new Date(2013,6,1),Plugins:{}},l=[t("./collection"),t("./control"),t("./controller"),t("./data-index"),t("./dom-manager"),t("./events"),t("./handlebars"),t("./http"),t("./layout"),t("./model-instance"),t("./model-instancecollection"),t("./model-onetomanycollection"),t("./model-onetomanypolycollection"),t("./model-manytomanycollection"),t("./model-manytomanypolycollection"),t("./model-manytomanypolyreversecollection"),t("./model-ajax"),t("./model-localstorage"),t("./model"),t("./object"),t("./route"),t("./router"),t("./switch-view"),t("./util"),t("./view"),t("./dynamic-view"),t("./cookies")],o=0,a=l.length;a>o;o++){r=l[o];for(i in r)u.call(r,i)&&(n=r[i],e[i]=n)}null!=s.module?r.exports=e:null!=(null!=(h=s.define)?h.amd:void 0)?define("mozart",e):s.Mozart=e}).call(this)}),t("/mozart.coffee")})();
\ No newline at end of file
// Underscore.js 1.4.2
// http://underscorejs.org
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore may be freely distributed under the MIT license.
(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=r.unshift,l=i.toString,c=i.hasOwnProperty,h=r.forEach,p=r.map,d=r.reduce,v=r.reduceRight,m=r.filter,g=r.every,y=r.some,b=r.indexOf,w=r.lastIndexOf,E=Array.isArray,S=Object.keys,x=s.bind,T=function(e){if(e instanceof T)return e;if(!(this instanceof T))return new T(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=T),exports._=T):e._=T,T.VERSION="1.4.2";var N=T.each=T.forEach=function(e,t,r){if(e==null)return;if(h&&e.forEach===h)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(T.has(e,o)&&t.call(r,e[o],o,e)===n)return};T.map=T.collect=function(e,t,n){var r=[];return e==null?r:p&&e.map===p?e.map(t,n):(N(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},T.reduce=T.foldl=T.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduce===d)return r&&(t=T.bind(t,r)),i?e.reduce(t,n):e.reduce(t);N(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.reduceRight=T.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(v&&e.reduceRight===v)return r&&(t=T.bind(t,r)),arguments.length>2?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=T.keys(e);s=o.length}N(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.find=T.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},T.filter=T.select=function(e,t,n){var r=[];return e==null?r:m&&e.filter===m?e.filter(t,n):(N(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},T.reject=function(e,t,n){var r=[];return e==null?r:(N(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},T.every=T.all=function(e,t,r){t||(t=T.identity);var i=!0;return e==null?i:g&&e.every===g?e.every(t,r):(N(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=T.some=T.any=function(e,t,r){t||(t=T.identity);var i=!1;return e==null?i:y&&e.some===y?e.some(t,r):(N(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};T.contains=T.include=function(e,t){var n=!1;return e==null?n:b&&e.indexOf===b?e.indexOf(t)!=-1:(n=C(e,function(e){return e===t}),n)},T.invoke=function(e,t){var n=u.call(arguments,2);return T.map(e,function(e){return(T.isFunction(t)?t:e[t]).apply(e,n)})},T.pluck=function(e,t){return T.map(e,function(e){return e[t]})},T.where=function(e,t){return T.isEmpty(t)?[]:T.filter(e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},T.max=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&T.isEmpty(e))return-Infinity;var r={computed:-Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},T.min=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&T.isEmpty(e))return Infinity;var r={computed:Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},T.shuffle=function(e){var t,n=0,r=[];return N(e,function(e){t=T.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return T.isFunction(e)?e:function(t){return t[e]}};T.sortBy=function(e,t,n){var r=k(t);return T.pluck(T.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t);return N(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};T.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(T.has(e,t)?e[t]:e[t]=[]).push(n)})},T.countBy=function(e,t,n){return L(e,t,n,function(e,t,n){T.has(e,t)||(e[t]=0),e[t]++})},T.sortedIndex=function(e,t,n,r){n=n==null?T.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},T.toArray=function(e){return e?e.length===+e.length?u.call(e):T.values(e):[]},T.size=function(e){return e.length===+e.length?e.length:T.keys(e).length},T.first=T.head=T.take=function(e,t,n){return t!=null&&!n?u.call(e,0,t):e[0]},T.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},T.last=function(e,t,n){return t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},T.rest=T.tail=T.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},T.compact=function(e){return T.filter(e,function(e){return!!e})};var A=function(e,t,n){return N(e,function(e){T.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};T.flatten=function(e,t){return A(e,t,[])},T.without=function(e){return T.difference(e,u.call(arguments,1))},T.uniq=T.unique=function(e,t,n,r){var i=n?T.map(e,n,r):e,s=[],o=[];return N(i,function(n,r){if(t?!r||o[o.length-1]!==n:!T.contains(o,n))o.push(n),s.push(e[r])}),s},T.union=function(){return T.uniq(a.apply(r,arguments))},T.intersection=function(e){var t=u.call(arguments,1);return T.filter(T.uniq(e),function(e){return T.every(t,function(t){return T.indexOf(t,e)>=0})})},T.difference=function(e){var t=a.apply(r,u.call(arguments,1));return T.filter(e,function(e){return!T.contains(t,e)})},T.zip=function(){var e=u.call(arguments),t=T.max(T.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=T.pluck(e,""+r);return n},T.object=function(e,t){var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},T.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=T.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(b&&e.indexOf===b)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},T.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(w&&e.lastIndexOf===w)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},T.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};T.bind=function(t,n){var r,i;if(t.bind===x&&x)return x.apply(t,u.call(arguments,1));if(!T.isFunction(t))throw new TypeError;return i=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=t.prototype;var e=new O,s=t.apply(e,i.concat(u.call(arguments)));return Object(s)===s?s:e}return t.apply(n,i.concat(u.call(arguments)))}},T.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=T.functions(e)),N(t,function(t){e[t]=T.bind(e[t],e)}),e},T.memoize=function(e,t){var n={};return t||(t=T.identity),function(){var r=t.apply(this,arguments);return T.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},T.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},T.defer=function(e){return T.delay.apply(T,[e,1].concat(u.call(arguments,1)))},T.throttle=function(e,t){var n,r,i,s,o,u,a=T.debounce(function(){o=s=!1},t);return function(){n=this,r=arguments;var f=function(){i=null,o&&(u=e.apply(n,r)),a()};return i||(i=setTimeout(f,t)),s?o=!0:(s=!0,u=e.apply(n,r)),a(),u}},T.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},T.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},T.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},T.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},T.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},T.keys=S||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)T.has(e,n)&&(t[t.length]=n);return t},T.values=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push(e[n]);return t},T.pairs=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push([n,e[n]]);return t},T.invert=function(e){var t={};for(var n in e)T.has(e,n)&&(t[e[n]]=n);return t},T.functions=T.methods=function(e){var t=[];for(var n in e)T.isFunction(e[n])&&t.push(n);return t.sort()},T.extend=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e},T.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return N(n,function(n){n in e&&(t[n]=e[n])}),t},T.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)T.contains(n,i)||(t[i]=e[i]);return t},T.defaults=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},T.clone=function(e){return T.isObject(e)?T.isArray(e)?e.slice():T.extend({},e):e},T.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof T&&(e=e._wrapped),t instanceof T&&(t=t._wrapped);var i=l.call(e);if(i!=l.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,f=t.constructor;if(a!==f&&!(T.isFunction(a)&&a instanceof a&&T.isFunction(f)&&f instanceof f))return!1;for(var c in e)if(T.has(e,c)){o++;if(!(u=T.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(T.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};T.isEqual=function(e,t){return M(e,t,[],[])},T.isEmpty=function(e){if(e==null)return!0;if(T.isArray(e)||T.isString(e))return e.length===0;for(var t in e)if(T.has(e,t))return!1;return!0},T.isElement=function(e){return!!e&&e.nodeType===1},T.isArray=E||function(e){return l.call(e)=="[object Array]"},T.isObject=function(e){return e===Object(e)},N(["Arguments","Function","String","Number","Date","RegExp"],function(e){T["is"+e]=function(t){return l.call(t)=="[object "+e+"]"}}),T.isArguments(arguments)||(T.isArguments=function(e){return!!e&&!!T.has(e,"callee")}),typeof /./!="function"&&(T.isFunction=function(e){return typeof e=="function"}),T.isFinite=function(e){return T.isNumber(e)&&isFinite(e)},T.isNaN=function(e){return T.isNumber(e)&&e!=+e},T.isBoolean=function(e){return e===!0||e===!1||l.call(e)=="[object Boolean]"},T.isNull=function(e){return e===null},T.isUndefined=function(e){return e===void 0},T.has=function(e,t){return c.call(e,t)},T.noConflict=function(){return e._=t,this},T.identity=function(e){return e},T.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)},T.random=function(e,t){return t==null&&(t=e,e=0),e+(0|Math.random()*(t-e+1))};var _={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};_.unescape=T.invert(_.escape);var D={escape:new RegExp("["+T.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+T.keys(_.unescape).join("|")+")","g")};T.each(["escape","unescape"],function(e){T[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),T.result=function(e,t){if(e==null)return null;var n=e[t];return T.isFunction(n)?n.call(e):n},T.mixin=function(e){N(T.functions(e),function(t){var n=T[t]=e[t];T.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(T,e))}})};var P=0;T.uniqueId=function(e){var t=P++;return e?e+t:t},T.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;T.template=function(e,t,n){n=T.defaults({},n,T.templateSettings);var r=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){s+=e.slice(i,u).replace(j,function(e){return"\\"+B[e]}),s+=n?"'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?"'+\n((__t=("+r+"))==null?'':__t)+\n'":o?"';\n"+o+"\n__p+='":"",i=u+t.length}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(n.variable||"obj","_",s)}catch(u){throw u.source=s,u}if(t)return o(t,T);var a=function(e){return o.call(this,e,T)};return a.source="function("+(n.variable||"obj")+"){\n"+s+"}",a},T.chain=function(e){return T(e).chain()};var F=function(e){return this._chain?T(e).chain():e};T.mixin(T),N(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];T.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),N(["concat","join","slice"],function(e){var t=r[e];T.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),T.extend(T.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
\ No newline at end of file
# TodoMVC Mozart
A TodoMVC example in the [Mozart](http://mozart.io/) Framework.
Full details, downloads and documentation for Mozart can be found on [The official website](http://mozart.io/)
Please see [The official TodoMVC website](http://todomvc.com/) for more details on the TodoMVC project.
### Implementation
TodoMVC Mozart is implemented as a single controller and a set of views. A single model stores the todo items, persisted to LocalStorage by the built-in Mozart LocalStorage module.
app/controllers/
### Dependencies
- [Node.js](http://nodejs.org/)
```
npm install
```
### Run development server
```
grunt run
```
The development server runs at [http://localhost:8080/](http://localhost:8080/)
### Testing
The application can be tested from the command line:
```
grunt test
```
The spec runner is also available at [http://localhost:8080/specs/](http://localhost:8080/specs/)
### Notes
The Mozart TodoMVC app demonstrates:
- Views, Controllers, Models
- Custom Controls
- Binding
- Hash Routing
- LocalStorage persistence
Departures from specification:
- The Mozart LocalStorage places each entity record in a seperate key for speed of access, this is a departure from the TodoMVC application spec which states a single key with a large data blob.
- As this is a compiled example, a 'Full Source' link has been provided to the [standalone todomvc-mozart Github project](https://github.com/tomcully/todomvc-mozart).
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment