Commit c2abe8ee authored by runawaygo's avatar runawaygo

Merge branch 'master' of git://github.com/addyosmani/todomvc

parents 3dd6ba51 2aef4b5d
/*this doesn't seem to be used in the jquery example at all. Its getting in the way */
#todo-count span {
font-weight: inherit;
}
\ No newline at end of file
html,
body {
margin: 0;
padding: 0;
}
body {
font: 14px "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 1.4em;
background: #eeeeee;
color: #333333;
width: 520px;
margin: 0 auto;
-webkit-font-smoothing: antialiased;
}
#todoapp {
background: #fff;
padding: 20px;
margin-bottom: 40px;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
-ms-box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-ms-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
#todoapp h1 {
font-size: 36px;
font-weight: bold;
text-align: center;
padding: 0 0 10px 0;
}
#todoapp input[type="text"] {
width: 466px;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
padding: 6px;
border: 1px solid #999999;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-ms-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
}
#todoapp input::-webkit-input-placeholder {
font-style: italic;
}
#todo-list {
margin: 10px 0;
padding: 0;
list-style: none;
}
#todo-list li {
padding: 18px 20px 18px 0;
position: relative;
font-size: 24px;
border-bottom: 1px solid #cccccc;
}
#todo-list li:last-child {
border-bottom: none;
}
#todo-list li.done label {
color: #777777;
text-decoration: line-through;
}
#todo-list li .destroy {
display: none;
position: absolute;
top: 20px;
right: 10px;
cursor: pointer;
width: 20px;
height: 20px;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAABGdBTUEAALGPC/xhBQAAACdQTFRFzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMAAAA////zMzMhnu0WAAAAAt0Uk5T5u3pqtV3jFQEKAC0bVelAAAAfUlEQVQI12NYtWpFsc8R865VqxhWrZpyBgg8QcylZ8AgCsjMgTCPrWJYfgYKqhjWwJgaDDVnzpw+c2bPmTPHGWzOnNm95/TuM2cOM/AARXfvBooeZAAp270bRCIz4QoOIGtDMqwJZoUEQzvCYrhzuhhWtUKYEahOX7UK6iEA3A6NUGwCTZIAAAAASUVORK5CYII=') no-repeat center center;
}
#todo-list li:hover .destroy {
display: block;
}
#todo-list li.editing {
border-bottom: none;
margin-top: -1px;
padding: 0;
}
#todo-list li.editing:last-child {
margin-bottom: -1px;
}
#todo-list li.editing .edit {
display: block;
width: 444px;
padding: 13px 15px 14px 20px;
margin: 0;
}
#todo-list li.editing .view {
display: none;
}
#todo-list li .view label {
word-break: break-word;
}
#todo-list li .edit {
display: none;
}
#todoapp footer {
margin: 0 -20px -20px -20px;
overflow: hidden;
color: #555555;
background: #f4fce8;
border-top: 1px solid #ededed;
padding: 0 20px;
line-height: 37px;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-ms-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
#clear-completed {
float: right;
line-height: 20px;
text-decoration: none;
background: rgba(0, 0, 0, 0.1);
color: #555555;
font-size: 11px;
margin-top: 8px;
margin-bottom: 8px;
padding: 0 10px 1px;
cursor: pointer;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
-ms-border-radius: 12px;
-o-border-radius: 12px;
border-radius: 12px;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-ms-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
}
#clear-completed:hover {
background: rgba(0, 0, 0, 0.15);
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-ms-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
}
#clear-completed:active {
position: relative;
top: 1px;
}
#todo-count span {
font-weight: bold;
}
#instructions {
margin: 10px auto;
color: #777777;
text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0;
text-align: center;
}
#instructions a {
color: #336699;
}
#credits {
margin: 30px auto;
color: #999;
text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0;
text-align: center;
}
#credits a {
color: #888;
}
\ No newline at end of file
<!doctype html>
<html ng-app="todomvc">
<html lang="en" ng-app="todomvc">
<head>
<meta charset="utf-8">
<title>AngularJS - TodoMVC</title>
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/app.css">
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>AngularJS - TodoMVC</title>
<link rel="stylesheet" href="../../assets/base.css">
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
</head>
<body>
<div ng-controller="TodoController" id="todoapp">
<header>
<h1>Todos</h1>
<form id="todo-form" ng-submit="addTodo()">
<input type="text" id="new-todo" name="newTodo" ng-model="newTodo" placeholder="What needs to be done?">
</form>
</header>
<section id="main" ng-show="todos.length">
<input type="checkbox" id="toggle-all" ng-click="markAllDone()" ng-checked="remainingTodos().length == 0">
<label for="toggle-all">Mark all as complete</label>
<ul id="todo-list">
<li ng-repeat="todo in todos" ng-dblclick="editTodo(todo)" ng-class="{done: todo.done, editing: todo.editing}">
<div class="view">
<input type="checkbox" class="toggle" name="todo.done" ng-model="todo.done">
<label ng-bind="todo.title">Loading...</label>
<a class="destroy" ng-click="removeTodo(todo)"></a>
</div>
<form ng-submit="finishEditing(todo)">
<input type="text" class="edit" name="todo.title" ng-model="todo.title" my:blur="finishEditing(todo)">
</form>
</li>
</ul>
</section>
<footer ng-show="todos.length">
<a id="clear-completed" ng-click="clearDoneTodos()" ng-show="doneTodos().length" ng-bind-template="Clear {{doneTodos().length}} items"></a>
<div id="todo-count">
<ng-pluralize count="remainingTodos().length" when="todoForms"></ng-pluralize>
</div>
</footer>
</div>
<div id="instructions">
Double-click to edit a todo.
</div>
<div id="credits">
Credits: <a href="http://twitter.com/cburgdorf">Christoph Burgdorf</a>, <a href="http://ericbidelman.com">Eric Bidelman</a>
</div>
<script src="../../assets/base.js"></script>
<script src="js/libs/angular/angular.min.js"></script>
<script src="js/controllers.js"></script>
<section id="todoapp" ng-controller="TodoController">
<header id="header">
<h1>todos</h1>
<form id="todo-form" ng-submit="addTodo()">
<input id="new-todo" placeholder="What needs to be done?" type="text" name="newTodo" ng-model="newTodo">
</form>
</header>
<section id="main" ng-show="todos.length">
<input id="toggle-all" type="checkbox" ng-model="allChecked" ng-change="markAllDone()" ng-checked="remainingTodos().length == 0">
<label for="toggle-all">Mark all as complete</label>
<ul id="todo-list">
<li ng-repeat="todo in todos | filter:statusFilter" ng-dblclick="editTodo(todo)" ng-class="{completed: todo.completed, editing: todo.editing}">
<div class="view">
<input class="toggle" type="checkbox" name="todo.completed" ng-model="todo.completed">
<label ng-bind="todo.title">Loading...</label>
<button class="destroy" ng-click="removeTodo(todo)"></button>
</div>
<form ng-submit="finishEditing(todo)">
<input class="edit" type="text" name="todo.title" ng-model="todo.title" todo-blur="finishEditing(todo)" todo-focus="todo.editing">
</form>
</li>
</ul>
</section>
<footer id="footer" ng-show="todos.length">
<span id="todo-count"><strong>{{remainingTodos().length}}</strong> <ng-pluralize count="remainingTodos().length" when="todoForms"></ng-pluralize></span>
<ul id="filters">
<li>
<a ng-class="{selected: location.path() == '/'} " href="#/">All</a>
</li>
<li>
<a ng-class="{selected: location.path() == '/active'}" href="#/active">Active</a>
</li>
<li>
<a ng-class="{selected: location.path() == '/completed'}" href="#/completed">Completed</a>
</li>
</ul>
<button id="clear-completed" ng-click="clearDoneTodos()" ng-show="completedTodos().length" ng-bind-template="Clear completed ({{completedTodos().length}})"></button>
</footer>
</section>
<footer id="info">
<p>Double-click to edit a todo.</p>
<p>Credits: <a href="http://twitter.com/cburgdorf">Christoph Burgdorf</a>, <a href="http://ericbidelman.com">Eric Bidelman</a>, <a href="http://jacobmumm.com">Jacob Mumm</a></p>
</footer>
<script src="../../assets/base.js"></script>
<script src="js/libs/angular/angular.min.js"></script>
<script src="js/controllers/todo.js"></script>
<script src="js/directives/todo-directives.js"></script>
</body>
</html>
\ No newline at end of file
</html>
/* App Controllers */
var todomvc = angular.module('todomvc', []);
todomvc.controller('TodoController',['$scope',function ($scope) {
$scope.todos = retrieveStore();
// Call updateStore() whenever the todos array changes.
$scope.$watch('todos', updateStore, true);
$scope.todoForms = {
0: "You're done!",
one: '{} item left',
other: '{} items left'
};
function retrieveStore() {
var store = localStorage.getItem('todo-angularjs');
return (store && JSON.parse(store)) || [];
};
function updateStore() {
var isEditing = $scope.todos.filter(function(val) {
return val.editing;
}).length;
if (!isEditing) {
localStorage.setItem('todo-angularjs', JSON.stringify($scope.todos));
}
};
$scope.addTodo = function() {
if (this.newTodo.trim().length === 0) {
return;
}
$scope.todos.push({
title: this.newTodo,
done: false,
editing: false
});
this.newTodo = '';
};
$scope.editTodo = function(todo) {
//cancel any active editing operation
$scope.todos.forEach(function(val) {
val.editing = false;
});
todo.editing = true;
};
$scope.finishEditing = function(todo) {
if (todo.title.trim().length === 0) {
$scope.removeTodo(todo);
} else {
todo.editing = false;
}
};
$scope.removeTodo = function(todo) {
for (var i = 0, len = $scope.todos.length; i < len; ++i) {
if (todo === $scope.todos[i]) {
$scope.todos.splice(i, 1);
}
}
};
$scope.remainingTodos = function() {
return $scope.todos.filter(function(val) {
return !val.done;
});
};
$scope.doneTodos = function() {
return $scope.todos.filter(function(val) {
return val.done;
});
}
$scope.clearDoneTodos = function() {
$scope.todos = $scope.remainingTodos();
};
$scope.markAllDone = function() {
var markDone = true;
if (!$scope.remainingTodos().length) {
markDone = false;
}
$scope.todos.forEach(function(todo) {
todo.done = markDone;
});
};
}]);
/* App Controllers */
var todomvc = angular.module('todomvc', []);
function TodoController($scope, $location) {
$scope.todos = retrieveStore();
$scope.newTodo = "";
if($location.path()=='') $location.path('/');
$scope.location = $location;
// Call updateStore() whenever the todos array changes.
$scope.$watch('todos', updateStore, true);
$scope.$watch(function() {return $location.path(); }, function(path) {
$scope.statusFilter = path == '/active' ?
{ completed: false } : path == '/completed' ?
{ completed: true } : null;
});
$scope.todoForms = {
one: 'item left',
other: 'items left'
};
function retrieveStore() {
var store = localStorage.getItem('todos-angularjs');
return (store && JSON.parse(store)) || [];
};
function updateStore() {
var isEditing = $scope.todos.filter(function(val) {
return val.editing;
}).length;
if (!isEditing) {
localStorage.setItem('todos-angularjs', JSON.stringify($scope.todos));
}
};
$scope.addTodo = function() {
if (this.newTodo.trim().length === 0) {
return;
}
$scope.todos.push({
title: this.newTodo,
completed: false,
editing: false
});
this.newTodo = '';
};
$scope.editTodo = function(todo) {
//cancel any active editing operation
$scope.todos.forEach(function(val) {
val.editing = false;
});
todo.editing = true;
};
$scope.finishEditing = function(todo) {
if (todo.title.trim().length === 0) {
$scope.removeTodo(todo);
} else {
todo.editing = false;
}
};
$scope.removeTodo = function(todo) {
for (var i = 0, len = $scope.todos.length; i < len; ++i) {
if (todo === $scope.todos[i]) {
$scope.todos.splice(i, 1);
}
}
};
$scope.remainingTodos = function() {
return $scope.todos.filter(function(val) {
return !val.completed;
});
};
$scope.completedTodos = function() {
return $scope.todos.filter(function(val) {
return val.completed;
});
}
$scope.clearDoneTodos = function() {
$scope.todos = $scope.remainingTodos();
};
$scope.markAllDone = function() {
var markDone = true;
if (!$scope.remainingTodos().length) {
markDone = false;
}
$scope.todos.forEach(function(todo) {
todo.completed = markDone;
});
};
};
todomvc.directive('todoBlur', function() {
return function( scope, elem, attrs ) {
elem.bind('blur', function() {
scope.$apply( attrs.todoBlur );
});
};
});
todomvc.directive('todoFocus', function( $timeout ) {
return function( scope, elem, attrs ) {
scope.$watch( attrs.todoFocus, function( newval ) {
if ( newval ) {
$timeout(function() {
elem[0].focus();
elem[0].select();
}, 0 );
}
});
};
});
This source diff could not be displayed because it is too large. You can view the blob instead.
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
line-height: 1;
color: black;
background: white;
}
ol, ul {
list-style: none;
}
a img {
border: none;
}
html {
background: #eeeeee;
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.4em;
background: #eeeeee;
color: #333333;
}
.clickable{
cursor:pointer;
}
#todoapp {
background: none repeat scroll 0 0 white;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
background: none repeat scroll 0 0 white;
margin: 0 auto 40px;
padding: 20px;
width: 480px;
}
#todoapp {
width: 480px;
margin: 0 auto 40px;
background: white;
padding: 20px;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
}
#todoapp h1 {
font-size: 36px;
font-weight: bold;
text-align: center;
padding: 20px 0 30px 0;
line-height: 1;
}
#create-todo {
position: relative;
}
#todo-form input {
width: 466px;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
padding: 6px;
border: 1px solid #999999;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
}
#create-todo input::-webkit-input-placeholder {
font-style: italic;
}
#create-todo span {
position: absolute;
z-index: 999;
width: 170px;
left: 50%;
margin-left: -85px;
}
#todo-list {
margin-top: 10px;
}
#todo-list li {
padding: 12px 20px 11px 0;
position: relative;
font-size: 24px;
line-height: 1.1em;
border-bottom: 1px solid #cccccc;
}
#todo-list li:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}
#todo-list li.editing-true {
padding: 0;
border-bottom: 0;
}
#todo-list .editing-true .display,
#todo-list .edit {
display: none;
}
#todo-list .editing-true .edit {
display: block;
}
#todo-list .editing-true input {
width: 444px;
font-size: 24px;
font-family: inherit;
margin: 0;
line-height: 1.6em;
border: 0;
outline: none;
padding: 10px 7px 0px 27px;
border: 1px solid #999999;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
}
#todo-list .check {
position: relative;
top: 9px;
margin: 0 10px 0 7px;
float: left;
}
#todo-list .done-true .todo-content {
text-decoration: line-through;
color: #777777;
}
#todo-list .todo-destroy {
position: absolute;
right: 5px;
top: 14px;
display: none;
cursor: pointer;
width: 20px;
height: 20px;
background: url(../img/destroy.png) no-repeat 0 0;
}
#todo-list li:hover .todo-destroy {
display: block;
}
#todo-list .todo-destroy:hover {
background-position: 0 -20px;
}
#todo-stats {
*zoom: 1;
margin-top: 10px;
color: #777777;
background: none repeat scroll 0 0 #F4FCE8;
border-radius: 0 0 5px 5px;
border-top: 1px solid #EDEDED;
color: #555555;
display: block;
line-height: 36px;
margin: 20px -20px -20px;
overflow: hidden;
padding: 0 20px;
}
#todo-stats:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}
#todo-stats .todo-count {
float: left;
}
#todo-stats .todo-count .number {
font-weight: bold;
color: #333333;
}
#todo-stats .todo-clear {
float: right;
}
#todoapp #todo-stats {
background: none repeat scroll 0 0 #F4FCE8;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-top: 1px solid #EDEDED;
color: #555555;
line-height: 36px;
margin-top: 10px;
padding: 0 20px;
}
#todoapp #todo-stats .todo-clear a {
display: block;
line-height: 20px;
text-decoration: none;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
-o-border-radius: 12px;
-ms-border-radius: 12px;
-khtml-border-radius: 12px;
border-radius: 12px;
background: rgba(0, 0, 0, 0.1);
color: #555555;
font-size: 11px;
margin-top: 8px;
padding: 0 10px 1px;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
}
/* line 136 */
#todoapp #todo-stats .todo-clear a:hover, #todoapp #todo-stats .todo-clear a:focus {
background: rgba(0, 0, 0, 0.15);
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
}
#todo-stats .todo-clear a {
color: #777777;
font-size: 12px;
}
#todo-stats .todo-clear a:visited {
color: #777777;
}
#todo-stats .todo-clear a:hover, #todo-stats .todo-clear a:focus {
color: #336699;
}
#instructions {
width: 520px;
margin: 10px auto;
color: #777777;
text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0;
text-align: center;
}
#instructions a {
color: #336699;
}
#credits {
width: 520px;
margin: 30px auto;
color: #999;
text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0;
text-align: center;
}
#credits a {
color: #888;
}
/*
* Fran�ois 'cahnory' Germain
*/
.ui-tooltip, .ui-tooltip-top, .ui-tooltip-right, .ui-tooltip-bottom, .ui-tooltip-left {
color:#ffffff;
cursor:normal;
display:-moz-inline-stack;
display:inline-block;
font-size:12px;
font-family:arial;
padding:.5em 1em;
position:relative;
text-align:center;
text-shadow:0 -1px 1px #111111;
-webkit-border-top-left-radius:4px ;
-webkit-border-top-right-radius:4px ;
-webkit-border-bottom-right-radius:4px ;
-webkit-border-bottom-left-radius:4px ;
-khtml-border-top-left-radius:4px ;
-khtml-border-top-right-radius:4px ;
-khtml-border-bottom-right-radius:4px ;
-khtml-border-bottom-left-radius:4px ;
-moz-border-radius-topleft:4px ;
-moz-border-radius-topright:4px ;
-moz-border-radius-bottomright:4px ;
-moz-border-radius-bottomleft:4px ;
border-top-left-radius:4px ;
border-top-right-radius:4px ;
border-bottom-right-radius:4px ;
border-bottom-left-radius:4px ;
-o-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
-moz-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
-khtml-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
-webkit-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
background-color:#3b3b3b;
background-image:-moz-linear-gradient(top,#555555,#222222);
background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#555555),color-stop(1,#222222));
filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=#555555,EndColorStr=#222222);
-ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=#555555,EndColorStr=#222222);
}
.ui-tooltip:after, .ui-tooltip-top:after, .ui-tooltip-right:after, .ui-tooltip-bottom:after, .ui-tooltip-left:after {
content:"\25B8";
display:block;
font-size:2em;
height:0;
line-height:0;
position:absolute;
}
.ui-tooltip:after, .ui-tooltip-bottom:after {
color:#2a2a2a;
bottom:0;
left:1px;
text-align:center;
text-shadow:1px 0 2px #000000;
-o-transform:rotate(90deg);
-moz-transform:rotate(90deg);
-khtml-transform:rotate(90deg);
-webkit-transform:rotate(90deg);
width:100%;
}
.ui-tooltip-top:after {
bottom:auto;
color:#4f4f4f;
left:-2px;
top:0;
text-align:center;
text-shadow:none;
-o-transform:rotate(-90deg);
-moz-transform:rotate(-90deg);
-khtml-transform:rotate(-90deg);
-webkit-transform:rotate(-90deg);
width:100%;
}
.ui-tooltip-right:after {
color:#222222;
right:-0.375em;
top:50%;
margin-top:-.05em;
text-shadow:0 1px 2px #000000;
-o-transform:rotate(0);
-moz-transform:rotate(0);
-khtml-transform:rotate(0);
-webkit-transform:rotate(0);
}
.ui-tooltip-left:after {
color:#222222;
left:-0.375em;
top:50%;
margin-top:.1em;
text-shadow:0 -1px 2px #000000;
-o-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-khtml-transform:rotate(180deg);
-webkit-transform:rotate(180deg);
}
<!doctype html>
<html xmlns:ng="http://angularjs.org/" xmlns:my="http://rx.org">
<html lang="en" ng-app="todomvc">
<head>
<meta charset="utf-8">
<title>AngularJS with PersistenceJS Storage Todo App</title>
<link rel="stylesheet" href="css/app.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>AngularJS - TodoMVC</title>
<link rel="stylesheet" href="../../assets/base.css">
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
</head>
<body>
<div ng:controller="App.Controllers.TodoController" id="todoapp">
<div class="title">
<h1>
Todos
</h1>
</div>
<div class="content">
<div id="todo-form">
</div>
<form id="todo-form" ng:submit="addTodo()">
<input id="new-todo" name="newTodo" my:blur="addTodo()" placeholder="What needs to be done?" type="text">
<span class="ui-tooltip-top" ng:show="showHitEnterHint">
Press Enter to save this task
</span>
</form>
<div id="todos">
<ul id="todo-list">
<li class="todo" ng:class="'editing-' + todo.editing + ' done-' + todo.done" ng:repeat="todo in todos">
<div class="display">
<input ng:change="changeStatus(todo)" class="check" type="checkbox" name="todo.done" / >
<div ng:click="editTodo(todo)" class="todo-content"> {{ todo.content }} </div>
<span class="todo-destroy" ng:click="removeTodo(todo)"></span>
</div>
<div class="edit">
<form ng:submit="finishEditing(todo)">
<input class="todo-input" my:focus="todo.editing" my:blur="finishEditing(todo)" name="todo.content" type="text">
</form>
</div>
</li>
</ul>
</div>
<div id="todo-stats">
<span class="todo-count" ng:show="hasTodos()">
<ng:pluralize count="remainingTodos()" when="{'0' : 'No items left.', '1': '1 item left.', 'other' : '{} items left.' }">
</ng:pluralize>
</span>
<span class="todo-clear" ng:show="hasFinishedTodos()">
<a ng:click="clearCompletedItems()">
Clear <ng:pluralize count="finishedTodos()" when="{'1': '1 completed item', 'other' : '{} completed items' }">
</ng:pluralize>
</a>
</span>
</div>
</div>
</div>
<ul id="instructions">
<li>Click to edit a todo.</li>
</ul>
<div id="credits">
<p>
Originally Created by
<br>
<a href="http://jgn.me/">Jérôme Gravel-Niquet</a>
</p>
<p>
Rewritten to use <a href="http://angularjs.org">AngularJS </a> by
<br>
<a href="http://cburgdorf.wordpress.com/">Christoph Burgdorf</a>
<br>Cleanup, edits: <a href="http://www.linkedin.com/pub/dan-doyon/2/1b0/a83">Dan Doyon</a>
</p>
<p>
Extended for persistent WebSQL storage by <br/>
<a href="http://jacobmumm.com">Jacob Mumm</a><br/>
Using <a href="http://persistencejs.org">PersistenceJS</a>
</p>
</div>
<section id="todoapp" ng-controller="TodoController">
<header id="header">
<h1>todos</h1>
<form id="todo-form" ng-submit="addTodo()">
<input id="new-todo" placeholder="What needs to be done?" type="text" name="newTodo" ng-model="newTodo">
</form>
</header>
<section id="main" ng-show="todos.length">
<input id="toggle-all" type="checkbox" ng-model="allChecked" ng-change="markAllDone()" ng-checked="remainingTodos().length == 0">
<label for="toggle-all">Mark all as complete</label>
<ul id="todo-list">
<li ng-repeat="todo in todos | filter:statusFilter" ng-dblclick="editTodo(todo)" ng-class="{done: todo.completed, editing: todo.editing}">
<div class="view">
<input class="toggle" type="checkbox" name="todo.completed" ng-model="todo.completed" ng-change="toggleDone(todo)">
<label ng-bind="todo.title">Loading...</label>
<button class="destroy" ng-click="removeTodo(todo)"></button>
</div>
<form ng-submit="finishEditing(todo)">
<input class="edit" type="text" name="todo.title" ng-model="todo.title" todo-blur="finishEditing(todo)" todo-focus="todo.editing">
</form>
</li>
</ul>
</section>
<footer id="footer" ng-show="todos.length">
<span id="todo-count"><strong>{{remainingTodos().length}}</strong> <ng-pluralize count="remainingTodos().length" when="todoForms"></ng-pluralize></span>
<ul id="filters">
<li>
<a ng-class="{selected: location.path() == '/'} " href="#/">All</a>
</li>
<li>
<a ng-class="{selected: location.path() == '/active'}" href="#/active">Active</a>
</li>
<li>
<a ng-class="{selected: location.path() == '/completed'}" href="#/completed">Completed</a>
</li>
</ul>
<button id="clear-completed" ng-click="clearDoneTodos()" ng-show="doneTodos().length" ng-bind-template="Clear completed ({{doneTodos().length}})"></button>
</footer>
</section>
<footer id="info">
<p>Double-click to edit a todo.</p>
<p>Created by <a href="http://twitter.com/cburgdorf">Christoph Burgdorf</a>.</p>
<p>Extended to use PersistenceJS for local storage by <a href="http://jacobmumm.com">Jacob Mumm</a>.</p>
</footer>
<script src="../../assets/base.js"></script>
<script src="js/booter.js"></script>
<script src="lib/angular/angular.min.js" ng:autobind></script>
<script src="lib/rx/rx.js"></script>
<script src="lib/rx/rx.angular.js"></script>
<script src="lib/persistence/persistence.js"></script>
<script src="lib/persistence/persistence.store.sql.js"></script>
<script src="lib/persistence/persistence.store.websql.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directive.js"></script>
<script src="js/services.js"></script>
<script src="js/libs/angular/angular.min.js"></script>
<script src="js/libs/persistencejs/persistence.js"></script>
<script src="js/libs/persistencejs/persistence.store.sql.js"></script>
<script src="js/libs/persistencejs/persistence.store.websql.js"></script>
<script src="js/controllers/todo.js"></script>
<script src="js/modules/persistence-service.js"></script>
<script src="js/directives/todo-directives.js"></script>
</body>
</html>
\ No newline at end of file
</html>
/* App Controllers */
App.Controllers.TodoController = function (persistencejs) {
var self = this;
self.newTodo = "";
self.editTodoStartContent = "";
self.addTodo = function() {
if (self.newTodo.length === 0) return;
self.todos.push({
content: self.newTodo,
done: false,
editing: false
});
persistencejs.add(self.newTodo);
self.newTodo = "";
};
self.editTodo = function(todo) {
angular.forEach(self.todos, function(value) {
value.editing = false;
});
todo.editing = true;
self.editTodoStartContent = todo.content;
};
self.changeStatus = function(todo){
persistencejs.changeStatus(todo);
};
self.finishEditing = function(todo) {
todo.editing = false;
persistencejs.edit(self.editTodoStartContent, todo.content);
};
self.removeTodo = function(todo) {
angular.Array.remove(self.todos, todo);
persistencejs.remove(todo);
};
self.todos = [];
var countTodos = function(done) {
return function() {
return angular.Array.count(self.todos, function(x) {
return x.done === (done === "done");
});
}
};
self.remainingTodos = countTodos("undone");
self.finishedTodos = countTodos("done");
self.clearCompletedItems = function() {
var oldTodos = self.todos;
self.todos = [];
angular.forEach(oldTodos, function(todo) {
if (!todo.done) self.todos.push(todo);
});
persistencejs.clearCompletedItems();
};
self.hasFinishedTodos = function() {
return self.finishedTodos() > 0;
};
self.hasTodos = function() {
return self.todos.length > 0;
};
self.loadTodos = function(){
persistencejs.fetchAll(self);
}
self.refresh = function(){ self.$apply(); }
self.loadTodos();
/*
The following code deals with hiding the hint *while* you are typing,
showing it once you did *finish* typing (aka 500 ms since you hit the last key)
*in case* the result is a non empty string
*/
Rx.Observable.FromAngularScope(self, "newTodo")
.Do(function() {
self.showHitEnterHint = false;
})
.Throttle(500)
.Select(function(x) {
return x.length > 0;
})
.ToOutputProperty(self, "showHitEnterHint");
};
App.Controllers.TodoController.$inject = ['persistencejs'];
\ No newline at end of file
/* App Controllers */
var todomvc = angular.module('todomvc', []);
function TodoController($scope, $location, persistencejs) {
$scope.todos = []; loadTodos();
$scope.newTodo = "";
$scope.editTodoStartContent = "";
if($location.path()=='') $location.path('/');
$scope.location = $location;
$scope.$watch(function() {return $location.path(); }, function(path) {
$scope.statusFilter = path == '/active' ?
{ completed: false } : path == '/completed' ?
{ completed: true } : null;
});
function loadTodos() {
persistencejs.fetchAll($scope);
};
$scope.refresh = function(){ $scope.$apply(); }
$scope.todoForms = {
one: 'item left',
other: 'items left'
};
$scope.addTodo = function() {
if (this.newTodo.trim().length === 0) {
return;
}
$scope.todos.push({
title: this.newTodo,
completed: false,
editing: false
});
persistencejs.add(this.newTodo);
this.newTodo = '';
};
$scope.editTodo = function(todo) {
$scope.todos.forEach(function(val) {
val.editing = false;
});
todo.editing = true;
$scope.editTodoStartContent = todo.title;
};
$scope.finishEditing = function(todo) {
if (todo.title.trim().length === 0) {
$scope.removeTodo(todo);
persistencejs.remove(todo);
} else {
todo.editing = false;
persistencejs.edit($scope.editTodoStartContent, todo.title);
}
};
$scope.removeTodo = function(todo) {
for (var i = 0, len = $scope.todos.length; i < len; ++i) {
if (todo === $scope.todos[i]) {
$scope.todos.splice(i, 1);
}
}
persistencejs.remove(todo);
};
$scope.remainingTodos = function() {
return $scope.todos.filter(function(val) {
return !val.completed;
});
};
$scope.completedTodos = function() {
return $scope.todos.filter(function(val) {
return val.completed;
});
}
$scope.clearDoneTodos = function() {
$scope.todos = $scope.remainingTodos();
persistencejs.clearCompletedItems();
};
$scope.toggleDone = function(todo){
persistencejs.changeStatus(todo);
}
$scope.markAllDone = function() {
var markDone = true;
if (!$scope.remainingTodos().length) {
markDone = false;
}
$scope.todos.forEach(function(todo) {
if(todo.completed !== markDone){
persistencejs.changeStatus(todo);
}
todo.completed = markDone;
});
};
};
angular.directive('my:blur', function(expression, compiledElement) {
var compiler = this;
return function(linkElement) {
var scope = this;
linkElement.bind('blur', function(event) {
scope.$apply(expression, linkElement);
event.stopPropagation();
});
};
});
angular.directive("my:focus", function(expression, compiledElement){
return function(element){
this.$watch(expression, function(){
if(angular.formatter.boolean.parse(expression)){
element[0].focus();
}
}, element);
};
});
todomvc.directive('todoBlur', function() {
return function( scope, elem, attrs ) {
elem.bind('blur', function() {
scope.$apply( attrs.todoBlur );
});
};
});
todomvc.directive('todoFocus', function( $timeout ) {
return function( scope, elem, attrs ) {
scope.$watch( attrs.todoFocus, function( newval ) {
if ( newval ) {
$timeout(function() {
elem[0].focus();
elem[0].select();
}, 0 );
}
});
};
});
/*
AngularJS v1.0.0
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
(function(T,$,p){'use strict';function m(b,a,c){var d;if(b)if(M(b))for(d in b)d!="prototype"&&d!="length"&&d!="name"&&b.hasOwnProperty(d)&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==m)b.forEach(a,c);else if(J(b)&&va(b.length))for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function kb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function dc(b,a,c){for(var d=kb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}
function lb(b){return function(a,c){b(c,a)}}function wa(){for(var b=X.length,a;b;){b--;a=X[b].charCodeAt(0);if(a==57)return X[b]="A",X.join("");if(a==90)X[b]="0";else return X[b]=String.fromCharCode(a+1),X.join("")}X.unshift("0");return X.join("")}function D(b){m(arguments,function(a){a!==b&&m(a,function(a,d){b[d]=a})});return b}function I(b){return parseInt(b,10)}function xa(b,a){return D(new (D(function(){},{prototype:b})),a)}function x(){}function ya(b){return b}function B(b){return function(){return b}}
function v(b){return typeof b=="undefined"}function s(b){return typeof b!="undefined"}function J(b){return b!=null&&typeof b=="object"}function G(b){return typeof b=="string"}function va(b){return typeof b=="number"}function ma(b){return Sa.apply(b)=="[object Date]"}function K(b){return Sa.apply(b)=="[object Array]"}function M(b){return typeof b=="function"}function na(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function Q(b){return G(b)?b.replace(/^\s*/,"").replace(/\s*$/,""):b}function ec(b){return b&&
(b.nodeName||b.bind&&b.find)}function Ta(b,a,c){var d=[];m(b,function(b,g,h){d.push(a.call(c,b,g,h))});return d}function fc(b,a){var c=0,d;if(K(b)||G(b))return b.length;else if(J(b))for(d in b)(!a||b.hasOwnProperty(d))&&c++;return c}function Ua(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function za(b,a){var c=Ua(b,a);c>=0&&b.splice(c,1);return a}function U(b,a){if(na(b)||b&&b.$evalAsync&&b.$watch)throw z("Can't copy Window or Scope");if(a){if(b===
a)throw z("Can't copy equivalent objects or arrays");if(K(b)){for(;a.length;)a.pop();for(var c=0;c<b.length;c++)a.push(U(b[c]))}else for(c in m(a,function(b,c){delete a[c]}),b)a[c]=U(b[c])}else(a=b)&&(K(b)?a=U(b,[]):ma(b)?a=new Date(b.getTime()):J(b)&&(a=U(b,{})));return a}function gc(b,a){var a=a||{},c;for(c in b)b.hasOwnProperty(c)&&c.substr(0,2)!=="$$"&&(a[c]=b[c]);return a}function ea(b,a){if(b===a)return!0;if(b===null||a===null)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&
c=="object")if(K(b)){if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ea(b[d],a[d]))return!1;return!0}}else if(ma(b))return ma(a)&&b.getTime()==a.getTime();else{if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||na(b)||na(a))return!1;c={};for(d in b){if(d.charAt(0)!=="$"&&!M(b[d])&&!ea(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c[d]&&d.charAt(0)!=="$"&&!M(a[d]))return!1;return!0}return!1}function Va(b,a){var c=arguments.length>2?ga.call(arguments,2):[];return M(a)&&!(a instanceof RegExp)?c.length?
function(){return arguments.length?a.apply(b,c.concat(ga.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}:a}function hc(b,a){var c=a;/^\$+/.test(b)?c=p:na(a)?c="$WINDOW":a&&$===a?c="$DOCUMENT":a&&a.$evalAsync&&a.$watch&&(c="$SCOPE");return c}function aa(b,a){return JSON.stringify(b,hc,a?" ":null)}function mb(b){return G(b)?JSON.parse(b):b}function Wa(b){b&&b.length!==0?(b=C(""+b),b=!(b=="f"||b=="0"||b=="false"||b=="no"||b=="n"||b=="[]")):b=!1;return b}
function oa(b){b=u(b).clone();try{b.html("")}catch(a){}return u("<div>").append(b).html().match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+C(b)})}function Xa(b){var a={},c,d;m((b||"").split("&"),function(b){b&&(c=b.split("="),d=decodeURIComponent(c[0]),a[d]=s(c[1])?decodeURIComponent(c[1]):!0)});return a}function nb(b){var a=[];m(b,function(b,d){a.push(Ya(d,!0)+(b===!0?"":"="+Ya(b,!0)))});return a.length?a.join("&"):""}function Za(b){return Ya(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,
"=").replace(/%2B/gi,"+")}function Ya(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(a?null:/%20/g,"+")}function ic(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,h=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;m(h,function(a){h[a]=!0;c($.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(m(b.querySelectorAll("."+a),c),m(b.querySelectorAll("."+a+"\\:"),c),m(b.querySelectorAll("["+
a+"]"),c))});m(d,function(a){if(!e){var b=f.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):m(a.attributes,function(b){if(!e&&h[b.name])e=a,g=b.value})}});e&&a(e,g?[g]:[])}function ob(b,a){b=u(b);a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");var c=pb(a);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,h){a.$apply(function(){b.data("$injector",h);c(b)(a)})}]);return c}function $a(b,a){a=a||"_";return b.replace(jc,
function(b,d){return(d?a:"")+b.toLowerCase()})}function pa(b,a,c){if(!b)throw new z("Argument '"+(a||"?")+"' is "+(c||"required"));return b}function qa(b,a,c){c&&K(b)&&(b=b[b.length-1]);pa(M(b),a,"not a function, got "+(b&&typeof b=="object"?b.constructor.name||"Object":typeof b));return b}function kc(b){function a(a,b,e){return a[b]||(a[b]=e())}return a(a(b,"angular",Object),"module",function(){var b={};return function(d,e,g){e&&b.hasOwnProperty(d)&&(b[d]=null);return a(b,d,function(){function a(c,
d,e){return function(){b[e||"push"]([c,d,arguments]);return k}}if(!e)throw z("No module: "+d);var b=[],c=[],j=a("$injector","invoke"),k={_invokeQueue:b,_runBlocks:c,requires:e,name:d,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:j,run:function(a){c.push(a);
return this}};g&&j(g);return k})}})}function qb(b){return b.replace(lc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(mc,"Moz$1")}function ab(b,a){function c(){var e;for(var b=[this],c=a,h,f,i,j,k,l,n;b.length;){h=b.shift();f=0;for(i=h.length;f<i;f++){j=u(h[f]);c?(n=(k=j.data("events"))&&k.$destroy)&&m(n,function(a){a.handler()}):c=!c;k=0;for(e=(l=j.children()).length,j=e;k<j;k++)b.push(ha(l[k]))}}return d.apply(this,arguments)}var d=ha.fn[b],d=d.$original||d;c.$original=d;ha.fn[b]=c}function P(b){if(b instanceof
P)return b;if(!(this instanceof P)){if(G(b)&&b.charAt(0)!="<")throw z("selectors not implemented");return new P(b)}if(G(b)){var a=$.createElement("div");a.innerHTML="<div>&nbsp;</div>"+b;a.removeChild(a.firstChild);bb(this,a.childNodes);this.remove()}else bb(this,b)}function cb(b){return b.cloneNode(!0)}function ra(b){rb(b);for(var a=0,b=b.childNodes||[];a<b.length;a++)ra(b[a])}function sb(b,a,c){var d=ba(b,"events");ba(b,"handle")&&(v(a)?m(d,function(a,c){tb(b,c,a);delete d[c]}):v(c)?(tb(b,a,d[a]),
delete d[a]):za(d[a],c))}function rb(b){var a=b[Aa],c=Ba[a];c&&(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),sb(b)),delete Ba[a],b[Aa]=p)}function ba(b,a,c){var d=b[Aa],d=Ba[d||-1];if(s(c))d||(b[Aa]=d=++nc,d=Ba[d]={}),d[a]=c;else return d&&d[a]}function ub(b,a,c){var d=ba(b,"data"),e=s(c),g=!e&&s(a),h=g&&!J(a);!d&&!h&&ba(b,"data",d={});if(e)d[a]=c;else if(g)if(h)return d&&d[a];else D(d,a);else return d}function Ca(b,a){return(" "+b.className+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" ")>
-1}function vb(b,a){a&&m(a.split(" "),function(a){b.className=Q((" "+b.className+" ").replace(/[\n\t]/g," ").replace(" "+Q(a)+" "," "))})}function wb(b,a){a&&m(a.split(" "),function(a){if(!Ca(b,a))b.className=Q(b.className+" "+Q(a))})}function bb(b,a){if(a)for(var a=!a.nodeName&&s(a.length)&&!na(a)?a:[a],c=0;c<a.length;c++)b.push(a[c])}function xb(b,a){return Da(b,"$"+(a||"ngController")+"Controller")}function Da(b,a,c){b=u(b);for(b[0].nodeType==9&&(b=b.find("html"));b.length;){if(c=b.data(a))return c;
b=b.parent()}}function yb(b,a){var c=Ea[a.toLowerCase()];return c&&zb[b.nodeName]&&c}function oc(b,a){var c=function(c,e){if(!c.preventDefault)c.preventDefault=function(){c.returnValue=!1};if(!c.stopPropagation)c.stopPropagation=function(){c.cancelBubble=!0};if(!c.target)c.target=c.srcElement||$;if(v(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented};m(a[e||c.type],
function(a){a.call(b,c)});Y<=8?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function ia(b){var a=typeof b,c;if(a=="object"&&b!==null)if(typeof(c=b.$$hashKey)=="function")c=b.$$hashKey();else{if(c===p)c=b.$$hashKey=wa()}else c=b;return a+":"+c}function Fa(b){m(b,this.put,this)}function db(){}function Ab(b){var a,c;if(typeof b=="function"){if(!(a=b.$inject))a=[],c=b.toString().replace(pc,
""),c=c.match(qc),m(c[1].split(rc),function(b){b.replace(sc,function(b,c,d){a.push(d)})}),b.$inject=a}else K(b)?(c=b.length-1,qa(b[c],"fn"),a=b.slice(0,c)):qa(b,"fn",!0);return a}function pb(b){function a(a){return function(b,c){if(J(b))m(b,lb(a));else return a(b,c)}}function c(a,b){M(b)&&(b=l.instantiate(b));if(!b.$get)throw z("Provider "+a+" must define $get factory method.");return k[a+f]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[];m(a,function(a){if(!j.get(a))if(j.put(a,!0),
G(a)){var c=sa(a);b=b.concat(e(c.requires)).concat(c._runBlocks);try{for(var d=c._invokeQueue,c=0,f=d.length;c<f;c++){var g=d[c],i=g[0]=="$injector"?l:l.get(g[0]);i[g[1]].apply(i,g[2])}}catch(h){throw h.message&&(h.message+=" from "+a),h;}}else if(M(a))try{b.push(l.invoke(a))}catch(o){throw o.message&&(o.message+=" from "+a),o;}else if(K(a))try{b.push(l.invoke(a))}catch(n){throw n.message&&(n.message+=" from "+String(a[a.length-1])),n;}else qa(a,"module")});return b}function g(a,b){function c(d){if(typeof d!==
"string")throw z("Service name expected");if(a.hasOwnProperty(d)){if(a[d]===h)throw z("Circular dependency: "+i.join(" <- "));return a[d]}else try{return i.unshift(d),a[d]=h,a[d]=b(d)}finally{i.shift()}}function d(a,b,e){var f=[],g=Ab(a),j,h,o;h=0;for(j=g.length;h<j;h++)o=g[h],f.push(e&&e.hasOwnProperty(o)?e[o]:c(o,i));a.$inject||(a=a[j]);switch(b?-1:f.length){case 0:return a();case 1:return a(f[0]);case 2:return a(f[0],f[1]);case 3:return a(f[0],f[1],f[2]);case 4:return a(f[0],f[1],f[2],f[3]);case 5:return a(f[0],
f[1],f[2],f[3],f[4]);case 6:return a(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);case 8:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7]);case 9:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8]);case 10:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9]);default:return a.apply(b,f)}}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(K(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return J(e)?e:c},get:c,annotate:Ab}}var h=
{},f="Provider",i=[],j=new Fa,k={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,B(b))}),constant:a(function(a,b){k[a]=b;n[a]=b}),decorator:function(a,b){var c=l.get(a+f),d=c.$get;c.$get=function(){var a=r.invoke(d,c);return r.invoke(b,null,{$delegate:a})}}}},l=g(k,function(){throw z("Unknown provider: "+i.join(" <- "));}),n={},r=n.$injector=g(n,function(a){a=l.get(a+f);return r.invoke(a.$get,
a)});m(e(b),function(a){r.invoke(a||x)});return r}function tc(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;m(a,function(a){!b&&C(a.nodeName)==="a"&&(b=a)});return b}function g(){var b=c.hash(),d;b?(d=h.getElementById(b))?d.scrollIntoView():(d=e(h.getElementsByName(b)))?d.scrollIntoView():b==="top"&&a.scrollTo(0,0):a.scrollTo(0,0)}var h=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(g)});
return g}]}function uc(b,a,c,d){function e(a){try{a.apply(null,ga.call(arguments,1))}finally{if(o--,o===0)for(;w.length;)try{w.pop()()}catch(b){c.error(b)}}}function g(a,b){(function ca(){m(q,function(a){a()});t=b(ca,a)})()}function h(){fa!=f.url()&&(fa=f.url(),m(y,function(a){a(f.url())}))}var f=this,i=a[0],j=b.location,k=b.history,l=b.setTimeout,n=b.clearTimeout,r={};f.isMock=!1;var o=0,w=[];f.$$completeOutstandingRequest=e;f.$$incOutstandingRequestCount=function(){o++};f.notifyWhenNoOutstandingRequests=
function(a){m(q,function(a){a()});o===0?a():w.push(a)};var q=[],t;f.addPollFn=function(a){v(t)&&g(100,l);q.push(a);return a};var fa=j.href,A=a.find("base");f.url=function(a,b){return a?(fa=a,d.history?b?k.replaceState(null,"",a):(k.pushState(null,"",a),A.attr("href",A.attr("href"))):b?j.replace(a):j.href=a,f):j.href.replace(/%27/g,"'")};var y=[],L=!1;f.onUrlChange=function(a){L||(d.history&&u(b).bind("popstate",h),d.hashchange?u(b).bind("hashchange",h):f.addPollFn(h),L=!0);y.push(a);return a};f.baseHref=
function(){var a=A.attr("href");return a?a.replace(/^https?\:\/\/[^\/]*/,""):a};var V={},H="",N=f.baseHref();f.cookies=function(a,b){var d,e,f,g;if(a)if(b===p)i.cookie=escape(a)+"=;path="+N+";expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(G(b))d=(i.cookie=escape(a)+"="+escape(b)+";path="+N).length+1,d>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"),V.length>20&&c.warn("Cookie '"+a+"' possibly not set or overflowed because too many cookies were already set ("+
V.length+" > 20 )")}else{if(i.cookie!==H){H=i.cookie;d=H.split("; ");V={};for(f=0;f<d.length;f++)e=d[f],g=e.indexOf("="),g>0&&(V[unescape(e.substring(0,g))]=unescape(e.substring(g+1)))}return V}};f.defer=function(a,b){var c;o++;c=l(function(){delete r[c];e(a)},b||0);r[c]=!0;return c};f.defer.cancel=function(a){return r[a]?(delete r[a],n(a),e(x),!0):!1}}function vc(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new uc(b,d,a,c)}]}function wc(){this.$get=function(){function b(b,
d){function e(a){if(a!=l){if(n){if(n==a)n=a.n}else n=a;g(a.n,a.p);g(a,l);l=a;l.n=null}}function g(a,b){if(a!=b){if(a)a.p=b;if(b)b.n=a}}if(b in a)throw z("cacheId "+b+" taken");var h=0,f=D({},d,{id:b}),i={},j=d&&d.capacity||Number.MAX_VALUE,k={},l=null,n=null;return a[b]={put:function(a,b){var c=k[a]||(k[a]={key:a});e(c);v(b)||(a in i||h++,i[a]=b,h>j&&this.remove(n.key))},get:function(a){var b=k[a];if(b)return e(b),i[a]},remove:function(a){var b=k[a];if(b==l)l=b.p;if(b==n)n=b.n;g(b.n,b.p);delete k[a];
delete i[a];h--},removeAll:function(){i={};h=0;k={};l=n=null},destroy:function(){k=f=i=null;delete a[b]},info:function(){return D({},f,{size:h})}}}var a={};b.info=function(){var b={};m(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function xc(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function Bb(b){var a={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g="Template must have exactly one root element. was: ";
this.directive=function f(d,e){G(d)?(pa(e,"directive"),a.hasOwnProperty(d)||(a[d]=[],b.factory(d+c,["$injector","$exceptionHandler",function(b,c){var e=[];m(a[d],function(a){try{var f=b.invoke(a);if(M(f))f={compile:B(f)};else if(!f.compile&&f.link)f.compile=B(f.link);f.priority=f.priority||0;f.name=f.name||d;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(g){c(g)}});return e}])),a[d].push(e)):m(d,lb(f));return this};this.$get=["$injector","$interpolate","$exceptionHandler",
"$http","$templateCache","$parse","$controller","$rootScope",function(b,i,j,k,l,n,r,o){function w(a,b,c){a instanceof u||(a=u(a));m(a,function(b,c){b.nodeType==3&&(a[c]=u(b).wrap("<span>").parent()[0])});var d=t(a,b,a,c);return function(b,c){pa(b,"scope");var e=c?ta.clone.call(a):a;e.data("$scope",b);q(e,"ng-scope");c&&c(e,b);d&&d(b,e,e);return e}}function q(a,b){try{a.addClass(b)}catch(c){}}function t(a,b,c,d){function e(a,c,d,g){for(var j,i,n,k,l,o=0,r=0,q=f.length;o<q;r++)n=c[r],j=f[o++],i=f[o++],
j?(j.scope?(k=a.$new(J(j.scope)),u(n).data("$scope",k)):k=a,(l=j.transclude)||!g&&b?j(i,k,n,d,function(b){return function(c){var d=a.$new();return b(d,c).bind("$destroy",Va(d,d.$destroy))}}(l||b)):j(i,k,n,p,g)):i&&i(a,n.childNodes,p,g)}for(var f=[],g,j,i,n=0;n<a.length;n++)j=new ca,g=fa(a[n],[],j,d),j=(g=g.length?A(g,a[n],j,b,c):null)&&g.terminal?null:t(a[n].childNodes,g?g.transclude:b),f.push(g),f.push(j),i=i||g||j;return i?e:null}function fa(a,b,c,f){var g=c.$attr,j;switch(a.nodeType){case 1:y(b,
da(Cb(a).toLowerCase()),"E",f);var i,n,k;j=a.attributes;for(var l=0,o=j&&j.length;l<o;l++)if(i=j[l],i.specified)n=i.name,k=da(n.toLowerCase()),g[k]=n,c[k]=i=Q(Y&&n=="href"?decodeURIComponent(a.getAttribute(n,2)):i.value),yb(a,k)&&(c[k]=!0),W(a,b,i,k),y(b,k,"A",f);a=a.className;if(G(a))for(;j=e.exec(a);)k=da(j[2]),y(b,k,"C",f)&&(c[k]=Q(j[3])),a=a.substr(j.index+j[0].length);break;case 3:F(b,a.nodeValue);break;case 8:try{if(j=d.exec(a.nodeValue))k=da(j[1]),y(b,k,"M",f)&&(c[k]=Q(j[2]))}catch(r){}}b.sort(H);
return b}function A(a,b,c,d,e){function f(a,b){if(a)a.require=E.require,o.push(a);if(b)b.require=E.require,t.push(b)}function i(a,b){var c,d="data",e=!1;if(G(a)){for(;(c=a.charAt(0))=="^"||c=="?";)a=a.substr(1),c=="^"&&(d="inheritedData"),e=e||c=="?";c=b[d]("$"+a+"Controller");if(!c&&!e)throw z("No controller: "+a);}else K(a)&&(c=[],m(a,function(a){c.push(i(a,b))}));return c}function k(a,d,e,f,g){var l,q,w,L,Ha;l=b===e?c:gc(c,new ca(u(e),c.$attr));q=l.$$element;if(A&&J(A.scope)){var yc=/^\s*([@=&])\s*(\w*)\s*$/,
ja=d.$parent||d;m(A.scope,function(a,b){var c=a.match(yc)||[],e=c[2]||b,f,g,j;switch(c[1]){case "@":l.$observe(e,function(a){d[b]=a});l.$$observers[e].$$scope=ja;break;case "=":g=n(l[e]);j=g.assign||function(){f=d[b]=g(ja);throw z(Db+l[e]+" (directive: "+A.name+")");};f=d[b]=g(ja);d.$watch(function(){var a=g(ja);a!==d[b]&&(a!==f?f=d[b]=a:j(ja,f=d[b]));return a});break;case "&":g=n(l[e]);d[b]=function(a){return g(ja,a)};break;default:throw z("Invalid isolate scope definition for directive "+A.name+
": "+a);}})}s&&m(s,function(a){var b={$scope:d,$element:q,$attrs:l,$transclude:g};Ha=a.controller;Ha=="@"&&(Ha=l[a.name]);q.data("$"+a.name+"Controller",r(Ha,b))});f=0;for(w=o.length;f<w;f++)try{L=o[f],L(d,q,l,L.require&&i(L.require,q))}catch(y){j(y,oa(q))}a&&a(d,e.childNodes,p,g);f=0;for(w=t.length;f<w;f++)try{L=t[f],L(d,q,l,L.require&&i(L.require,q))}catch(H){j(H,oa(q))}}for(var l=-Number.MAX_VALUE,o=[],t=[],A=null,y=null,H=null,F=c.$$element=u(b),E,W,Z,x,v=d,s,D,B,C=0,I=a.length;C<I;C++){E=a[C];
Z=p;if(l>E.priority)break;if(B=E.scope)N("isolated scope",y,E,F),J(B)&&(q(F,"ng-isolate-scope"),y=E),q(F,"ng-scope"),A=A||E;W=E.name;if(B=E.controller)s=s||{},N("'"+W+"' controller",s[W],E,F),s[W]=E;if(B=E.transclude)N("transclusion",x,E,F),x=E,l=E.priority,B=="element"?(Z=u(b),F=c.$$element=u("<\!-- "+W+": "+c[W]+" --\>"),b=F[0],Ga(e,u(Z[0]),b),v=w(Z,d,l)):(Z=u(cb(b)).contents(),F.html(""),v=w(Z,d));if(B=E.template)if(N("template",H,E,F),H=E,Z=u("<div>"+Q(B)+"</div>").contents(),b=Z[0],E.replace){if(Z.length!=
1||b.nodeType!==1)throw new z(g+B);Ga(e,F,b);W={$attr:{}};a=a.concat(fa(b,a.splice(C+1,a.length-(C+1)),W));L(c,W);I=a.length}else F.html(B);if(E.templateUrl)N("template",H,E,F),H=E,k=V(a.splice(C,a.length-C),k,F,c,e,E.replace,v),I=a.length;else if(E.compile)try{D=E.compile(F,c,v),M(D)?f(null,D):D&&f(D.pre,D.post)}catch(O){j(O,oa(F))}if(E.terminal)k.terminal=!0,l=Math.max(l,E.priority)}k.scope=A&&A.scope;k.transclude=x&&v;return k}function y(d,e,g,i){var n=!1;if(a.hasOwnProperty(e))for(var k,e=b.get(e+
c),l=0,o=e.length;l<o;l++)try{if(k=e[l],(i===p||i>k.priority)&&k.restrict.indexOf(g)!=-1)d.push(k),n=!0}catch(r){j(r)}return n}function L(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;m(a,function(d,e){e.charAt(0)!="$"&&(b[e]&&(d+=(e==="style"?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});m(b,function(b,f){f=="class"?(q(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):f=="style"?e.attr("style",e.attr("style")+";"+b):f.charAt(0)!="$"&&!a.hasOwnProperty(f)&&(a[f]=b,d[f]=c[f])})}function V(a,b,c,d,e,f,j){var i=
[],n,o,r=c[0],q=a.shift(),w=D({},q,{controller:null,templateUrl:null,transclude:null});c.html("");k.get(q.templateUrl,{cache:l}).success(function(k){var l,q;if(f){q=u("<div>"+Q(k)+"</div>").contents();l=q[0];if(q.length!=1||l.nodeType!==1)throw new z(g+k);k={$attr:{}};Ga(e,c,l);fa(l,a,k);L(d,k)}else l=r,c.html(k);a.unshift(w);n=A(a,c,d,j);for(o=t(c.contents(),j);i.length;){var m=i.pop(),k=i.pop();q=i.pop();var y=i.pop(),H=l;q!==r&&(H=cb(l),Ga(k,u(q),H));n(function(){b(o,y,H,e,m)},y,H,e,m)}i=null}).error(function(a,
b,c,d){throw z("Failed to load template: "+d.url);});return function(a,c,d,e,f){i?(i.push(c),i.push(d),i.push(e),i.push(f)):n(function(){b(o,c,d,e,f)},c,d,e,f)}}function H(a,b){return b.priority-a.priority}function N(a,b,c,d){if(b)throw z("Multiple directives ["+b.name+", "+c.name+"] asking for "+a+" on: "+oa(d));}function F(a,b){var c=i(b,!0);c&&a.push({priority:0,compile:B(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);q(d.data("$binding",e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=
a})})})}function W(a,b,c,d){var e=i(c,!0);e&&b.push({priority:100,compile:B(function(a,b,c){b=c.$$observers||(c.$$observers={});d==="class"&&(e=i(c[d],!0));c[d]=p;(b[d]||(b[d]=[])).$$inter=!0;(c.$$observers&&c.$$observers[d].$$scope||a).$watch(e,function(a){c.$set(d,a)})})})}function Ga(a,b,c){var d=b[0],e=d.parentNode,f,g;if(a){f=0;for(g=a.length;f<g;f++)if(a[f]==d){a[f]=c;break}}e&&e.replaceChild(c,d);c[u.expando]=d[u.expando];b[0]=c}var ca=function(a,b){this.$$element=a;this.$attr=b||{}};ca.prototype=
{$normalize:da,$set:function(a,b,c,d){var e=yb(this.$$element[0],a),f=this.$$observers;e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=$a(a,"-"));c!==!1&&(b===null||b===p?this.$$element.removeAttr(d):this.$$element.attr(d,b));f&&m(f[a],function(a){try{a(b)}catch(c){j(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);o.$evalAsync(function(){e.$$inter||b(c[a])});return b}};return w}]}function da(b){return qb(b.replace(zc,
""))}function Ac(){var b={};this.register=function(a,c){J(a)?D(b,a):b[a]=c};this.$get=["$injector","$window",function(a,c){return function(d,e){if(G(d)){var g=d,d=b.hasOwnProperty(g)?b[g]:eb(e.$scope,g,!0)||eb(c,g,!0);qa(d,g,!0)}return a.instantiate(d,e)}}]}function Bc(){this.$get=["$window",function(b){return u(b.document)}]}function Cc(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function Dc(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):
b};this.endSymbol=function(c){return c?(a=c,this):b};this.$get=["$parse",function(c){var d=b.length,e=a.length;return function(g,h){for(var f,i,j=0,k=[],l=g.length,n=!1,r=[];j<l;)(f=g.indexOf(b,j))!=-1&&(i=g.indexOf(a,f+d))!=-1?(j!=f&&k.push(g.substring(j,f)),k.push(j=c(n=g.substring(f+d,i))),j.exp=n,j=i+e,n=!0):(j!=l&&k.push(g.substring(j)),j=l);if(!(l=k.length))k.push(""),l=1;if(!h||n)return r.length=l,j=function(a){for(var b=0,c=l,d;b<c;b++){if(typeof(d=k[b])=="function")d=d(a),d==null||d==p?d=
"":typeof d!="string"&&(d=aa(d));r[b]=d}return r.join("")},j.exp=g,j.parts=k,j}}]}function Eb(b){for(var b=b.split("/"),a=b.length;a--;)b[a]=Za(b[a]);return b.join("/")}function ua(b,a){var c=Fb.exec(b),c={protocol:c[1],host:c[3],port:I(c[5])||Gb[c[1]]||null,path:c[6]||"/",search:c[8],hash:c[10]};if(a)a.$$protocol=c.protocol,a.$$host=c.host,a.$$port=c.port;return c}function ka(b,a,c){return b+"://"+a+(c==Gb[b]?"":":"+c)}function Ec(b,a,c){var d=ua(b);return decodeURIComponent(d.path)!=a||v(d.hash)||
d.hash.indexOf(c)!==0?b:ka(d.protocol,d.host,d.port)+a.substr(0,a.lastIndexOf("/"))+d.hash.substr(c.length)}function Fc(b,a,c){var d=ua(b);if(decodeURIComponent(d.path)==a)return b;else{var e=d.search&&"?"+d.search||"",g=d.hash&&"#"+d.hash||"",h=a.substr(0,a.lastIndexOf("/")),f=d.path.substr(h.length);if(d.path.indexOf(h)!==0)throw z('Invalid url "'+b+'", missing path prefix "'+h+'" !');return ka(d.protocol,d.host,d.port)+a+"#"+c+f+e+g}}function fb(b,a,c){a=a||"";this.$$parse=function(b){var c=ua(b,
this);if(c.path.indexOf(a)!==0)throw z('Invalid url "'+b+'", missing path prefix "'+a+'" !');this.$$path=decodeURIComponent(c.path.substr(a.length));this.$$search=Xa(c.search);this.$$hash=c.hash&&decodeURIComponent(c.hash)||"";this.$$compose()};this.$$compose=function(){var b=nb(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):"";this.$$url=Eb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=ka(this.$$protocol,this.$$host,this.$$port)+a+this.$$url};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};
this.$$parse(b)}function Ia(b,a,c){var d;this.$$parse=function(b){var c=ua(b,this);if(c.hash&&c.hash.indexOf(a)!==0)throw z('Invalid url "'+b+'", missing hash prefix "'+a+'" !');d=c.path+(c.search?"?"+c.search:"");c=Gc.exec((c.hash||"").substr(a.length));this.$$path=c[1]?(c[1].charAt(0)=="/"?"":"/")+decodeURIComponent(c[1]):"";this.$$search=Xa(c[3]);this.$$hash=c[5]&&decodeURIComponent(c[5])||"";this.$$compose()};this.$$compose=function(){var b=nb(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):
"";this.$$url=Eb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=ka(this.$$protocol,this.$$host,this.$$port)+d+(this.$$url?"#"+a+this.$$url:"")};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Hb(b,a,c,d){Ia.apply(this,arguments);this.$$rewriteAppUrl=function(b){if(b.indexOf(c)==0)return c+d+"#"+a+b.substr(c.length)}}function Ja(b){return function(){return this[b]}}function Ib(b,a){return function(c){if(v(c))return this[b];this[b]=a(c);this.$$compose();return this}}
function Hc(){var b="",a=!1;this.hashPrefix=function(a){return s(a)?(b=a,this):b};this.html5Mode=function(b){return s(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function h(a){c.$broadcast("$locationChangeSuccess",f.absUrl(),a)}var f,i,j,k=d.url(),l=ua(k);a?(i=d.baseHref()||"/",j=i.substr(0,i.lastIndexOf("/")),l=ka(l.protocol,l.host,l.port)+j+"/",f=e.history?new fb(Ec(k,i,b),j,l):new Hb(Fc(k,i,b),b,l,i.substr(j.length+1))):(l=ka(l.protocol,l.host,
l.port)+(l.path||"")+(l.search?"?"+l.search:"")+"#"+b+"/",f=new Ia(k,b,l));g.bind("click",function(a){if(!a.ctrlKey&&!(a.metaKey||a.which==2)){for(var b=u(a.target);C(b[0].nodeName)!=="a";){if(b[0]===g[0])return;b=b.parent()}var d=b.prop("href"),e=f.$$rewriteAppUrl(d);d&&!b.attr("target")&&e&&(f.$$parse(e),c.$apply(),a.preventDefault(),T.angular["ff-684208-preventDefault"]=!0)}});f.absUrl()!=k&&d.url(f.absUrl(),!0);d.onUrlChange(function(a){f.absUrl()!=a&&(c.$evalAsync(function(){var b=f.absUrl();
f.$$parse(a);h(b)}),c.$$phase||c.$digest())});var n=0;c.$watch(function(){var a=d.url();if(!n||a!=f.absUrl())n++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),f.$$replace),f.$$replace=!1,h(a))});return n});return f}]}function Ic(){this.$get=["$window",function(b){function a(a){a instanceof z&&(a.stack?a=a.message&&a.stack.indexOf(a.message)===-1?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+
":"+a.line));return a}function c(c){var e=b.console||{},g=e[c]||e.log||x;return g.apply?function(){var b=[];m(arguments,function(c){b.push(a(c))});return g.apply(e,b)}:function(a,b){g(a,b)}}return{log:c("log"),warn:c("warn"),info:c("info"),error:c("error")}}]}function Jc(b,a){function c(a){return a.indexOf(q)!=-1}function d(){return o+1<b.length?b.charAt(o+1):!1}function e(a){return"0"<=a&&a<="9"}function g(a){return a==" "||a=="\r"||a=="\t"||a=="\n"||a=="\u000b"||a=="\u00a0"}function h(a){return"a"<=
a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function f(a){return a=="-"||a=="+"||e(a)}function i(a,c,d){d=d||o;throw z("Lexer Error: "+a+" at column"+(s(c)?"s "+c+"-"+o+" ["+b.substring(c,d)+"]":" "+d)+" in expression ["+b+"].");}function j(){for(var a="",c=o;o<b.length;){var j=C(b.charAt(o));if(j=="."||e(j))a+=j;else{var g=d();if(j=="e"&&f(g))a+=j;else if(f(j)&&g&&e(g)&&a.charAt(a.length-1)=="e")a+=j;else if(f(j)&&(!g||!e(g))&&a.charAt(a.length-1)=="e")i("Invalid exponent");else break}o++}a*=1;n.push({index:c,
text:a,json:!0,fn:function(){return a}})}function k(){for(var c="",d=o,f,j,i;o<b.length;){var k=b.charAt(o);if(k=="."||h(k)||e(k))k=="."&&(f=o),c+=k;else break;o++}if(f)for(j=o;j<b.length;){k=b.charAt(j);if(k=="("){i=c.substr(f-d+1);c=c.substr(0,f-d);o=j;break}if(g(k))j++;else break}d={index:d,text:c};if(Ka.hasOwnProperty(c))d.fn=d.json=Ka[c];else{var l=Jb(c,a);d.fn=D(function(a,b){return l(a,b)},{assign:function(a,b){return Kb(a,c,b)}})}n.push(d);i&&(n.push({index:f,text:".",json:!1}),n.push({index:f+
1,text:i,json:!1}))}function l(a){var c=o;o++;for(var d="",f=a,e=!1;o<b.length;){var j=b.charAt(o);f+=j;if(e)j=="u"?(j=b.substring(o+1,o+5),j.match(/[\da-f]{4}/i)||i("Invalid unicode escape [\\u"+j+"]"),o+=4,d+=String.fromCharCode(parseInt(j,16))):(e=Kc[j],d+=e?e:j),e=!1;else if(j=="\\")e=!0;else if(j==a){o++;n.push({index:c,text:f,string:d,json:!0,fn:function(){return d}});return}else d+=j;o++}i("Unterminated quote",c)}for(var n=[],r,o=0,w=[],q,t=":";o<b.length;){q=b.charAt(o);if(c("\"'"))l(q);else if(e(q)||
c(".")&&e(d()))j();else if(h(q)){if(k(),"{,".indexOf(t)!=-1&&w[0]=="{"&&(r=n[n.length-1]))r.json=r.text.indexOf(".")==-1}else if(c("(){}[].,;:"))n.push({index:o,text:q,json:":[,".indexOf(t)!=-1&&c("{[")||c("}]:,")}),c("{[")&&w.unshift(q),c("}]")&&w.shift(),o++;else if(g(q)){o++;continue}else{var m=q+d(),A=Ka[q],y=Ka[m];y?(n.push({index:o,text:m,fn:y}),o+=2):A?(n.push({index:o,text:q,fn:A,json:"[,:".indexOf(t)!=-1&&c("+-")}),o+=1):i("Unexpected next character ",o,o+1)}t=q}return n}function Lc(b,a,
c,d){function e(a,c){throw z("Syntax Error: Token '"+c.text+"' "+a+" at column "+(c.index+1)+" of the expression ["+b+"] starting at ["+b.substring(c.index)+"].");}function g(){if(N.length===0)throw z("Unexpected end of expression: "+b);return N[0]}function h(a,b,c,d){if(N.length>0){var e=N[0],f=e.text;if(f==a||f==b||f==c||f==d||!a&&!b&&!c&&!d)return e}return!1}function f(b,c,d,f){return(b=h(b,c,d,f))?(a&&!b.json&&e("is not valid json",b),N.shift(),b):!1}function i(a){f(a)||e("is unexpected, expecting ["+
a+"]",h())}function j(a,b){return function(c,d){return a(c,d,b)}}function k(a,b,c){return function(d,f){return b(d,f,a,c)}}function l(){for(var a=[];;)if(N.length>0&&!h("}",")",";","]")&&a.push(v()),!f(";"))return a.length==1?a[0]:function(b,c){for(var d,f=0;f<a.length;f++){var e=a[f];e&&(d=e(b,c))}return d}}function n(){for(var a=f(),b=c(a.text),d=[];;)if(a=f(":"))d.push(F());else{var e=function(a,c,f){for(var f=[f],e=0;e<d.length;e++)f.push(d[e](a,c));return b.apply(a,f)};return function(){return e}}}
function r(){for(var a=o(),b;;)if(b=f("||"))a=k(a,b.fn,o());else return a}function o(){var a=w(),b;if(b=f("&&"))a=k(a,b.fn,o());return a}function w(){var a=q(),b;if(b=f("==","!="))a=k(a,b.fn,w());return a}function q(){var a;a=t();for(var b;b=f("+","-");)a=k(a,b.fn,t());if(b=f("<",">","<=",">="))a=k(a,b.fn,q());return a}function t(){for(var a=m(),b;b=f("*","/","%");)a=k(a,b.fn,m());return a}function m(){var a;return f("+")?A():(a=f("-"))?k(V,a.fn,m()):(a=f("!"))?j(a.fn,m()):A()}function A(){var a;
if(f("("))a=v(),i(")");else if(f("["))a=y();else if(f("{"))a=L();else{var b=f();(a=b.fn)||e("not a primary expression",b)}for(var c;b=f("(","[",".");)b.text==="("?(a=u(a,c),c=null):b.text==="["?(c=a,a=ca(a)):b.text==="."?(c=a,a=s(a)):e("IMPOSSIBLE");return a}function y(){var a=[];if(g().text!="]"){do a.push(F());while(f(","))}i("]");return function(b,c){for(var d=[],f=0;f<a.length;f++)d.push(a[f](b,c));return d}}function L(){var a=[];if(g().text!="}"){do{var b=f(),b=b.string||b.text;i(":");var c=
F();a.push({key:b,value:c})}while(f(","))}i("}");return function(b,c){for(var d={},f=0;f<a.length;f++){var e=a[f],j=e.value(b,c);d[e.key]=j}return d}}var V=B(0),H,N=Jc(b,d),F=function(){var a=r(),c,d;return(d=f("="))?(a.assign||e("implies assignment but ["+b.substring(0,d.index)+"] can not be assigned to",d),c=r(),function(b,d){return a.assign(b,c(b,d),d)}):a},u=function(a,b){var c=[];if(g().text!=")"){do c.push(F());while(f(","))}i(")");return function(d,f){for(var e=[],j=b?b(d,f):d,g=0;g<c.length;g++)e.push(c[g](d,
f));g=a(d,f)||x;return g.apply?g.apply(j,e):g(e[0],e[1],e[2],e[3],e[4])}},s=function(a){var b=f().text,c=Jb(b,d);return D(function(b,d){return c(a(b,d),d)},{assign:function(c,d,f){return Kb(a(c,f),b,d)}})},ca=function(a){var b=F();i("]");return D(function(c,d){var f=a(c,d),e=b(c,d),j;if(!f)return p;if((f=f[e])&&f.then){j=f;if(!("$$v"in f))j.$$v=p,j.then(function(a){j.$$v=a});f=f.$$v}return f},{assign:function(c,d,f){return a(c,f)[b(c,f)]=d}})},v=function(){for(var a=F(),b;;)if(b=f("|"))a=k(a,b.fn,
n());else return a};a?(F=r,u=s=ca=v=function(){e("is not valid json",{text:b,index:0})},H=A()):H=l();N.length!==0&&e("is an unexpected token",N[0]);return H}function Kb(b,a,c){for(var a=a.split("."),d=0;a.length>1;d++){var e=a.shift(),g=b[e];g||(g={},b[e]=g);b=g}return b[a.shift()]=c}function eb(b,a,c){if(!a)return b;for(var a=a.split("."),d,e=b,g=a.length,h=0;h<g;h++)d=a[h],b&&(b=(e=b)[d]);return!c&&M(b)?Va(e,b):b}function Lb(b,a,c,d,e){return function(g,h){var f=h&&h.hasOwnProperty(b)?h:g,i;if(f===
null||f===p)return f;if((f=f[b])&&f.then){if(!("$$v"in f))i=f,i.$$v=p,i.then(function(a){i.$$v=a});f=f.$$v}if(!a||f===null||f===p)return f;if((f=f[a])&&f.then){if(!("$$v"in f))i=f,i.$$v=p,i.then(function(a){i.$$v=a});f=f.$$v}if(!c||f===null||f===p)return f;if((f=f[c])&&f.then){if(!("$$v"in f))i=f,i.$$v=p,i.then(function(a){i.$$v=a});f=f.$$v}if(!d||f===null||f===p)return f;if((f=f[d])&&f.then){if(!("$$v"in f))i=f,i.$$v=p,i.then(function(a){i.$$v=a});f=f.$$v}if(!e||f===null||f===p)return f;if((f=f[e])&&
f.then){if(!("$$v"in f))i=f,i.$$v=p,i.then(function(a){i.$$v=a});f=f.$$v}return f}}function Jb(b,a){if(gb.hasOwnProperty(b))return gb[b];var c=b.split("."),d=c.length,e;if(a)e=d<6?Lb(c[0],c[1],c[2],c[3],c[4]):function(a,b){var e=0,j;do j=Lb(c[e++],c[e++],c[e++],c[e++],c[e++])(a,b),b=p,a=j;while(e<d);return j};else{var g="var l, fn, p;\n";m(c,function(a,b){g+="if(s === null || s === undefined) return s;\nl=s;\ns="+(b?"s":'((k&&k.hasOwnProperty("'+a+'"))?k:s)')+'["'+a+'"];\nif (s && s.then) {\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n'});
g+="return s;";e=Function("s","k",g);e.toString=function(){return g}}return gb[b]=e}function Mc(){var b={};this.$get=["$filter","$sniffer",function(a,c){return function(d){switch(typeof d){case "string":return b.hasOwnProperty(d)?b[d]:b[d]=Lc(d,!1,a,c.csp);case "function":return d;default:return x}}}]}function Nc(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return Oc(function(a){b.$evalAsync(a)},a)}]}function Oc(b,a){function c(a){return a}function d(a){return h(a)}var e=function(){var f=
[],i,j;return j={resolve:function(a){if(f){var c=f;f=p;i=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],i.then(a[0],a[1])})}},reject:function(a){j.resolve(h(a))},promise:{then:function(b,j){var g=e(),h=function(d){try{g.resolve((b||c)(d))}catch(f){a(f),g.reject(f)}},o=function(b){try{g.resolve((j||d)(b))}catch(c){a(c),g.reject(c)}};f?f.push([h,o]):i.then(h,o);return g.promise}}}},g=function(a){return a&&a.then?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},
h=function(a){return{then:function(c,j){var g=e();b(function(){g.resolve((j||d)(a))});return g.promise}}};return{defer:e,reject:h,when:function(f,i,j){var k=e(),l,n=function(b){try{return(i||c)(b)}catch(d){return a(d),h(d)}},r=function(b){try{return(j||d)(b)}catch(c){return a(c),h(c)}};b(function(){g(f).then(function(a){l||(l=!0,k.resolve(g(a).then(n,r)))},function(a){l||(l=!0,k.resolve(r(a)))})});return k.promise},all:function(a){var b=e(),c=a.length,d=[];c?m(a,function(a,e){g(a).then(function(a){e in
d||(d[e]=a,--c||b.resolve(d))},function(a){e in d||b.reject(a)})}):b.resolve(d);return b.promise}}}function Pc(){var b={};this.when=function(a,c){b[a]=D({reloadOnSearch:!0},c);if(a){var d=a[a.length-1]=="/"?a.substr(0,a.length-1):a+"/";b[d]={redirectTo:a}}return this};this.otherwise=function(a){this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache",function(a,c,d,e,g,h,f){function i(){var b=j(),i=r.current;if(b&&i&&b.$route===i.$route&&
ea(b.pathParams,i.pathParams)&&!b.reloadOnSearch&&!n)i.params=b.params,U(i.params,d),a.$broadcast("$routeUpdate",i);else if(b||i)n=!1,a.$broadcast("$routeChangeStart",b,i),(r.current=b)&&b.redirectTo&&(G(b.redirectTo)?c.path(k(b.redirectTo,b.params)).search(b.params).replace():c.url(b.redirectTo(b.pathParams,c.path(),c.search())).replace()),e.when(b).then(function(){if(b){var a=[],c=[],d;m(b.resolve||{},function(b,d){a.push(d);c.push(M(b)?g.invoke(b):g.get(b))});if(!s(d=b.template))if(s(d=b.templateUrl))d=
h.get(d,{cache:f}).then(function(a){return a.data});s(d)&&(a.push("$template"),c.push(d));return e.all(c).then(function(b){var c={};m(b,function(b,d){c[a[d]]=b});return c})}}).then(function(c){if(b==r.current){if(b)b.locals=c,U(b.params,d);a.$broadcast("$routeChangeSuccess",b,i)}},function(c){b==r.current&&a.$broadcast("$routeChangeError",b,i,c)})}function j(){var a,d;m(b,function(b,e){if(!d&&(a=l(c.path(),e)))d=xa(b,{params:D({},c.search(),a),pathParams:a}),d.$route=b});return d||b[null]&&xa(b[null],
{params:{},pathParams:{}})}function k(a,b){var c=[];m((a||"").split(":"),function(a,d){if(d==0)c.push(a);else{var e=a.match(/(\w+)(.*)/),f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var l=function(a,b){var c="^"+b.replace(/([\.\\\(\)\^\$])/g,"\\$1")+"$",d=[],e={};m(b.split(/\W/),function(a){if(a){var b=RegExp(":"+a+"([\\W])");c.match(b)&&(c=c.replace(b,"([^\\/]*)$1"),d.push(a))}});var f=a.match(RegExp(c));f&&m(d,function(a,b){e[a]=f[b+1]});return f?e:null},n=!1,r={routes:b,
reload:function(){n=!0;a.$evalAsync(i)}};a.$on("$locationChangeSuccess",i);return r}]}function Qc(){this.$get=B({})}function Rc(){var b=10;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse",function(a,c,d){function e(){this.$id=wa();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$asyncQueue=[];this.$$listeners={}}function g(a){if(i.$$phase)throw z(i.$$phase+
" already in progress");i.$$phase=a}function h(a,b){var c=d(a);qa(c,b);return c}function f(){}e.prototype={$new:function(a){if(M(a))throw z("API-CHANGE: Use $controller to instantiate controllers.");a?(a=new e,a.$root=this.$root):(a=function(){},a.prototype=this,a=new a,a.$id=wa());a["this"]=a;a.$$listeners={};a.$parent=this;a.$$asyncQueue=[];a.$$watchers=a.$$nextSibling=a.$$childHead=a.$$childTail=null;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=
a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,c){var d=h(a,"watch"),e=this.$$watchers,g={fn:b,last:f,get:d,exp:a,eq:!!c};if(!M(b)){var i=h(b||x,"listener");g.fn=function(a,b,c){i(c)}}if(!e)e=this.$$watchers=[];e.unshift(g);return function(){za(e,g)}},$digest:function(){var a,d,e,h,r,o,m,q=b,t,p=[],A,y;g("$digest");do{m=!1;t=this;do{for(r=t.$$asyncQueue;r.length;)try{t.$eval(r.shift())}catch(L){c(L)}if(h=t.$$watchers)for(o=h.length;o--;)try{if(a=h[o],(d=a.get(t))!==(e=a.last)&&
!(a.eq?ea(d,e):typeof d=="number"&&typeof e=="number"&&isNaN(d)&&isNaN(e)))m=!0,a.last=a.eq?U(d):d,a.fn(d,e===f?d:e,t),q<5&&(A=4-q,p[A]||(p[A]=[]),y=M(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,y+="; newVal: "+aa(d)+"; oldVal: "+aa(e),p[A].push(y))}catch(V){c(V)}if(!(h=t.$$childHead||t!==this&&t.$$nextSibling))for(;t!==this&&!(h=t.$$nextSibling);)t=t.$parent}while(t=h);if(m&&!q--)throw i.$$phase=null,z(b+" $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: "+
aa(p));}while(m||r.length);i.$$phase=null},$destroy:function(){if(i!=this){var a=this.$parent;this.$broadcast("$destroy");if(a.$$childHead==this)a.$$childHead=this.$$nextSibling;if(a.$$childTail==this)a.$$childTail=this.$$prevSibling;if(this.$$prevSibling)this.$$prevSibling.$$nextSibling=this.$$nextSibling;if(this.$$nextSibling)this.$$nextSibling.$$prevSibling=this.$$prevSibling}},$eval:function(a,b){return d(a)(this,b)},$evalAsync:function(a){this.$$asyncQueue.push(a)},$apply:function(a){try{return g("$apply"),
this.$eval(a)}catch(b){c(b)}finally{i.$$phase=null;try{i.$digest()}catch(d){throw c(d),d;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){za(c,b)}},$emit:function(a,b){var d=[],e,f=this,g=!1,i={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){i.defaultPrevented=!0},defaultPrevented:!1},h=[i].concat(ga.call(arguments,1)),m,p;do{e=f.$$listeners[a]||d;i.currentScope=f;m=0;for(p=e.length;m<p;m++)try{if(e[m].apply(null,
h),g)return i}catch(A){c(A)}f=f.$parent}while(f);return i},$broadcast:function(a,b){var d=this,e=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=!0},defaultPrevented:!1},g=[f].concat(ga.call(arguments,1));do if(d=e,f.currentScope=d,m(d.$$listeners[a],function(a){try{a.apply(null,g)}catch(b){c(b)}}),!(e=d.$$childHead||d!==this&&d.$$nextSibling))for(;d!==this&&!(e=d.$$nextSibling);)d=d.$parent;while(d=e);return f}};var i=new e;return i}]}function Sc(){this.$get=["$window",
function(b){var a={},c=I((/android (\d+)/.exec(C(b.navigator.userAgent))||[])[1]);return{history:!(!b.history||!b.history.pushState||c<4),hashchange:"onhashchange"in b&&(!b.document.documentMode||b.document.documentMode>7),hasEvent:function(c){if(c=="input"&&Y==9)return!1;if(v(a[c])){var e=b.document.createElement("div");a[c]="on"+c in e}return a[c]},csp:!1}}]}function Tc(){this.$get=B(T)}function Mb(b){var a={},c,d,e;if(!b)return a;m(b.split("\n"),function(b){e=b.indexOf(":");c=C(Q(b.substr(0,e)));
d=Q(b.substr(e+1));c&&(a[c]?a[c]+=", "+d:a[c]=d)});return a}function Nb(b){var a=J(b)?b:p;return function(c){a||(a=Mb(b));return c?a[C(c)]||null:a}}function Ob(b,a,c){if(M(c))return c(b,a);m(c,function(c){b=c(b,a)});return b}function Uc(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d=this.defaults={transformResponse:[function(d){G(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=mb(d,!0)));return d}],transformRequest:[function(a){return J(a)&&Sa.apply(a)!=="[object File]"?aa(a):a}],headers:{common:{Accept:"application/json, text/plain, */*",
"X-Requested-With":"XMLHttpRequest"},post:{"Content-Type":"application/json;charset=utf-8"},put:{"Content-Type":"application/json;charset=utf-8"}}},e=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,i,j,k){function l(a){function c(a){var b=D({},a,{data:Ob(a.data,a.headers,f)});return 200<=a.status&&a.status<300?b:j.reject(b)}a.method=la(a.method);var e=a.transformRequest||d.transformRequest,f=a.transformResponse||d.transformResponse,
g=d.headers,g=D({"X-XSRF-TOKEN":b.cookies()["XSRF-TOKEN"]},g.common,g[C(a.method)],a.headers),e=Ob(a.data,Nb(g),e),i;v(a.data)&&delete g["Content-Type"];i=n(a,e,g);i=i.then(c,c);m(w,function(a){i=a(i)});i.success=function(b){i.then(function(c){b(c.data,c.status,c.headers,a)});return i};i.error=function(b){i.then(null,function(c){b(c.data,c.status,c.headers,a)});return i};return i}function n(b,c,d){function e(a,b,c){m&&(200<=a&&a<300?m.put(w,[a,b,Mb(c)]):m.remove(w));f(b,a,c);i.$apply()}function f(a,
c,d){c=Math.max(c,0);(200<=c&&c<300?n.resolve:n.reject)({data:a,status:c,headers:Nb(d),config:b})}function h(){var a=Ua(l.pendingRequests,b);a!==-1&&l.pendingRequests.splice(a,1)}var n=j.defer(),k=n.promise,m,p,w=r(b.url,b.params);l.pendingRequests.push(b);k.then(h,h);b.cache&&b.method=="GET"&&(m=J(b.cache)?b.cache:o);if(m)if(p=m.get(w))if(p.then)return p.then(h,h),p;else K(p)?f(p[1],p[0],U(p[2])):f(p,200,{});else m.put(w,k);p||a(b.method,w,c,e,d,b.timeout,b.withCredentials);return k}function r(a,
b){if(!b)return a;var c=[];dc(b,function(a,b){a==null||a==p||(J(a)&&(a=aa(a)),c.push(encodeURIComponent(b)+"="+encodeURIComponent(a)))});return a+(a.indexOf("?")==-1?"?":"&")+c.join("&")}var o=c("$http"),w=[];m(e,function(a){w.push(G(a)?k.get(a):k.invoke(a))});l.pendingRequests=[];(function(a){m(arguments,function(a){l[a]=function(b,c){return l(D(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){m(arguments,function(a){l[a]=function(b,c,d){return l(D(d||{},{method:a,url:b,
data:c}))}})})("post","put");l.defaults=d;return l}]}function Vc(){this.$get=["$browser","$window","$document",function(b,a,c){return Wc(b,Xc,b.defer,a.angular.callbacks,c[0],a.location.protocol.replace(":",""))}]}function Wc(b,a,c,d,e,g){function h(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;Y?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=d;e.body.appendChild(c)}return function(e,
i,j,k,l,n,r){function o(a,c,d,e){c=(i.match(Fb)||["",g])[1]=="file"?d?200:404:c;a(c==1223?204:c,d,e);b.$$completeOutstandingRequest(x)}b.$$incOutstandingRequestCount();i=i||b.url();if(C(e)=="jsonp"){var p="_"+(d.counter++).toString(36);d[p]=function(a){d[p].data=a};h(i.replace("JSON_CALLBACK","angular.callbacks."+p),function(){d[p].data?o(k,200,d[p].data):o(k,-2);delete d[p]})}else{var q=new a;q.open(e,i,!0);m(l,function(a,b){a&&q.setRequestHeader(b,a)});var t;q.onreadystatechange=function(){q.readyState==
4&&o(k,t||q.status,q.responseText,q.getAllResponseHeaders())};if(r)q.withCredentials=!0;q.send(j||"");n>0&&c(function(){t=-1;q.abort()},n)}}}function Yc(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),
SHORTMONTH:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),DAY:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),SHORTDAY:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return b===1?"one":"other"}}}}function Zc(){this.$get=["$rootScope","$browser","$q",
"$exceptionHandler",function(b,a,c,d){function e(e,f,i){var j=c.defer(),k=j.promise,l=s(i)&&!i,f=a.defer(function(){try{j.resolve(e())}catch(a){j.reject(a),d(a)}l||b.$apply()},f),i=function(){delete g[k.$$timeoutId]};k.$$timeoutId=f;g[f]=j;k.then(i,i);return k}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),a.defer.cancel(b.$$timeoutId)):!1};return e}]}function Pb(b){function a(a,e){return b.factory(a+c,e)}var c="Filter";this.register=a;this.$get=["$injector",
function(a){return function(b){return a.get(b+c)}}];a("currency",Qb);a("date",Rb);a("filter",$c);a("json",ad);a("limitTo",bd);a("lowercase",cd);a("number",Sb);a("orderBy",Tb);a("uppercase",dd)}function $c(){return function(b,a){if(!(b instanceof Array))return b;var c=[];c.check=function(a){for(var b=0;b<c.length;b++)if(!c[b](a))return!1;return!0};var d=function(a,b){if(b.charAt(0)==="!")return!d(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return(""+a).toLowerCase().indexOf(b)>
-1;case "object":for(var c in a)if(c.charAt(0)!=="$"&&d(a[c],b))return!0;return!1;case "array":for(c=0;c<a.length;c++)if(d(a[c],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var e in a)e=="$"?function(){var b=(""+a[e]).toLowerCase();b&&c.push(function(a){return d(a,b)})}():function(){var b=e,f=(""+a[e]).toLowerCase();f&&c.push(function(a){return d(eb(a,b),f)})}();break;case "function":c.push(a);break;default:return b}for(var g=
[],h=0;h<b.length;h++){var f=b[h];c.check(f)&&g.push(f)}return g}}function Qb(b){var a=b.NUMBER_FORMATS;return function(b,d){if(v(d))d=a.CURRENCY_SYM;return Ub(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Sb(b){var a=b.NUMBER_FORMATS;return function(b,d){return Ub(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Ub(b,a,c,d,e){if(isNaN(b)||!isFinite(b))return"";var g=b<0,b=Math.abs(b),h=b+"",f="",i=[];if(h.indexOf("e")!==-1)f=h;else{h=(h.split(Vb)[1]||"").length;
v(e)&&(e=Math.min(Math.max(a.minFrac,h),a.maxFrac));var h=Math.pow(10,e),b=Math.round(b*h)/h,b=(""+b).split(Vb),h=b[0],b=b[1]||"",j=0,k=a.lgSize,l=a.gSize;if(h.length>=k+l)for(var j=h.length-k,n=0;n<j;n++)(j-n)%l===0&&n!==0&&(f+=c),f+=h.charAt(n);for(n=j;n<h.length;n++)(h.length-n)%k===0&&n!==0&&(f+=c),f+=h.charAt(n);for(;b.length<e;)b+="0";e&&(f+=d+b.substr(0,e))}i.push(g?a.negPre:a.posPre);i.push(f);i.push(g?a.negSuf:a.posSuf);return i.join("")}function hb(b,a,c){var d="";b<0&&(d="-",b=-b);for(b=
""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function O(b,a,c,d){return function(e){e=e["get"+b]();if(c>0||e>-c)e+=c;e===0&&c==-12&&(e=12);return hb(e,a,d)}}function La(b,a){return function(c,d){var e=c["get"+b](),g=la(a?"SHORT"+b:b);return d[g][e]}}function Rb(b){function a(a){var b;if(b=a.match(c)){var a=new Date(0),g=0,h=0;b[9]&&(g=I(b[9]+b[10]),h=I(b[9]+b[11]));a.setUTCFullYear(I(b[1]),I(b[2])-1,I(b[3]));a.setUTCHours(I(b[4]||0)-g,I(b[5]||0)-h,I(b[6]||0),I(b[7]||0))}return a}
var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;return function(c,e){var g="",h=[],f,i,e=e||"mediumDate",e=b.DATETIME_FORMATS[e]||e;G(c)&&(c=ed.test(c)?I(c):a(c));va(c)&&(c=new Date(c));if(!ma(c))return c;for(;e;)(i=fd.exec(e))?(h=h.concat(ga.call(i,1)),e=h.pop()):(h.push(e),e=null);m(h,function(a){f=gd[a];g+=f?f(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function ad(){return function(b){return aa(b,!0)}}
function bd(){return function(b,a){if(!(b instanceof Array))return b;var a=I(a),c=[],d,e;if(!b||!(b instanceof Array))return c;a>b.length?a=b.length:a<-b.length&&(a=-b.length);a>0?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Tb(b){return function(a,c,d){function e(a,b){return Wa(b)?function(b,c){return a(c,b)}:a}if(!(a instanceof Array))return a;if(!c)return a;for(var c=K(c)?c:[c],c=Ta(c,function(a){var c=!1,d=a||ya;if(G(a)){if(a.charAt(0)=="+"||a.charAt(0)=="-")c=
a.charAt(0)=="-",a=a.substring(1);d=b(a)}return e(function(a,b){var c;c=d(a);var e=d(b),f=typeof c,g=typeof e;f==g?(f=="string"&&(c=c.toLowerCase()),f=="string"&&(e=e.toLowerCase()),c=c===e?0:c<e?-1:1):c=f<g?-1:1;return c},c)}),g=[],h=0;h<a.length;h++)g.push(a[h]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(e!==0)return e}return 0},d))}}function R(b){M(b)&&(b={link:b});b.restrict=b.restrict||"AC";return B(b)}function Wb(b,a){function c(a,c){c=c?"-"+$a(c,"-"):"";b.removeClass((a?
Ma:Na)+c).addClass((a?Na:Ma)+c)}var d=this,e=b.parent().controller("form")||Oa,g=0,h=d.$error={};d.$name=a.name;d.$dirty=!1;d.$pristine=!0;d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Pa);c(!0);d.$addControl=function(a){a.$name&&!d.hasOwnProperty(a.$name)&&(d[a.$name]=a)};d.$removeControl=function(a){a.$name&&d[a.$name]===a&&delete d[a.$name];m(h,function(b,c){d.$setValidity(c,!0,a)})};d.$setValidity=function(a,b,j){var k=h[a];if(b){if(k&&(za(k,j),!k.length)){g--;if(!g)c(b),d.$valid=!0,d.$invalid=
!1;h[a]=!1;c(!0,a);e.$setValidity(a,!0,d)}}else{g||c(b);if(k){if(Ua(k,j)!=-1)return}else h[a]=k=[],g++,c(!1,a),e.$setValidity(a,!1,d);k.push(j);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Pa).addClass(Xb);d.$dirty=!0;d.$pristine=!1}}function S(b){return v(b)||b===""||b===null||b!==b}function Qa(b,a,c,d,e,g){var h=function(){var c=Q(a.val());d.$viewValue!==c&&b.$apply(function(){d.$setViewValue(c)})};if(e.hasEvent("input"))a.bind("input",h);else{var f;a.bind("keydown",function(a){a=
a.keyCode;a===91||15<a&&a<19||37<=a&&a<=40||f||(f=g.defer(function(){h();f=null}))});a.bind("change",h)}d.$render=function(){a.val(S(d.$viewValue)?"":d.$viewValue)};var i=c.ngPattern,j=function(a,b){return S(b)||a.test(b)?(d.$setValidity("pattern",!0),b):(d.$setValidity("pattern",!1),p)};i&&(i.match(/^\/(.*)\/$/)?(i=RegExp(i.substr(1,i.length-2)),e=function(a){return j(i,a)}):e=function(a){var c=b.$eval(i);if(!c||!c.test)throw new z("Expected "+i+" to be a RegExp but was "+c);return j(c,a)},d.$formatters.push(e),
d.$parsers.push(e));if(c.ngMinlength){var k=I(c.ngMinlength),e=function(a){return!S(a)&&a.length<k?(d.$setValidity("minlength",!1),p):(d.$setValidity("minlength",!0),a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var l=I(c.ngMaxlength),c=function(a){return!S(a)&&a.length>l?(d.$setValidity("maxlength",!1),p):(d.$setValidity("maxlength",!0),a)};d.$parsers.push(c);d.$formatters.push(c)}}function ib(b,a){b="ngClass"+b;return R(function(c,d,e){c.$watch(e[b],function(b,e){if(a===!0||c.$index%
2===a)e&&b!==e&&(J(e)&&!K(e)&&(e=Ta(e,function(a,b){if(a)return b})),d.removeClass(K(e)?e.join(" "):e)),J(b)&&!K(b)&&(b=Ta(b,function(a,b){if(a)return b})),b&&d.addClass(K(b)?b.join(" "):b)},!0)})}var C=function(b){return G(b)?b.toLowerCase():b},la=function(b){return G(b)?b.toUpperCase():b},z=T.Error,Y=I((/msie (\d+)/.exec(C(navigator.userAgent))||[])[1]),u,ha,ga=[].slice,Ra=[].push,Sa=Object.prototype.toString,Yb=T.angular||(T.angular={}),sa,Cb,X=["0","0","0"];x.$inject=[];ya.$inject=[];Cb=Y<9?function(b){b=
b.nodeName?b:b[0];return b.scopeName&&b.scopeName!="HTML"?la(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var jc=/[A-Z]/g,hd={full:"1.0.0",major:1,minor:0,dot:0,codeName:"temporal-domination"},Ba=P.cache={},Aa=P.expando="ng-"+(new Date).getTime(),nc=1,id=T.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},tb=T.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,
a,c){b.detachEvent("on"+a,c)},lc=/([\:\-\_]+(.))/g,mc=/^moz([A-Z])/,ta=P.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;this.bind("DOMContentLoaded",a);P(T).bind("load",a)},toString:function(){var b=[];m(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return b>=0?u(this[b]):u(this[this.length+b])},length:0,push:Ra,sort:[].sort,splice:[].splice},Ea={};m("multiple,selected,checked,disabled,readOnly,required".split(","),function(b){Ea[C(b)]=b});var zb={};
m("input,select,option,textarea,button,form".split(","),function(b){zb[la(b)]=!0});m({data:ub,inheritedData:Da,scope:function(b){return Da(b,"$scope")},controller:xb,injector:function(b){return Da(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Ca,css:function(b,a,c){a=qb(a);if(s(c))b.style[a]=c;else{var d;Y<=8&&(d=b.currentStyle&&b.currentStyle[a],d===""&&(d="auto"));d=d||b.style[a];Y<=8&&(d=d===""?p:d);return d}},attr:function(b,a,c){var d=C(a);if(Ea[d])if(s(c))c?(b[a]=!0,
b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||x).specified?d:p;else if(s(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),b===null?p:b},prop:function(b,a,c){if(s(c))b[a]=c;else return b[a]},text:D(Y<9?function(b,a){if(b.nodeType==1){if(v(a))return b.innerText;b.innerText=a}else{if(v(a))return b.nodeValue;b.nodeValue=a}}:function(b,a){if(v(a))return b.textContent;b.textContent=a},{$dv:""}),val:function(b,a){if(v(a))return b.value;
b.value=a},html:function(b,a){if(v(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)ra(d[c]);b.innerHTML=a}},function(b,a){P.prototype[a]=function(a,d){var e,g;if((b.length==2&&b!==Ca&&b!==xb?a:d)===p)if(J(a)){for(e=0;e<this.length;e++)if(b===ub)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}else{if(this.length)return b(this[0],a,d)}else{for(e=0;e<this.length;e++)b(this[e],a,d);return this}return b.$dv}});m({removeData:rb,dealoc:ra,bind:function a(c,d,e){var g=ba(c,"events"),
h=ba(c,"handle");g||ba(c,"events",g={});h||ba(c,"handle",h=oc(c,g));m(d.split(" "),function(d){var i=g[d];if(!i){if(d=="mouseenter"||d=="mouseleave"){var j=0;g.mouseenter=[];g.mouseleave=[];a(c,"mouseover",function(a){j++;j==1&&h(a,"mouseenter")});a(c,"mouseout",function(a){j--;j==0&&h(a,"mouseleave")})}else id(c,d,h),g[d]=[];i=g[d]}i.push(e)})},unbind:sb,replaceWith:function(a,c){var d,e=a.parentNode;ra(a);m(new P(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=
[];m(a.childNodes,function(a){a.nodeName!="#text"&&c.push(a)});return c},contents:function(a){return a.childNodes},append:function(a,c){m(new P(c),function(c){a.nodeType===1&&a.appendChild(c)})},prepend:function(a,c){if(a.nodeType===1){var d=a.firstChild;m(new P(c),function(c){d?a.insertBefore(c,d):(a.appendChild(c),d=c)})}},wrap:function(a,c){var c=u(c)[0],d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){ra(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=
a,e=a.parentNode;m(new P(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:wb,removeClass:vb,toggleClass:function(a,c,d){v(d)&&(d=!Ca(a,c));(d?wb:vb)(a,c)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){return a.nextSibling},find:function(a,c){return a.getElementsByTagName(c)},clone:cb},function(a,c){P.prototype[c]=function(c,e){for(var g,h=0;h<this.length;h++)g==p?(g=a(this[h],c,e),g!==p&&(g=u(g))):bb(g,a(this[h],c,e));return g==p?this:g}});Fa.prototype=
{put:function(a,c){this[ia(a)]=c},get:function(a){return this[ia(a)]},remove:function(a){var c=this[a=ia(a)];delete this[a];return c}};db.prototype={push:function(a,c){var d=this[a=ia(a)];d?d.push(c):this[a]=[c]},shift:function(a){var c=this[a=ia(a)];if(c)return c.length==1?(delete this[a],c[0]):c.shift()}};var qc=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,rc=/,/,sc=/^\s*(_?)(.+?)\1\s*$/,pc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Db="Non-assignable model expression: ";Bb.$inject=["$provide"];var zc=/^(x[\:\-_]|data[\:\-_])/i,
Fb=/^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,Zb=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,Gc=Zb,Gb={http:80,https:443,ftp:21};fb.prototype={$$replace:!1,absUrl:Ja("$$absUrl"),url:function(a,c){if(v(a))return this.$$url;var d=Zb.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));if(d[2]||d[1])this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:Ja("$$protocol"),host:Ja("$$host"),port:Ja("$$port"),path:Ib("$$path",function(a){return a.charAt(0)=="/"?
a:"/"+a}),search:function(a,c){if(v(a))return this.$$search;s(c)?c===null?delete this.$$search[a]:this.$$search[a]=c:this.$$search=G(a)?Xa(a):a;this.$$compose();return this},hash:Ib("$$hash",ya),replace:function(){this.$$replace=!0;return this}};Ia.prototype=xa(fb.prototype);Hb.prototype=xa(Ia.prototype);var Ka={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:x,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return(s(d)?d:0)+(s(e)?e:0)},"-":function(a,c,d,
e){d=d(a,c);e=e(a,c);return(s(d)?d:0)-(s(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"=":x,"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},
"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Kc={n:"\n",f:"\u000c",r:"\r",t:"\t",v:"\u000b","'":"'",'"':'"'},gb={},Xc=T.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw new z("This browser does not support XMLHttpRequest.");
};Pb.$inject=["$provide"];Qb.$inject=["$locale"];Sb.$inject=["$locale"];var Vb=".",gd={yyyy:O("FullYear",4),yy:O("FullYear",2,0,!0),y:O("FullYear",1),MMMM:La("Month"),MMM:La("Month",!0),MM:O("Month",2,1),M:O("Month",1,1),dd:O("Date",2),d:O("Date",1),HH:O("Hours",2),H:O("Hours",1),hh:O("Hours",2,-12),h:O("Hours",1,-12),mm:O("Minutes",2),m:O("Minutes",1),ss:O("Seconds",2),s:O("Seconds",1),EEEE:La("Day"),EEE:La("Day",!0),a:function(a,c){return a.getHours()<12?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=a.getTimezoneOffset();
return hb(a/60,2)+hb(Math.abs(a%60),2)}},fd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,ed=/^\d+$/;Rb.$inject=["$locale"];var cd=B(C),dd=B(la);Tb.$inject=["$parse"];var jd=B({restrict:"E",compile:function(a,c){c.href||c.$set("href","");return function(a,c){c.bind("click",function(a){c.attr("href")||a.preventDefault()})}}}),jb={};m(Ea,function(a,c){var d=da("ng-"+c);jb[d]=function(){return{priority:100,compile:function(){return function(a,g,h){a.$watch(h[d],function(a){h.$set(c,
!!a)})}}}}});m(["src","href"],function(a){var c=da("ng-"+a);jb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){g.$set(a,c);Y&&e.prop(a,c)})}}}});var Oa={$addControl:x,$removeControl:x,$setValidity:x,$setDirty:x};Wb.$inject=["$element","$attrs","$scope"];var Ra={name:"form",restrict:"E",controller:Wb,compile:function(){return{pre:function(a,c,d,e){d.action||c.bind("submit",function(a){a.preventDefault()});var g=c.parent().controller("form"),h=d.name||d.ngForm;h&&(a[h]=
e);g&&c.bind("$destroy",function(){g.$removeControl(e);h&&(a[h]=p);D(e,Oa)})}}}},kd=B(Ra),ld=B(D(U(Ra),{restrict:"EAC"})),md=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,nd=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/,od=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,$b={text:Qa,number:function(a,c,d,e,g,h){Qa(a,c,d,e,g,h);e.$parsers.push(function(a){var c=S(a);return c||od.test(a)?(e.$setValidity("number",!0),a===""?null:c?a:parseFloat(a)):(e.$setValidity("number",
!1),p)});e.$formatters.push(function(a){return S(a)?"":""+a});if(d.min){var f=parseFloat(d.min),a=function(a){return!S(a)&&a<f?(e.$setValidity("min",!1),p):(e.$setValidity("min",!0),a)};e.$parsers.push(a);e.$formatters.push(a)}if(d.max){var i=parseFloat(d.max),d=function(a){return!S(a)&&a>i?(e.$setValidity("max",!1),p):(e.$setValidity("max",!0),a)};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(a){return S(a)||va(a)?(e.$setValidity("number",!0),a):(e.$setValidity("number",!1),
p)})},url:function(a,c,d,e,g,h){Qa(a,c,d,e,g,h);a=function(a){return S(a)||md.test(a)?(e.$setValidity("url",!0),a):(e.$setValidity("url",!1),p)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,h){Qa(a,c,d,e,g,h);a=function(a){return S(a)||nd.test(a)?(e.$setValidity("email",!0),a):(e.$setValidity("email",!1),p)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){v(d.name)&&c.attr("name",wa());c.bind("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});
e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,h=d.ngFalseValue;G(g)||(g=!0);G(h)||(h=!1);c.bind("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$formatters.push(function(a){return a===g});e.$parsers.push(function(a){return a?g:h})},hidden:x,button:x,submit:x,reset:x},ac=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",
link:function(d,e,g,h){h&&($b[C(g.type)]||$b.text)(d,e,g,h,c,a)}}}],Na="ng-valid",Ma="ng-invalid",Pa="ng-pristine",Xb="ng-dirty",pd=["$scope","$exceptionHandler","$attrs","$element","$parse",function(a,c,d,e,g){function h(a,c){c=c?"-"+$a(c,"-"):"";e.removeClass((a?Ma:Na)+c).addClass((a?Na:Ma)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var g=g(d.ngModel),
f=g.assign;if(!f)throw z(Db+d.ngModel+" ("+oa(e)+")");this.$render=x;var i=e.inheritedData("$formController")||Oa,j=0,k=this.$error={};e.addClass(Pa);h(!0);this.$setValidity=function(a,c){if(k[a]!==!c){if(c){if(k[a]&&j--,!j)h(!0),this.$valid=!0,this.$invalid=!1}else h(!1),this.$invalid=!0,this.$valid=!1,j++;k[a]=!c;h(c,a);i.$setValidity(a,c,this)}};this.$setViewValue=function(d){this.$viewValue=d;if(this.$pristine)this.$dirty=!0,this.$pristine=!1,e.removeClass(Pa).addClass(Xb),i.$setDirty();m(this.$parsers,
function(a){d=a(d)});if(this.$modelValue!==d)this.$modelValue=d,f(a,d),m(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};var l=this;a.$watch(g,function(a){if(l.$modelValue!==a){var c=l.$formatters,d=c.length;for(l.$modelValue=a;d--;)a=c[d](a);if(l.$viewValue!==a)l.$viewValue=a,l.$render()}})}],qd=function(){return{require:["ngModel","^?form"],controller:pd,link:function(a,c,d,e){var g=e[0],h=e[1]||Oa;h.$addControl(g);c.bind("$destroy",function(){h.$removeControl(g)})}}},rd=B({require:"ngModel",
link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),bc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&(S(a)||a===!1))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required",function(){g(e.$viewValue)})}}}},sd=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||
d.ngList||",",h=function(a){var c=[];a&&m(a.split(g),function(a){a&&c.push(Q(a))});return c};e.$parsers.push(h);e.$formatters.push(function(a){return K(a)&&!ea(h(e.$viewValue),a)?a.join(", "):p})}}},td=/^(true|false|\d+)$/,ud=function(){return{priority:100,compile:function(a,c){return td.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,c,g){a.$watch(g.ngValue,function(a){g.$set("value",a,!1)})}}}},vd=R(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);
a.$watch(d.ngBind,function(a){c.text(a==p?"":a)})}),wd=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],xd=[function(){return function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBindHtmlUnsafe);a.$watch(d.ngBindHtmlUnsafe,function(a){c.html(a||"")})}}],yd=ib("",!0),zd=ib("Odd",0),Ad=ib("Even",1),Bd=R({compile:function(a,c){c.$set("ngCloak",p);a.removeClass("ng-cloak")}}),
Cd=[function(){return{scope:!0,controller:"@"}}],Dd=["$sniffer",function(a){return{priority:1E3,compile:function(){a.csp=!0}}}],cc={};m("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave".split(" "),function(a){var c=da("ng-"+a);cc[c]=["$parse",function(d){return function(e,g,h){var f=d(h[c]);g.bind(C(a),function(a){e.$apply(function(){f(e,{$event:a})})})}}]});var Ed=R(function(a,c,d){c.bind("submit",function(){a.$apply(d.ngSubmit)})}),Fd=["$http","$templateCache",
"$anchorScroll","$compile",function(a,c,d,e){return{restrict:"ECA",terminal:!0,compile:function(g,h){var f=h.ngInclude||h.src,i=h.onload||"",j=h.autoscroll;return function(g,h){var n=0,m,o=function(){m&&(m.$destroy(),m=null);h.html("")};g.$watch(f,function(f){var q=++n;f?a.get(f,{cache:c}).success(function(a){q===n&&(m&&m.$destroy(),m=g.$new(),h.html(a),e(h.contents())(m),s(j)&&(!j||g.$eval(j))&&d(),m.$emit("$includeContentLoaded"),g.$eval(i))}).error(function(){q===n&&o()}):o()})}}}}],Gd=R({compile:function(){return{pre:function(a,
c,d){a.$eval(d.ngInit)}}}}),Hd=R({terminal:!0,priority:1E3}),Id=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,h){var f=h.count,i=g.attr(h.$attr.when),j=h.offset||0,k=e.$eval(i),l={};m(k,function(a,e){l[e]=c(a.replace(d,"{{"+f+"-"+j+"}}"))});e.$watch(function(){var c=parseFloat(e.$eval(f));return isNaN(c)?"":(k[c]||(c=a.pluralCat(c-j)),l[c](e,g,!0))},function(a){g.text(a)})}}}],Jd=R({transclude:"element",priority:1E3,terminal:!0,compile:function(a,c,d){return function(a,
c,h){var f=h.ngRepeat,h=f.match(/^\s*(.+)\s+in\s+(.*)\s*$/),i,j,k;if(!h)throw z("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");f=h[1];i=h[2];h=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!h)throw z("'item' in 'item in collection' should be identifier or (key, value) but got '"+f+"'.");j=h[3]||h[1];k=h[2];var l=new db;a.$watch(function(a){var e,f,h=a.$eval(i),m=fc(h,!0),p,u=new db,A,y,v,s,z=c;if(K(h))v=h||[];else{v=[];for(A in h)h.hasOwnProperty(A)&&A.charAt(0)!=
"$"&&v.push(A);v.sort()}e=0;for(f=v.length;e<f;e++){A=h===v?e:v[e];y=h[A];if(s=l.shift(y)){p=s.scope;u.push(y,s);if(e!==s.index)s.index=e,z.after(s.element);z=s.element}else p=a.$new();p[j]=y;k&&(p[k]=A);p.$index=e;p.$first=e===0;p.$last=e===m-1;p.$middle=!(p.$first||p.$last);s||d(p,function(a){z.after(a);s={scope:p,element:z=a,index:e};u.push(y,s)})}for(A in l)if(l.hasOwnProperty(A))for(v=l[A];v.length;)y=v.pop(),y.element.remove(),y.scope.$destroy();l=u})}}}),Kd=R(function(a,c,d){a.$watch(d.ngShow,
function(a){c.css("display",Wa(a)?"":"none")})}),Ld=R(function(a,c,d){a.$watch(d.ngHide,function(a){c.css("display",Wa(a)?"none":"")})}),Md=R(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&m(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Nd=B({restrict:"EA",compile:function(a,c){var d=c.ngSwitch||c.on,e={};a.data("ng-switch",e);return function(a,h){var f,i,j;a.$watch(d,function(d){i&&(j.$destroy(),i.remove(),i=j=null);if(f=e["!"+d]||e["?"])a.$eval(c.change),j=a.$new(),f(j,function(a){i=
a;h.append(a)})})}}}),Od=R({transclude:"element",priority:500,compile:function(a,c,d){a=a.inheritedData("ng-switch");pa(a);a["!"+c.ngSwitchWhen]=d}}),Pd=R({transclude:"element",priority:500,compile:function(a,c,d){a=a.inheritedData("ng-switch");pa(a);a["?"]=d}}),Qd=R({controller:["$transclude","$element",function(a,c){a(function(a){c.append(a)})}]}),Rd=["$http","$templateCache","$route","$anchorScroll","$compile","$controller",function(a,c,d,e,g,h){return{restrict:"ECA",terminal:!0,link:function(a,
c,j){function k(){var j=d.current&&d.current.locals,k=j&&j.$template;if(k){c.html(k);l&&(l.$destroy(),l=null);var k=g(c.contents()),m=d.current;l=m.scope=a.$new();if(m.controller)j.$scope=l,j=h(m.controller,j),c.contents().data("$ngControllerController",j);k(l);l.$emit("$viewContentLoaded");l.$eval(n);e()}else c.html(""),l&&(l.$destroy(),l=null)}var l,n=j.onload||"";a.$on("$routeChangeSuccess",k);k()}}}],Sd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){d.type==
"text/ng-template"&&a.put(d.id,c[0].text)}}}],Td=B({terminal:!0}),Ud=["$compile","$parse",function(a,c){var d=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,e={$setViewValue:x};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var i=this,j={},k=e,l;i.databound=d.ngModel;i.init=function(a,c,d){k=a;l=d};i.addOption=function(c){j[c]=!0;k.$viewValue==
c&&(a.val(c),l.parent()&&l.remove())};i.removeOption=function(a){this.hasOption(a)&&(delete j[a],k.$viewValue==a&&this.renderUnknownOption(a))};i.renderUnknownOption=function(c){c="? "+ia(c)+" ?";l.val(c);a.prepend(l);a.val(c);l.prop("selected",!0)};i.hasOption=function(a){return j.hasOwnProperty(a)};c.$on("$destroy",function(){i.renderUnknownOption=x})}],link:function(e,h,f,i){function j(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(y.parent()&&y.remove(),c.val(a),a===""&&t.prop("selected",
!0)):v(a)&&t?c.val(""):e.renderUnknownOption(a)};c.bind("change",function(){a.$apply(function(){y.parent()&&y.remove();d.$setViewValue(c.val())})})}function k(a,c,d){var e;d.$render=function(){var a=new Fa(d.$viewValue);m(c.children(),function(c){c.selected=s(a.get(c.value))})};a.$watch(function(){ea(e,d.$viewValue)||(e=U(d.$viewValue),d.$render())});c.bind("change",function(){a.$apply(function(){var a=[];m(c.children(),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function l(e,
f,g){function i(){var a={"":[]},c=[""],d,h,s,u,t;s=g.$modelValue;u=r(e)||[];var y=l?kb(u):u,z,w,x;w={};t=!1;var B,C;if(o)t=new Fa(s);else if(s===null||q)a[""].push({selected:s===null,id:"",label:""}),t=!0;for(x=0;z=y.length,x<z;x++){w[k]=u[l?w[l]=y[x]:x];d=m(e,w)||"";if(!(h=a[d]))h=a[d]=[],c.push(d);o?d=t.remove(n(e,w))!=p:(d=s===n(e,w),t=t||d);h.push({id:l?y[x]:x,label:j(e,w)||"",selected:d})}!o&&!t&&a[""].unshift({id:"?",label:"",selected:!0});w=0;for(y=c.length;w<y;w++){d=c[w];h=a[d];if(v.length<=
w)s={element:A.clone().attr("label",d),label:h.label},u=[s],v.push(u),f.append(s.element);else if(u=v[w],s=u[0],s.label!=d)s.element.attr("label",s.label=d);B=null;x=0;for(z=h.length;x<z;x++)if(d=h[x],t=u[x+1]){B=t.element;if(t.label!==d.label)B.text(t.label=d.label);if(t.id!==d.id)B.val(t.id=d.id);if(t.element.selected!==d.selected)B.prop("selected",t.selected=d.selected)}else d.id===""&&q?C=q:(C=D.clone()).val(d.id).attr("selected",d.selected).text(d.label),u.push({element:C,label:d.label,id:d.id,
selected:d.selected}),B?B.after(C):s.element.append(C),B=C;for(x++;u.length>x;)u.pop().element.remove()}for(;v.length>w;)v.pop()[0].element.remove()}var h;if(!(h=w.match(d)))throw z("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+w+"'.");var j=c(h[2]||h[1]),k=h[4]||h[6],l=h[5],m=c(h[3]||""),n=c(h[2]?h[1]:k),r=c(h[7]),v=[[{element:f,label:""}]];q&&(a(q)(e),q.removeClass("ng-scope"),q.remove());f.html("");f.bind("change",function(){e.$apply(function(){var a,
c=r(e)||[],d={},h,i,j,m,q,s;if(o){i=[];m=0;for(s=v.length;m<s;m++){a=v[m];j=1;for(q=a.length;j<q;j++)if((h=a[j].element)[0].selected)h=h.val(),l&&(d[l]=h),d[k]=c[h],i.push(n(e,d))}}else h=f.val(),h=="?"?i=p:h==""?i=null:(d[k]=c[h],l&&(d[l]=h),i=n(e,d));g.$setViewValue(i)})});g.$render=i;e.$watch(i)}if(i[1]){for(var n=i[0],r=i[1],o=f.multiple,w=f.ngOptions,q=!1,t,D=u($.createElement("option")),A=u($.createElement("optgroup")),y=D.clone(),i=0,x=h.children(),B=x.length;i<B;i++)if(x[i].value==""){t=q=
x.eq(i);break}n.init(r,q,y);if(o&&(f.required||f.ngRequired)){var C=function(a){r.$setValidity("required",!f.required||a&&a.length);return a};r.$parsers.push(C);r.$formatters.unshift(C);f.$observe("required",function(){C(r.$viewValue)})}w?l(e,h,r):o?k(e,h,r):j(e,h,r,n)}}}}],Vd=["$interpolate",function(a){var c={addOption:x,removeOption:x};return{restrict:"E",priority:100,require:"^select",compile:function(d,e){if(v(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e,j){j.databound?
d.prop("selected",!1):j=c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&j.removeOption(c);j.addOption(a)}):j.addOption(e.value);d.bind("$destroy",function(){j.removeOption(e.value)})}}}}],Wd=B({restrict:"E",terminal:!0});(ha=T.jQuery)?(u=ha,D(ha.fn,{scope:ta.scope,controller:ta.controller,injector:ta.injector,inheritedData:ta.inheritedData}),ab("remove",!0),ab("empty"),ab("html")):u=P;Yb.element=u;(function(a){D(a,{bootstrap:ob,copy:U,extend:D,equals:ea,element:u,forEach:m,injector:pb,noop:x,
bind:Va,toJson:aa,fromJson:mb,identity:ya,isUndefined:v,isDefined:s,isString:G,isFunction:M,isObject:J,isNumber:va,isElement:ec,isArray:K,version:hd,isDate:ma,lowercase:C,uppercase:la,callbacks:{counter:0}});sa=kc(T);try{sa("ngLocale")}catch(c){sa("ngLocale",[]).provider("$locale",Yc)}sa("ng",["ngLocale"],["$provide",function(a){a.provider("$compile",Bb).directive({a:jd,input:ac,textarea:ac,form:kd,script:Sd,select:Ud,style:Wd,option:Vd,ngBind:vd,ngBindHtmlUnsafe:xd,ngBindTemplate:wd,ngClass:yd,ngClassEven:Ad,
ngClassOdd:zd,ngCsp:Dd,ngCloak:Bd,ngController:Cd,ngForm:ld,ngHide:Ld,ngInclude:Fd,ngInit:Gd,ngNonBindable:Hd,ngPluralize:Id,ngRepeat:Jd,ngShow:Kd,ngSubmit:Ed,ngStyle:Md,ngSwitch:Nd,ngSwitchWhen:Od,ngSwitchDefault:Pd,ngOptions:Td,ngView:Rd,ngTransclude:Qd,ngModel:qd,ngList:sd,ngChange:rd,required:bc,ngRequired:bc,ngValue:ud}).directive(jb).directive(cc);a.provider({$anchorScroll:tc,$browser:vc,$cacheFactory:wc,$controller:Ac,$document:Bc,$exceptionHandler:Cc,$filter:Pb,$interpolate:Dc,$http:Uc,$httpBackend:Vc,
$location:Hc,$log:Ic,$parse:Mc,$route:Pc,$routeParams:Qc,$rootScope:Rc,$q:Nc,$sniffer:Sc,$templateCache:xc,$timeout:Zc,$window:Tc})}])})(Yb);u($).ready(function(){ic($,ob)})})(window,document);angular.element(document).find("head").append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\\:form{display:block;}</style>');
......@@ -459,7 +459,7 @@ persistence.get = function(arg1, arg2) {
that._data_obj[ref] = session.trackedObjects[that._data[ref]];
return that._data_obj[ref];
} else {
throw new Error("Property '" + ref + "' with id: " + that._data[ref] + " not fetched, either prefetch it or fetch it manually.");
throw new Error("Property '" + ref + "' of '" + meta.name + "' with id: " + that._data[ref] + " not fetched, either prefetch it or fetch it manually.");
}
});
}());
......@@ -1016,7 +1016,12 @@ persistence.get = function(arg1, arg2) {
switch(type) {
case 'DATE':
if(typeof value === 'number') {
return new Date(value * 1000);
if (value > 1000000000000) {
// it's in milliseconds
return new Date(value);
} else {
return new Date(value * 1000);
}
} else {
return null;
}
......@@ -1281,8 +1286,10 @@ persistence.get = function(arg1, arg2) {
var el = ar[i];
if(el.equals && el.equals(item)) {
ar.splice(i, 1);
return;
} else if(el === item) {
ar.splice(i, 1);
return;
}
}
}
......@@ -1627,7 +1634,7 @@ persistence.get = function(arg1, arg2) {
s += '|Order:';
for(var i = 0; i < this._orderColumns.length; i++) {
var col = this._orderColumns[i];
s += col[0] + ", " + col[1];
s += col[0] + ", " + col[1] + ", " + col[2];
}
s += '|Prefetch:';
for(var i = 0; i < this._prefetchFields.length; i++) {
......@@ -1714,12 +1721,16 @@ persistence.get = function(arg1, arg2) {
* Returns a new query collection with an ordering imposed on the collection
* @param property the property to sort on
* @param ascending should the order be ascending (= true) or descending (= false)
* @param caseSensitive should the order be case sensitive (= true) or case insensitive (= false)
* note: using case insensitive ordering for anything other than TEXT fields yields
* undefinded behavior
* @return the query collection with imposed ordering
*/
QueryCollection.prototype.order = function (property, ascending) {
QueryCollection.prototype.order = function (property, ascending, caseSensitive) {
ascending = ascending === undefined ? true : ascending;
caseSensitive = caseSensitive === undefined ? true : caseSensitive;
var c = this.clone();
c._orderColumns.push( [ property, ascending ]);
c._orderColumns.push( [ property, ascending, caseSensitive ]);
return this._session.uniqueQueryCollection(c);
};
......@@ -2055,8 +2066,13 @@ persistence.get = function(arg1, arg2) {
for(var i = 0; i < that._orderColumns.length; i++) {
var col = that._orderColumns[i][0];
var asc = that._orderColumns[i][1];
var sens = that._orderColumns[i][2];
var aVal = persistence.get(a, col);
var bVal = persistence.get(b, col);
if (!sens) {
aVal = aVal.toLowerCase();
bVal = bVal.toLowerCase();
}
if(aVal < bVal) {
return asc ? -1 : 1;
} else if(aVal > bVal) {
......
......@@ -6,7 +6,7 @@ var defaultTypeMapper = {
* SQL type for ids
*/
idType: "VARCHAR(32)",
/**
* SQL type for class names (used by mixins)
*/
......@@ -44,7 +44,12 @@ var defaultTypeMapper = {
switch (type) {
case 'DATE':
// SQL is in seconds and JS in miliseconds
return new Date(parseInt(val, 10) * 1000);
if (val > 1000000000000) {
// usually in seconds, but sometimes it's milliseconds
return new Date(parseInt(val, 10));
} else {
return new Date(parseInt(val, 10) * 1000);
}
case 'BOOL':
return val === 1 || val === '1';
break;
......@@ -124,7 +129,7 @@ function config(persistence, dialect) {
/**
* Synchronize the data model with the database, creates table that had not
* been defined before
*
*
* @param tx
* transaction object to use (optional)
* @param callback
......@@ -147,7 +152,7 @@ function config(persistence, dialect) {
return;
}
var queries = [], meta, colDefs, otherMeta, tableName;
var tm = persistence.typeMapper;
var entityMeta = persistence.getEntityMeta();
for (var entityName in entityMeta) {
......@@ -178,10 +183,10 @@ function config(persistence, dialect) {
var otherMeta = meta.hasMany[rel].type.meta;
var inv = meta.hasMany[rel].inverseProperty;
// following test ensures that mixin mtm tables get created with the mixin itself
// it seems superfluous because mixin will be processed before entitites that use it
// it seems superfluous because mixin will be processed before entitites that use it
// but better be safe than sorry.
if (otherMeta.hasMany[inv].type.meta != meta)
continue;
continue;
var p1 = meta.name + "_" + rel;
var p2 = otherMeta.name + "_" + inv;
queries.push([dialect.createIndex(tableName, [p1]), null]);
......@@ -219,7 +224,7 @@ function config(persistence, dialect) {
/**
* Persists all changes to the database transaction
*
*
* @param tx
* transaction to use
* @param callback
......@@ -276,7 +281,7 @@ function config(persistence, dialect) {
}
});
};
/**
* Remove all tables in the database (as defined by the model)
*/
......@@ -316,7 +321,7 @@ function config(persistence, dialect) {
} else {
cb();
}
function cb(result, err) {
session.clean();
persistence.generatedTables = {};
......@@ -372,7 +377,7 @@ function config(persistence, dialect) {
obj._dirtyProperties[p] = true;
}
}
}
}
for ( var p in obj._dirtyProperties) {
if (obj._dirtyProperties.hasOwnProperty(p)) {
properties.push("`" + p + "`");
......@@ -389,7 +394,7 @@ function config(persistence, dialect) {
}
}
executeQueriesSeq(tx, additionalQueries, function() {
if (properties.length === 0) { // Nothing changed
if (!obj._new && properties.length === 0) { // Nothing changed and not new
if(callback) callback();
return;
}
......@@ -455,7 +460,7 @@ function config(persistence, dialect) {
/////////////////////////// QueryCollection patches to work in SQL environment
/**
* Function called when session is flushed, returns list of SQL queries to execute
* Function called when session is flushed, returns list of SQL queries to execute
* (as [query, arg] tuples)
*/
persistence.QueryCollection.prototype.persistQueries = function() { return []; };
......@@ -568,7 +573,7 @@ function config(persistence, dialect) {
/**
* Asynchronous call to actually fetch the items in the collection
* @param tx transaction to use
* @param callback function to be called taking an array with
* @param callback function to be called taking an array with
* result objects as argument
*/
persistence.DbQueryCollection.prototype.list = function (tx, callback) {
......@@ -590,7 +595,7 @@ function config(persistence, dialect) {
var entityName = this._entityName;
var meta = persistence.getMeta(entityName);
var tm = persistence.typeMapper;
// handles mixin case -- this logic is generic and could be in persistence.
if (meta.isMixin) {
var result = [];
......@@ -609,7 +614,7 @@ function config(persistence, dialect) {
query.list(null, callback);
});
return;
}
}
function selectAll (meta, tableAlias, prefix) {
var selectFields = [ tm.inIdVar("`" + tableAlias + "`.id") + " AS " + prefix + "id" ];
......@@ -670,7 +675,7 @@ function config(persistence, dialect) {
sql += " ORDER BY "
+ this._orderColumns.map(
function (c) {
return "`" + mainPrefix + c[0] + "` "
return (c[2] ? "`" : "LOWER(`") + mainPrefix + c[0] + (c[2] ? "` " : "`) ")
+ (c[1] ? "ASC" : "DESC");
}).join(", ");
}
......@@ -705,7 +710,7 @@ function config(persistence, dialect) {
};
/**
* Asynchronous call to remove all the items in the collection.
* Asynchronous call to remove all the items in the collection.
* Note: does not only remove the items from the collection, but
* the items themselves.
* @param tx transaction to use
......@@ -726,7 +731,7 @@ function config(persistence, dialect) {
that.destroyAll(tx, callback);
});
return;
}
}
var entityName = this._entityName;
var meta = persistence.getMeta(entityName);
var tm = persistence.typeMapper;
......@@ -739,7 +744,7 @@ function config(persistence, dialect) {
query.destroyAll(tx, callback);
}, callback);
return;
}
}
var joinSql = '';
var additionalWhereSqls = this._additionalWhereSqls.slice(0);
......@@ -789,13 +794,13 @@ function config(persistence, dialect) {
if(tx && !tx.executeSql) { // provided callback as first argument
callback = tx;
tx = null;
}
}
if(!tx) { // no transaction supplied
session.transaction(function(tx) {
that.count(tx, callback);
});
return;
}
}
var entityName = this._entityName;
var meta = persistence.getMeta(entityName);
var tm = persistence.typeMapper;
......@@ -814,7 +819,7 @@ function config(persistence, dialect) {
callback(result);
});
return;
}
}
var joinSql = '';
var additionalWhereSqls = this._additionalWhereSqls.slice(0);
......@@ -862,14 +867,14 @@ function config(persistence, dialect) {
vars.push("?");
args.push(inverseMeta.name);
}
queries.push(["INSERT INTO " + rel.tableName +
queries.push(["INSERT INTO " + rel.tableName +
" (`" + columns.join("`, `") + "`) VALUES (" + vars.join(",") + ")", args]);
}
this._localAdded = [];
// Removed
for(var i = 0; i < this._localRemoved.length; i++) {
queries.push(["DELETE FROM " + rel.tableName +
" WHERE `" + direct + "_" + this._coll + "` = " + tm.outIdVar("?") + " AND `" +
queries.push(["DELETE FROM " + rel.tableName +
" WHERE `" + direct + "_" + this._coll + "` = " + tm.outIdVar("?") + " AND `" +
inverse + '_' + rel.inverseProperty +
"` = " + tm.outIdVar("?"), [tm.entityIdToDbId(this._obj.id), tm.entityIdToDbId(this._localRemoved[i].id)]]);
}
......
angular.service('persistencejs', function() {
persistence.store.websql.config(persistence, 'todo-angular-persistence', 'todo database', 5*1024*1024);
todomvc.factory('persistencejs', function(){
persistence.store.websql.config(persistence, 'todos-angularjs', 'todo database', 5*1024*1024);
var Todo = persistence.define('todo', {
content: 'TEXT',
done: 'BOOL'
title: 'TEXT',
completed: 'BOOL'
});
persistence.schemaSync();
return {
add: function(item){
var t = new Todo();
t.content = item;
t.done = false;
t.title = item;
t.completed = false;
persistence.add(t);
persistence.flush();
},
edit: function(startContent, endContent){
Todo.all().filter('content','=',startContent).one(function(item){
item.content = endContent;
persistence.flush();
edit: function(oldTitle, newTitle){
Todo.all().filter('title','=',oldTitle).one(function(item){
if(item){
item.title = newTitle;
persistence.flush();
}
});
},
changeStatus: function(item){
Todo.all().filter('content','=',item.content).one(function(todo){
todo.done = item.done;
Todo.all().filter('title','=',item.title).one(function(todo){
todo.completed = item.completed;
persistence.flush();
});
},
clearCompletedItems: function(){
Todo.all().filter('done','=',true).destroyAll();
Todo.all().filter('completed','=',true).destroyAll();
},
remove: function(item){
Todo.all().filter('content','=',item.content).destroyAll();
Todo.all().filter('title','=',item.title).destroyAll();
},
fetchAll: function(controller){
......@@ -42,8 +44,8 @@ angular.service('persistencejs', function() {
var todos = [];
items.forEach(function(item){
todos.push({
content: item.content,
done: item.done,
title: item.title,
completed: item.completed,
editing: false
});
if(--itemCount == 0){
......
/*
AngularJS v0.10.0
(c) 2010-2011 AngularJS http://angularjs.org
License: MIT
*/
'use strict';(function(x,F,A){function k(a,b,c){var d;if(a)if(q(a))for(d in a)d!="prototype"&&d!=mc&&d!=nc&&a.hasOwnProperty(d)&&b.call(c,a[d],d);else if(a.forEach&&a.forEach!==k)a.forEach(b,c);else if(I(a)&&oa(a.length))for(d=0;d<a.length;d++)b.call(c,a[d],d);else for(d in a)b.call(c,a[d],d);return a}function sb(a,b,c){var d=[],e;for(e in a)d.push(e);d.sort();for(e=0;e<d.length;e++)b.call(c,a[d[e]],d[e]);return d}function tb(a){a instanceof z&&(a.stack?a=a.message&&a.stack.indexOf(a.message)===-1?
"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function Oa(){for(var a=S.length,b;a;){a--;b=S[a].charCodeAt(0);if(b==57)return S[a]="A",S.join("");if(b==90)S[a]="0";else return S[a]=String.fromCharCode(b+1),S.join("")}S.unshift("0");return S.join("")}function s(a){k(arguments,function(b){b!==a&&k(b,function(b,d){a[d]=b})});return a}function Pa(a,b){return s(new (s(function(){},{prototype:a})),b)}function p(){}function da(a){return a}function Qa(a){return function(){return a}}
function T(a,b,c){var d;return a[b]||(d=a[b]=function(a,b,g){a=(c||da)(a);v(b)&&(d[a]=s(b,g||{}));return d[a]})}function y(a){return typeof a==pa}function v(a){return typeof a!=pa}function I(a){return a!=null&&typeof a==ub}function u(a){return typeof a==oc}function oa(a){return typeof a==pc}function qa(a){return a instanceof Date}function U(a){return a instanceof Array}function q(a){return typeof a=="function"}function ea(a){return u(a)?a.replace(/^\s*/,"").replace(/\s*$/,""):a}function Ra(a){return a&&
(a.nodeName||a.bind&&a.find)}function Z(a){var b={},a=a.split(","),c;for(c=0;c<a.length;c++)b[a[c]]=!0;return b}function Sa(a,b){this.html=a;this.get=H(b)=="unsafe"?Qa(a):function(){var b=[];vb(a,wb(b));return b.join("")}}function qc(a,b,c){var d=[];k(a,function(a,f,g){d.push(b.call(c,a,f,g))});return d}function xb(a,b){var c=0,d;if(U(a)||u(a))return a.length;else if(I(a))for(d in a)(!b||a.hasOwnProperty(d))&&c++;return c}function yb(a,b){for(var c=0;c<a.length;c++)if(b===a[c])return!0;return!1}function ya(a,
b){for(var c=0;c<a.length;c++)if(b===a[c])return c;return-1}function rc(a){if(a)switch(a.nodeName){case "OPTION":case "PRE":case "TITLE":return!0}return!1}function C(a,b){if(b)if(U(a)){for(;b.length;)b.pop();for(var c=0;c<a.length;c++)b.push(C(a[c]))}else for(c in k(b,function(a,c){delete b[c]}),a)b[c]=C(a[c]);else(b=a)&&(U(a)?b=C(a,[]):qa(a)?b=new Date(a.getTime()):I(a)&&(b=C(a,{})));return b}function $(a,b){if(a===b)return!0;if(a===null||b===null)return!1;var c=typeof a,d;if(c==typeof b&&c=="object")if(a instanceof
Array){if((c=a.length)==b.length){for(d=0;d<c;d++)if(!$(a[d],b[d]))return!1;return!0}}else{c={};for(d in a){if(d.charAt(0)!=="$"&&!q(a[d])&&!$(a[d],b[d]))return!1;c[d]=!0}for(d in b)if(!c[d]&&d.charAt(0)!=="$"&&!q(b[d]))return!1;return!0}return!1}function sc(a){return(a=a&&a[0]&&a[0].nodeName)&&a.charAt(0)!="#"&&!yb(["TR","COL","COLGROUP","TBODY","THEAD","TFOOT"],a)}function ka(a,b,c){for(var d;!sc(a);)if(d=a.parent(),d.length)a=a.parent();else return;if(a[0].$NG_ERROR!==c)(a[0].$NG_ERROR=c)?(a.addClass(b),
a.attr(b,c.message||c)):(a.removeClass(b),a.removeAttr(b))}function M(a,b){var c=arguments.length>2?la.call(arguments,2):[];return q(b)&&!(b instanceof RegExp)?c.length?function(){return arguments.length?b.apply(a,c.concat(la.call(arguments,0))):b.apply(a,c)}:function(){return arguments.length?b.apply(a,arguments):b.call(a)}:b}function ma(a){a&&a.length!==0?(a=H(""+a),a=!(a=="f"||a=="0"||a=="false"||a=="no"||a=="n"||a=="[]")):a=!1;return a}function zb(a){return(new Ab(Ta,Bb,B,O)).compile(a)}function Ua(a){var b=
{},c,d;k((a||"").split("&"),function(a){a&&(c=a.split("="),d=unescape(c[0]),b[d]=v(c[1])?unescape(c[1]):!0)});return b}function Cb(a){var b=[];k(a,function(a,d){b.push(escape(d)+(a===!0?"":"="+escape(a)))});return b.length?b.join("&"):""}function Va(a,b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(b?null:/%20/g,"+")}function tc(a,b){Db();for(var c=a.getElementsByTagName("script"),d,b=s({ie_compat_id:"ng-ie-compat"},b),e=0;e<
c.length;e++)if(d=(c[e].src||"").match(uc))b.base_url=d[1],b.ie_compat=d[1]+"angular-ie-compat"+(d[2]||"")+".js",s(b,Ua(d[6])),za(n(c[e]),function(a,c){/^ng:/.exec(c)&&(c=c.substring(3).replace(/-/g,"_"),b[c]=a||!0)});return b}function Db(){(Wa=x.jQuery)?(n=Wa,s(Wa.fn,{scope:Eb.scope})):n=Xa;w.element=n}function ra(a,b){if(!q(a))throw new z("Argument '"+(b||"?")+"' is "+("not a function, got "+(typeof a=="object"?a.constructor.name:typeof a)||"required"));}function Q(a,b){var c=[];Ya(c,a,b?"\n ":
null,[]);return c.join("")}function fa(a,b){function c(a){if(u(a)&&a.length===Fb)return ga.toDate(a);else(U(a)||I(a))&&k(a,function(b,d){a[d]=c(b)});return a}if(!u(a))return a;var d;try{return b&&x.JSON&&x.JSON.parse?(d=JSON.parse(a),c(d)):aa(a,!0).primary()()}catch(e){throw vc("fromJson error: ",a,e),e;}}function Ya(a,b,c,d){if(I(b)){if(b===x){a.push("WINDOW");return}if(b===F){a.push("DOCUMENT");return}if(yb(d,b)){a.push("RECURSION");return}d.push(b)}if(b===null)a.push(Aa);else if(b instanceof RegExp)a.push(ga.quoteUnicode(b.toString()));
else if(q(b))return;else if(typeof b==wc)a.push(""+b);else if(oa(b))isNaN(b)?a.push(Aa):a.push(""+b);else if(u(b))return a.push(ga.quoteUnicode(b));else if(I(b))if(U(b)){a.push("[");for(var e=b.length,f=!1,g=0;g<e;g++){var h=b[g];f&&a.push(",");!(h instanceof RegExp)&&(q(h)||y(h))?a.push(Aa):Ya(a,h,c,d);f=!0}a.push("]")}else if(Ra(b))a.push("DOM_ELEMENT");else if(qa(b))a.push(ga.quoteUnicode(w.Date.toString(b)));else{a.push("{");c&&a.push(c);e=!1;f=c?c+" ":!1;g=[];for(h in b)b.hasOwnProperty(h)&&
b[h]!==A&&g.push(h);g.sort();for(h=0;h<g.length;h++){var i=g[h],j=b[i];q(j)||(e&&(a.push(","),c&&a.push(c)),a.push(ga.quote(i)),a.push(":"),Ya(a,j,f,d),e=!0)}a.push("}")}I(b)&&d.pop()}function Za(){this.paths=[];this.children=[];this.linkFns=[];this.newScope=!1}function Ab(a,b,c,d){this.markup=a;this.attrMarkup=b;this.directives=c;this.widgets=d}function xc(a,b){var c,d=a[0].childNodes||[],e;for(c=0;c<d.length;c++){var f=e=d[c];sa(f)=="#text"||b(n(e),c)}}function za(a,b){var c,d=a[0].attributes||
[],e,f,g={};for(c=0;c<d.length;c++)e=d[c],f=e.name,e=e.value,V&&f=="href"&&(e=decodeURIComponent(a[0].getAttribute(f,2))),g[f]=e;sb(g,b)}function $a(a,b){var c=new Gb;(c.$service=Hb(c,a,b)).eager();return c}function Gb(){this.$id=Oa();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this.$destructor=p;this["this"]=this.$root=this;this.$$asyncQueue=[];this.$$listeners={}}function Ib(a,b){var c=u(a)?W(a):a;ra(c,b);return c}function Hb(a,
b,c){function d(d){if(!(d in c)){var g=b[d];if(!g)throw z("Unknown provider for '"+d+"'.");c[d]=e(a,g)}return c[d]}function e(a,b,c){for(var c=c||[],e=yc(b),j=e.length;j--;)c.unshift(d(e[j]));return b.apply(a,c)}b=b||Ba;c=c||{};a=a||{};d.invoke=e;d.eager=function(){k(b,function(a,b){a.$eager&&d(b);if(a.$creation)throw new z("Failed to register service '"+b+"': $creation property is unsupported. Use $eager:true or see release notes.");})};return d}function ab(a,b){if(a instanceof Array)return b.$inject=
a,b;else{for(var c=0,d=arguments.length-1,e=arguments[d].$inject=[];c<d;c++)e.push(arguments[c]);return arguments[d]}}function G(a,b,c,d){Ba(a,b,{$inject:c,$eager:d})}function yc(a){ra(a);if(!a.$inject){var b=a.$inject=[],c=a.toString().replace(zc,"").match(Ac);k(c[1].split(Bc),function(a){a.replace(Cc,function(a,c){b.push(c)})})}return a.$inject}function Dc(a,b){function c(a){return a.indexOf(r)!=-1}function d(){return t+1<a.length?a.charAt(t+1):!1}function e(a){return"0"<=a&&a<="9"}function f(a){return"a"<=
a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function g(a){return a=="-"||a=="+"||e(a)}function h(b,c,d){d=d||t;throw z("Lexer Error: "+b+" at column"+(v(c)?"s "+c+"-"+t+" ["+a.substring(c,d)+"]":" "+d)+" in expression ["+a+"].");}function i(){for(var b="",c=t;t<a.length;){var f=H(a.charAt(t));if(f=="."||e(f))b+=f;else{var i=d();if(f=="e"&&g(i))b+=f;else if(g(f)&&i&&e(i)&&b.charAt(b.length-1)=="e")b+=f;else if(g(f)&&(!i||!e(i))&&b.charAt(b.length-1)=="e")h("Invalid exponent");else break}t++}b*=1;o.push({index:c,
text:b,json:!0,fn:function(){return b}})}function j(){for(var b="",c=t,d;t<a.length;){d=a.charAt(t);if(d=="."||f(d)||e(d))b+=d;else break;t++}d=bb[b];o.push({index:c,text:b,json:d,fn:d||s(Lb(b),{assign:function(a,c){return Mb(a,b,c)}})})}function l(b){var c=t;t++;for(var d="",e=b,g=!1;t<a.length;){var f=a.charAt(t);e+=f;if(g)f=="u"?(f=a.substring(t+1,t+5),f.match(/[\da-f]{4}/i)||h("Invalid unicode escape [\\u"+f+"]"),t+=4,d+=String.fromCharCode(parseInt(f,16))):(g=Ec[f],d+=g?g:f),g=!1;else if(f==
"\\")g=!0;else if(f==b){t++;o.push({index:c,text:e,string:d,json:!0,fn:function(){return d.length==m?w.String.toDate(d):d}});return}else d+=f;t++}h("Unterminated quote",c)}for(var m=b?Fb:-1,o=[],D,t=0,k=[],r,K=":";t<a.length;){r=a.charAt(t);if(c("\"'"))l(r);else if(e(r)||c(".")&&e(d()))i();else if(f(r)){if(j(),"{,".indexOf(K)!=-1&&k[0]=="{"&&(D=o[o.length-1]))D.json=D.text.indexOf(".")==-1}else if(c("(){}[].,;:"))o.push({index:t,text:r,json:":[,".indexOf(K)!=-1&&c("{[")||c("}]:,")}),c("{[")&&k.unshift(r),
c("}]")&&k.shift(),t++;else if(r==" "||r=="\r"||r=="\t"||r=="\n"||r=="\u000b"||r=="\u00a0"){t++;continue}else{var L=r+d(),n=bb[r],p=bb[L];p?(o.push({index:t,text:L,fn:p}),t+=2):n?(o.push({index:t,text:r,fn:n,json:"[,:".indexOf(K)!=-1&&c("+-")}),t+=1):h("Unexpected next character ",t,t+1)}K=r}return o}function aa(a,b){function c(a){return function(){var b=a();N.length!==0&&d("is an unexpected token",N[0]);return b}}function d(b,c){throw z("Syntax Error: Token '"+c.text+"' "+b+" at column "+(c.index+
1)+" of the expression ["+a+"] starting at ["+a.substring(c.index)+"].");}function e(){if(N.length===0)throw z("Unexpected end of expression: "+a);return N[0]}function f(a,b,c,d){if(N.length>0){var e=N[0],g=e.text;if(g==a||g==b||g==c||g==d||!a&&!b&&!c&&!d)return e}return!1}function g(a,c,e,g){return(a=f(a,c,e,g))?(b&&!a.json&&d("is not valid json",a),N.shift(),a):!1}function h(a){g(a)||d("is unexpected, expecting ["+a+"]",f())}function i(a,b){return function(c){return a(c,b(c))}}function j(a,b,c){return function(d){return b(d,
a(d),c(d))}}function l(){return w(X)}function m(){for(var a=o(),b;;)if(b=g("||"))a=j(a,b.fn,o());else return a}function o(){var a=D(),b;if(b=g("&&"))a=j(a,b.fn,o());return a}function D(){var a=t(),b;if(b=g("==","!="))a=j(a,b.fn,D());return a}function t(){var a;a=k();for(var b;b=g("+","-");)a=j(a,b.fn,k());if(b=g("<",">","<=",">="))a=j(a,b.fn,t());return a}function k(){for(var a=r(),b;b=g("*","/","%");)a=j(a,b.fn,r());return a}function r(){var a;return g("+")?n():(a=g("-"))?j(u,a.fn,r()):(a=g("!"))?
i(a.fn,r()):n()}function n(){var a;if(g("("))a=cb(),h(")");else if(g("["))a=L();else if(g("{"))a=ha();else{var b=g();(a=b.fn)||d("not a primary expression",b)}for(;b=g("(","[",".");)b.text==="("?a=Kb(a):b.text==="["?a=v(a):b.text==="."?a=Ca(a):d("IMPOSSIBLE");return a}function L(){var a=[];if(e().text!="]"){do a.push(ba());while(g(","))}h("]");return function(b){for(var c=[],d=0;d<a.length;d++)c.push(a[d](b));return c}}function ha(){var a=[];if(e().text!="}"){do{var b=g(),b=b.string||b.text;h(":");
var c=ba();a.push({key:b,value:c})}while(g(","))}h("}");return function(b){for(var c={},d=0;d<a.length;d++){var e=a[d],g=e.value(b);c[e.key]=g}return c}}var u=Qa(0),N=Dc(a,b),ba=function(){var b=m(),c,e;return(e=g("="))?(b.assign||d("implies assignment but ["+a.substring(0,e.index)+"] can not be assigned to",e),c=m(),function(a){return b.assign(a,c(a))}):b},Jb=m,Kb=function(a){var b=[];if(e().text!=")"){do b.push(ba());while(g(","))}h(")");return function(c){for(var d=[],e=0;e<b.length;e++)d.push(b[e](c));
e=a(c)||p;return e.apply?e.apply(c,d):e(d[0],d[1],d[2],d[3],d[4])}},Ca=function(a){var b=g().text,c=Lb(b);return s(function(b){return c(a(b))},{assign:function(c,d){return Mb(a(c),b,d)}})},v=function(a){var b=ba();h("]");return s(function(c){var d=a(c),c=b(c);return d?d[c]:A},{assign:function(c,d){return a(c)[b(c)]=d}})},cb=function(){for(var a=ba(),b;;)if(b=g("|"))a=j(a,b.fn,l());else return a},x=function(a){for(var b=g(),c=b.text.split("."),e,f=0;f<c.length;f++)e=c[f],a&&(a=a[e]);q(a)||d("should be a function",
b);return a},w=function(a){for(var b=x(a),c=[];;)if(g(":"))c.push(ba());else{var d=function(a,d){for(var e=[d],g=0;g<c.length;g++)e.push(c[g](a));return b.apply(a,e)};return function(){return d}}};b&&(ba=m,Kb=Ca=v=Jb=cb=x=w=function(){d("is not valid json",{text:a,index:0})});return{assignable:c(Jb),primary:c(n),statements:c(function(){for(var a=[];;)if(N.length>0&&!f("}",")",";","]")&&a.push(cb()),!g(";"))return a.length==1?a[0]:function(b){for(var c,d=0;d<a.length;d++){var e=a[d];e&&(c=e(b))}return c}}),
validator:c(function(){return w(db)}),formatter:c(function(){function a(b){return function(a,c){for(var d=[c],g=0;g<e.length;g++)d.push(e[g](a));return b.apply(a,d)}}var b=g(),c=ia[b.text],e=[];for(c||d("is not a valid formatter.",b);;)if(b=g(":"))e.push(ba());else return Qa({format:a(c.format),parse:a(c.parse)})}),filter:c(l)}}function Mb(a,b,c){for(var b=b.split("."),d=0;b.length>1;d++){var e=b.shift(),f=a[e];f||(f={},a[e]=f);a=f}return a[b.shift()]=c}function Da(a,b,c){if(!b)return a;for(var b=
b.split("."),d,e=a,f=b.length,g=0;g<f;g++)if(d=b[g],a&&(a=(e=a)[d]),y(a)&&d.charAt(0)=="$"){var h=ca.typeOf(e);if(d=(h=w[h.charAt(0).toUpperCase()+h.substring(1)])?h[[d.substring(1)]]:Fc)return M(e,d,e)}return!c&&q(a)?M(e,a):a}function Lb(a){var b=Nb[a];if(b)return b;var c="var l, fn, t;\n";k(a.split("."),function(a){a=Ob[a]?'["'+a+'"]':"."+a;c+="if(!s) return s;\nl=s;\ns=s"+a+';\nif(typeof s=="function" && !(s instanceof RegExp)) s = function(){ return l'+a+".apply(l, arguments); };\n";a.charAt(1)==
"$"&&(a=a.substr(2),c+='if(!s) {\n t = angular.Global.typeOf(l);\n fn = (angular[t.charAt(0).toUpperCase() + t.substring(1)]||{})["'+a+'"];\n if (fn) s = function(){ return fn.apply(l, [l].concat(Array.prototype.slice.call(arguments, 0))); };\n}\n')});c+="return s;";b=Function("s",c);b.toString=function(){return c};return Nb[a]=b}function W(a){if(q(a))return a;var b=Pb[a];b||(b=Pb[a]=aa(a).statements());return b}function Qb(a,b){this.template=a+="#";this.defaults=b||{};var c=this.urlParams={};k(a.split(/\W/),
function(b){b&&a.match(RegExp(":"+b+"\\W"))&&(c[b]=!0)})}function Ea(a){this.xhr=a}function Gc(a,b,c,d,e){function f(a){try{a.apply(null,la.call(arguments,1))}finally{if(ta--,ta===0)for(;r.length;)try{r.pop()()}catch(b){e.error(b)}}}function g(a,b){(function Ca(){k(K,function(a){a()});L=b(Ca,a)})()}var h=this,i=b[0],j=a.location,l=a.setTimeout,m=a.clearTimeout,o={},D;h.isMock=!1;var t=0,ta=0,r=[];h.xhr=function(b,e,g,i,j){ta++;if(H(b)=="json"){var m=("angular_"+Math.random()+"_"+t++).replace(/\d\./,
"");a[m]=function(b){a[m].data=b};var o=h.addJs(e.replace("JSON_CALLBACK",m),null,function(){a[m].data?f(i,200,a[m].data):f(i);delete a[m];c[0].removeChild(o)})}else{var l=new d;l.open(b,e,!0);k(j,function(a,b){a&&l.setRequestHeader(b,a)});l.onreadystatechange=function(){l.readyState==4&&f(i,l.status==1223?204:l.status||200,l.responseText)};l.send(g||"")}};h.notifyWhenNoOutstandingRequests=function(a){k(K,function(a){a()});ta===0?a():r.push(a)};var K=[],L;h.addPollFn=function(a){y(L)&&g(100,l);K.push(a);
return a};h.setUrl=function(a){var b=D;b.match(/#/)||(b+="#");a.match(/#/)||(a+="#");if(b!=a)j.href=a};h.getUrl=function(){return D=j.href};h.onHashChange=function(b){var c=a.document.documentMode;if("onhashchange"in a&&(y(c)||c>=8))n(a).bind("hashchange",b);else{var d=h.getUrl();h.addPollFn(function(){d!=h.getUrl()&&(b(),d=h.getUrl())})}return b};var ha={},s="";h.cookies=function(a,b){var c,d,g,f;if(a)if(b===A)i.cookie=escape(a)+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(u(b))i.cookie=escape(a)+
"="+escape(b),c=a.length+b.length+1,c>4096&&e.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+c+" > 4096 bytes)!"),ha.length>20&&e.warn("Cookie '"+a+"' possibly not set or overflowed because too many cookies were already set ("+ha.length+" > 20 )")}else{if(i.cookie!==s){s=i.cookie;c=s.split("; ");ha={};for(g=0;g<c.length;g++)d=c[g],f=d.indexOf("="),f>0&&(ha[unescape(d.substring(0,f))]=unescape(d.substring(f+1)))}return ha}};h.defer=function(a,b){var c;ta++;c=l(function(){delete o[c];
f(a)},b||0);o[c]=!0;return c};h.defer.cancel=function(a){if(o[a])return delete o[a],m(a),f(p),!0};var N=p;h.hover=function(a){N=a};h.bind=function(){b.bind("mouseover",function(a){N(n(V?a.srcElement:a.target),!0);return!0});b.bind("mouseleave mouseout click dblclick keypress keyup",function(a){N(n(a.target),!1);return!0})};h.addCss=function(a){var b=n(i.createElement("link"));b.attr("rel","stylesheet");b.attr("type","text/css");b.attr("href",a);c.append(b)};h.addJs=function(a,b,d){var e=i.createElement("script");
e.type="text/javascript";e.src=a;if(b)e.id=b;if(V)e.onreadystatechange=function(){/loaded|complete/.test(e.readyState)&&d&&d()};else if(d)e.onload=e.onerror=d;c[0].appendChild(e);return e}}function vb(a,b){function c(a,c,e,f){c=H(c);if(Rb[c])for(;g.last()&&Sb[g.last()];)d("",g.last());Tb[c]&&g.last()==c&&d("",c);(f=Ub[c]||!!f)||g.push(c);var h={};e.replace(Hc,function(a,b,c,d,e){h[b]=eb(c||d||e||"")});b.start&&b.start(c,h,f)}function d(a,c){var d=0,e;if(c=H(c))for(d=g.length-1;d>=0;d--)if(g[d]==c)break;
if(d>=0){for(e=g.length-1;e>=d;e--)b.end&&b.end(g[e]);g.length=d}}var e,f,g=[],h=a;for(g.last=function(){return g[g.length-1]};a;){f=!0;if(!g.last()||!Vb[g.last()]){if(a.indexOf("<\!--")===0)e=a.indexOf("--\>"),e>=0&&(b.comment&&b.comment(a.substring(4,e)),a=a.substring(e+3),f=!1);else if(Ic.test(a)){if(e=a.match(Wb))a=a.substring(e[0].length),e[0].replace(Wb,d),f=!1}else if(Jc.test(a)&&(e=a.match(Xb)))a=a.substring(e[0].length),e[0].replace(Xb,c),f=!1;f&&(e=a.indexOf("<"),f=e<0?a:a.substring(0,e),
a=e<0?"":a.substring(e),b.chars&&b.chars(eb(f)))}else a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+g.last()+"[^>]*>","i"),function(a,c){c=c.replace(Kc,"$1").replace(Lc,"$1");b.chars&&b.chars(eb(c));return""}),d("",g.last());if(a==h)throw"Parse Error: "+a;h=a}d()}function eb(a){fb.innerHTML=a.replace(/</g,"&lt;");return fb.innerText||fb.textContent||""}function Yb(a){return a.replace(/&/g,"&amp;").replace(Mc,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wb(a){var b=
!1,c=M(a,a.push);return{start:function(a,e,f){a=H(a);!b&&Vb[a]&&(b=a);!b&&Zb[a]==!0&&(c("<"),c(a),k(e,function(a,b){var d=H(b);if(Nc[d]==!0&&($b[d]!==!0||a.match(Oc)))c(" "),c(b),c('="'),c(Yb(a)),c('"')}),c(f?"/>":">"))},end:function(a){a=H(a);!b&&Zb[a]==!0&&(c("</"),c(a),c(">"));a==b&&(b=!1)},chars:function(a){b||c(Yb(a))}}}function Pc(a){var b={},a=a[0].style,c,d;if(typeof a.length=="number")for(c=0;c<a.length;c++)d=a[c],b[d]=a[d];else for(d in a)c=a[d],1*d!=d&&d!="cssText"&&c&&typeof c=="string"&&
c!="false"&&(b[d]=c);return b}function Xa(a){if(u(a)&&a.charAt(0)!="<")throw new z("selectors not implemented");return new Y(a)}function Y(a){if(a instanceof Y)return a;else if(u(a)){var b=F.createElement("div");b.innerHTML="<div>&nbsp;</div>"+a;b.removeChild(b.firstChild);gb(this,b.childNodes);this.remove()}else gb(this,a)}function ua(a){ac(a);for(var b=0,a=a.childNodes||[];b<a.length;b++)ua(a[b])}function ac(a){var b=a[Fa],c=Ga[b];c&&(k(c.bind||{},function(b,c){Qc(a,c,b)}),delete Ga[b],a[Fa]=A)}
function hb(a,b,c){var d=a[Fa],d=Ga[d||-1];if(v(c))d||(a[Fa]=d=Rc++,d=Ga[d]={}),d[b]=c;else return d?d[b]:null}function ib(a,b){var c;return(" "+a.className+" ").replace(/[\n\t]/g," ").indexOf(" "+b+" ")>-1}function bc(a,b){b&&k(b.split(" "),function(b){a.className=ea((" "+a.className+" ").replace(/[\n\t]/g," ").replace(" "+ea(b)+" "," "))})}function cc(a,b){b&&k(b.split(" "),function(b){if(!ib(a,b))a.className=ea(a.className+" "+ea(b))})}function gb(a,b){if(b)for(var b=!b.nodeName&&v(b.length)&&
(!b||!b.document||!b.location||!b.alert||!b.setInterval)?b:[b],c=0;c<b.length;c++)a.push(b[c])}function jb(a){var b=typeof a,c=a;if(b=="object")if(typeof(c=a.$hashKey)=="function")c=a.$hashKey();else if(c===A)c=a.$hashKey=Oa();return b+":"+c}function dc(){}function ja(a,b){w[a]=w[a]||{};k(b,function(b){s(w[a],b)})}function ec(a,b,c,d,e){var f=a<0,a=Math.abs(a),g=a+"",h="",i=[];if(g.indexOf("e")!==-1)h=g;else{g=(g.split(fc)[1]||"").length;y(e)&&(e=Math.min(Math.max(b.minFrac,g),b.maxFrac));var g=Math.pow(10,
e),a=Math.round(a*g)/g,a=(""+a).split(fc),g=a[0],a=a[1]||"",j=0,l=b.lgSize,m=b.gSize;if(g.length>=l+m)for(var j=g.length-l,o=0;o<j;o++)(j-o)%m===0&&o!==0&&(h+=c),h+=g.charAt(o);for(o=j;o<g.length;o++)(g.length-o)%l===0&&o!==0&&(h+=c),h+=g.charAt(o);for(;a.length<e;)a+="0";e&&(h+=d+a.substr(0,e))}i.push(f?b.negPre:b.posPre);i.push(h);i.push(f?b.negSuf:b.posSuf);return i.join("")}function R(a,b,c){var d="";a<0&&(d="-",a=-a);for(a=""+a;a.length<b;)a="0"+a;c&&(a=a.substr(a.length-b));return d+a}function E(a,
b,c,d){return function(e){e=e["get"+a]();if(c>0||e>-c)e+=c;e===0&&c==-12&&(e=12);return R(e,b,d)}}function Ha(a,b){return function(c,d){var e=c["get"+a](),f=Ia(b?"SHORT"+a:a);return d[f][e]}}function na(a,b){return{format:a,parse:b||a}}function gc(a){return v(a)&&a!==null?""+a:a}function kb(a){var b=hc[a];if(!b){var c=[];k(Ja(a),function(a){var b=Ka(a);c.push(b?function(a,c){var d,i;try{i=a.$eval(b)}catch(j){a.$service("$exceptionHandler")(j),d=Q(j)}ka(c,lb,d);return d?d:i}:function(){return a})});
hc[a]=b=function(a,b,f){var g=[],h=a.hasOwnProperty("$element"),i=a.$element;a.$element=b;try{for(var j=0;j<c.length;j++){var l=c[j](a,b);Ra(l)?l="":I(l)&&(l=Q(l,f));g.push(l)}return g.join("")}finally{h?a.$element=i:delete a.$element}}}return b}function mb(a){return function(b){return function(c){this.$watch(b,function(b,e,f){a(b.$index)&&(c.removeClass(U(f)?f.join(" "):f),c.addClass(U(e)?e.join(" "):e))})}}}function Ja(a){for(var b=[],c=0,d;(d=a.indexOf("{{",c))>-1;)c<d&&b.push(a.substr(c,d-c)),
c=d,d=a.indexOf("}}",d),d=d<0?a.length:d+2,b.push(a.substr(c,d-c)),c=d;c!=a.length&&b.push(a.substr(c,a.length-c));return b.length===0?[a]:b}function Ka(a){return(a=a.replace(/\n/gm," ").match(/^\{\{(.*)\}\}$/))?a[1]:null}function va(a,b){var c=b.attr("name"),d,e;if(c){d=aa(c).assignable();e=d.assign;if(!e)throw new z("Expression '"+c+"' is not assignable.");return{get:function(){return d(a)},set:function(b){b!==A&&e(a,b)}}}}function ic(a,b){var c=va(a,b),d=b.attr("ng:format")||La,e=aa(d).formatter()();
if(c)return{get:function(){return e.format(a,c.get())},set:function(b){return c.set(e.parse(a,b))}}}function jc(a,b){function c(){var c=ea(b.val());if(b[0].disabled||b[0].readOnly)ka(b,wa,null),m.markValid(b);else{var d=Pa(a,{$element:b}),c=l&&!c?"Required":c?e(d,c):null;ka(b,wa,c);(j=c)?m.markInvalid(b):m.markValid(b)}}var d=b.attr("ng:validate")||La,e=aa(d).validator()(),f=b.attr("ng:required"),g=b.attr("ng:format")||La,g=aa(g).formatter()(),h,i,j,l,m=a.$service("$invalidWidgets")||{markValid:p,
markInvalid:p};if(!e)throw"Validator named '"+d+"' not found.";h=g.format;i=g.parse;f?a.$watch(f,function(a,b){l=b;c()}):l=f==="";b.data(nb,c);return{get:function(){j&&ka(b,wa,null);try{var d=i(a,b.val());c();return d}catch(e){j=e,ka(b,wa,e)}},set:function(d){var e=b.val(),d=h(a,d);e!=d&&b.val(d||"");c()}}}function Ma(a){return function(b,c){var d=c.get();!d&&v(a)&&(d=C(a));y(b.get())&&v(d)&&b.set(d)}}function xa(a,b,c,d,e){return ab("$defer",function(f,g){var h=this,i=b(h,g),j=c(h,g),l=g.attr("ng:change")||
p,m;i&&(d.call(h,i,j,g),h.$eval(g.attr("ng:init")||p),g.bind(a,function(a){function b(){var a=j.get();if(!e||a!=m)i.set(a),m=i.get(),h.$eval(l)}a.type=="keydown"?f(b):h.$apply(b)}),h.$watch(i.get,function(a,b){$(m,b)||j.set(m=b)}))})}function ob(a){this.directives(!0);this.descend(!0);return Sc[H(a[0].type)]||p}if(typeof F.getAttribute==pa)F.getAttribute=function(){};var H=function(a){return u(a)?a.toLowerCase():a},Ia=function(a){return u(a)?a.toUpperCase():a},Fc=A,nb="$validate",wc="boolean",mc=
"length",nc="name",Aa="null",pc="number",ub="object",oc="string",pa="undefined",lb="ng-exception",wa="ng-validation-error",La="noop",z=x.Error,V=parseInt((/msie (\d+)/.exec(H(navigator.userAgent))||[])[1],10),n,Wa,la=[].slice,P=[].push,vc=x.console?M(x.console,x.console.error||p):p,w=x.angular||(x.angular={}),Ta=T(w,"markup"),Bb=T(w,"attrMarkup"),B=T(w,"directive"),O=T(w,"widget",H),db=T(w,"validator"),X=T(w,"filter"),ia=T(w,"formatter"),Ba=T(w,"service");T(w,"callbacks");var sa,uc=/^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/,
S=["0","0","0"],Fb=24;sa=V<9?function(a){a=a.nodeName?a:a[0];return a.scopeName&&a.scopeName!="HTML"?Ia(a.scopeName+":"+a.nodeName):a.nodeName}:function(a){return a.nodeName?a.nodeName:a[0].nodeName};w.toJson=Q;w.fromJson=fa;Za.prototype={link:function(a,b){var c=b;this.newScope&&(c=q(this.newScope)?b.$new(this.newScope(b)):b.$new(),a.data("$scope",c));k(this.linkFns,function(b){try{c.$service.invoke(c,b,[a])}catch(d){c.$service("$exceptionHandler")(d)}});var d,e=a[0].childNodes,f=this.children,g=
this.paths,h=g.length;for(d=0;d<h;d++)f[d].link(n(e[g[d]]),c)},addLinkFn:function(a){if(a){if(!a.$inject)a.$inject=[];this.linkFns.push(a)}},addChild:function(a,b){b&&(this.paths.push(a),this.children.push(b))},empty:function(){return this.linkFns.length===0&&this.paths.length===0}};Ab.prototype={compile:function(a){var a=n(a),b=0,c,d=a.parent();if(a.length>1)throw z("Cannot compile multiple element roots: "+n("<div>").append(a.clone()).html());if(d&&d[0])for(var d=d[0],e=0;e<d.childNodes.length;e++)d.childNodes[e]==
a[0]&&(b=e);c=this.templatize(a,b)||new Za;return function(b,d){var e=d?Eb.clone.call(a):a,b=b||$a();e.data("$scope",b);b.$element=e;(d||p)(e,b);c.link(e,b);return b}},templatize:function(a,b){var c=this,d,e,f=c.directives,g=!0,h=!0,i=sa(a),j=i.indexOf(":")>0?H(i).replace(":","-"):"",l,m={compile:M(c,c.compile),descend:function(a){v(a)&&(g=a);return g},directives:function(a){v(a)&&(h=a);return h},scope:function(a){if(v(a))l.newScope=l.newScope||a;return l.newScope}};a.addClass(j);l=new Za;za(a,function(b,
e){if(!d&&(d=c.widgets("@"+e)))a.addClass("ng-attr-widget"),d=M(m,d,b,a)});if(!d&&(d=c.widgets(i)))j&&a.addClass("ng-widget"),d=M(m,d,a);d&&(h=g=!1,i=a.parent(),l.addLinkFn(d.call(m,a)),i&&i[0]&&(a=n(i[0].childNodes[b])));if(g)for(var o=0,D=a[0].childNodes;o<D.length;o++)sa(D[o])=="#text"&&k(c.markup,function(b){if(o<D.length){var c=n(D[o]);b.call(m,c.text(),c,a)}});h&&(za(a,function(b,d){k(c.attrMarkup,function(c){c.call(m,b,d,a)})}),za(a,function(b,c){if(e=f[c])a.addClass("ng-directive"),l.addLinkFn(f[c].call(m,
b,a))}));g&&xc(a,function(a,b){l.addChild(b,c.templatize(a,b))});return l.empty()?null:l}};Gb.prototype={$new:function(a,b){var c=function(){};c.prototype=this;c=new c;c["this"]=c;c.$$listeners={};c.$parent=this;c.$id=Oa();c.$$asyncQueue=[];c.$$phase=c.$$watchers=c.$$nextSibling=c.$$childHead=c.$$childTail=null;c.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=c:this.$$childHead=this.$$childTail=c;if(a){var d=a.prototype,e;for(e in d)c[e]=M(c,d[e]);
this.$service.invoke(c,a,b)}return c},$watch:function(a,b){var c=Ib(a,"watch"),d=this.$$watchers,e={fn:Ib(b||p,"listener"),last:Number.NaN,get:c};if(!d)d=this.$$watchers=[];d.unshift(e);return function(){pb.remove(d,e)}},$digest:function(){var a,b,c,d,e,f,g=100,h;if(this.$$phase)throw z(this.$$phase+" already in progress");do{f=!1;h=this;do{h.$$phase="$digest";for(d=h.$$asyncQueue;d.length;)try{h.$eval(d.shift())}catch(i){h.$service("$exceptionHandler")(i)}if(d=h.$$watchers)for(e=d.length;e--;)try{if(a=
d[e],(b=a.get(h))!==(c=a.last)&&!$(b,c))f=!0,a.fn(h,a.last=C(b),c)}catch(j){h.$service("$exceptionHandler")(j)}h.$$phase=null;if(!(d=h.$$childHead||h!==this&&h.$$nextSibling))for(;h!==this&&!(d=h.$$nextSibling);)h=h.$parent}while(h=d);if(!g--)throw z("100 $digest() iterations reached. Aborting!");}while(f)},$destroy:function(){if(this.$root!=this){this.$emit("$destroy");var a=this.$parent;if(a.$$childHead==this)a.$$childHead=this.$$nextSibling;if(a.$$childTail==this)a.$$childTail=this.$$prevSibling;
if(this.$$prevSibling)this.$$prevSibling.$$nextSibling=this.$$nextSibling;if(this.$$nextSibling)this.$$nextSibling.$$prevSibling=this.$$prevSibling}},$eval:function(a){return(u(a)?W(a):a||p)(this)},$evalAsync:function(a){this.$$asyncQueue.push(a)},$apply:function(a){try{return this.$eval(a)}catch(b){this.$service("$exceptionHandler")(b)}finally{this.$root.$digest()}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){pb.remove(c,b)}},$emit:function(a,
b){var c=[],d,e=!1,f=this,g={name:a,targetScope:f,cancel:function(){e=!0}},h=[g].concat(la.call(arguments,1)),i,j;do{d=f.$$listeners[a]||c;g.currentScope=f;i=0;for(j=d.length;i<j;i++)try{if(d[i].apply(null,h),e)return}catch(l){f.$service("$exceptionHandler")(l)}f=f.$parent}while(f)},$broadcast:function(a,b){var c=this,d=this,e={name:a,targetScope:this},f=[e].concat(la.call(arguments,1));do if(c=d,e.currentScope=c,k(c.$$listeners[a],function(a){try{a.apply(null,f)}catch(b){c.$service("$exceptionHandler")(b)}}),
!(d=c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent;while(c=d)}};var Ac=/^function\s*[^\(]*\(([^\)]*)\)/m,Bc=/,/,Cc=/^\s*(.+?)\s*$/,zc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,bb={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},$undefined:p,"+":function(a,b,c){return(v(b)?b:0)+(v(c)?c:0)},"-":function(a,b,c){return(v(b)?b:0)-(v(c)?c:0)},"*":function(a,b,c){return b*c},"/":function(a,b,c){return b/c},"%":function(a,b,c){return b%
c},"^":function(a,b,c){return b^c},"=":p,"==":function(a,b,c){return b==c},"!=":function(a,b,c){return b!=c},"<":function(a,b,c){return b<c},">":function(a,b,c){return b>c},"<=":function(a,b,c){return b<=c},">=":function(a,b,c){return b>=c},"&&":function(a,b,c){return b&&c},"||":function(a,b,c){return b||c},"&":function(a,b,c){return b&c},"|":function(a,b,c){return c(a,b)},"!":function(a,b){return!b}},Ec={n:"\n",f:"\u000c",r:"\r",t:"\t",v:"\u000b","'":"'",'"':'"'},Nb={},Pb={},Ob={};k("abstract,boolean,break,byte,case,catch,char,class,const,continue,debugger,default,delete,do,double,else,enum,export,extends,false,final,finally,float,for,function,goto,if,implements,import,ininstanceof,intinterface,long,native,new,null,package,private,protected,public,return,short,static,super,switch,synchronized,this,throw,throws,transient,true,try,typeof,var,volatile,void,undefined,while,with".split(/,/),
function(a){Ob[a]=!0});Qb.prototype={url:function(a){var b=this,c=this.template,d,a=a||{};k(this.urlParams,function(e,g){d=Va(a[g]||b.defaults[g]||"",!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+");c=c.replace(RegExp(":"+g+"(\\W)"),d+"$1")});var c=c.replace(/\/?#$/,""),e=[];sb(a,function(a,c){b.urlParams[c]||e.push(Va(c)+"="+Va(a))});c=c.replace(/\/*$/,"");return c+(e.length?"?"+e.join("&"):"")}};Ea.DEFAULT_ACTIONS={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},
remove:{method:"DELETE"},"delete":{method:"DELETE"}};Ea.prototype={route:function(a,b,c){function d(a){var c={};k(b||{},function(b,d){c[d]=b.charAt&&b.charAt(0)=="@"?Da(a,b.substr(1)):b});return c}function e(a){C(a||{},this)}var f=this,g=new Qb(a),c=s({},Ea.DEFAULT_ACTIONS,c);k(c,function(h,i){var j=h.method=="POST"||h.method=="PUT";e[i]=function(a,b,c,i){var t={},n,r=p,K=null;switch(arguments.length){case 4:K=i,r=c;case 3:case 2:if(q(b)){if(q(a)){r=a;K=b;break}r=b;K=c}else{t=a;n=b;r=c;break}case 1:q(a)?
r=a:j?n=a:t=a;break;case 0:break;default:throw"Expected between 0-4 arguments [params, data, success, error], got "+arguments.length+" arguments.";}var L=this instanceof e?this:h.isArray?[]:new e(n);f.xhr(h.method,g.url(s({},h.params||{},d(n),t)),n,function(a,b){if(b)h.isArray?(L.length=0,k(b,function(a){L.push(new e(a))})):C(b,L);(r||p)(L)},K||h.verifyCache,h.verifyCache);return L};e.bind=function(d){return f.route(a,s({},b,d),c)};e.prototype["$"+i]=function(a,b,c){var g=d(this),f=p,h;switch(arguments.length){case 3:g=
a;f=b;h=c;break;case 2:case 1:q(a)?(f=a,h=b):(g=a,f=b||p);case 0:break;default:throw"Expected between 1-3 arguments [params, success, error], got "+arguments.length+" arguments.";}e[i].call(this,g,j?this:A,f,h)}});return e}};var Tc=x.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(b){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(c){}throw new z("This browser does not support XMLHttpRequest.");
},Xb=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,Wb=/^<\s*\/\s*([\w:-]+)[^>]*>/,Hc=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,Jc=/^</,Ic=/^<\s*\//,Kc=/<\!--(.*?)--\>/g,Lc=/<!\[CDATA\[(.*?)]]\>/g,Oc=/^((ftp|https?):\/\/|mailto:|#)/,Mc=/([^\#-~| |!])/g,Ub=Z("area,br,col,hr,img"),Rb=Z("address,blockquote,center,dd,del,dir,div,dl,dt,hr,ins,li,map,menu,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),Sb=Z("a,abbr,acronym,b,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,q,s,samp,small,span,strike,strong,sub,sup,tt,u,var"),
Tb=Z("colgroup,dd,dt,li,p,td,tfoot,th,thead,tr"),Vb=Z("script,style"),Zb=s({},Ub,Rb,Sb,Tb),$b=Z("background,href,longdesc,src,usemap"),Nc=s({},$b,Z("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,span,start,summary,target,title,type,valign,value,vspace,width")),fb=F.createElement("pre"),Ga={},Fa="ng-"+(new Date).getTime(),
Rc=1,Uc=x.document.addEventListener?function(a,b,c){a.addEventListener(b,c,!1)}:function(a,b,c){a.attachEvent("on"+b,c)},Qc=x.document.removeEventListener?function(a,b,c){a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent("on"+b,c)},Eb=Y.prototype={ready:function(a){function b(){c||(c=!0,a())}var c=!1;this.bind("DOMContentLoaded",b);Xa(x).bind("load",b)},toString:function(){var a=[];k(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return a>=0?n(this[a]):n(this[this.length+
a])},length:0,push:P,sort:[].sort,splice:[].splice},Vc=Z("multiple,selected,checked,disabled,readonly");k({data:hb,scope:function(a){for(var b;a&&!(b=n(a).data("$scope"));)a=a.parentNode;return b},removeAttr:function(a,b){a.removeAttribute(b)},hasClass:ib,css:function(a,b,c){if(v(c))a.style[b]=c;else return a.style[b]},attr:function(a,b,c){if(b==="class")if(v(c))a.className=c;else return a.className;else if(Vc[b])if(v(c))a[b]=!!c;else return a[b];else if(v(c))a.setAttribute(b,c);else if(a.getAttribute)return a=
a.getAttribute(b,2),a===null?A:a},text:s(V<9?function(a,b){if(a.nodeType==3){if(y(b))return a.nodeValue;a.nodeValue=b}else{if(y(b))return a.innerText;a.innerText=b}}:function(a,b){if(y(b))return a.textContent;a.textContent=b},{$dv:""}),val:function(a,b){if(y(b))return a.value;a.value=b},html:function(a,b){if(y(b))return a.innerHTML;for(var c=0,d=a.childNodes;c<d.length;c++)ua(d[c]);a.innerHTML=b}},function(a,b){Y.prototype[b]=function(b,d){var e,f;if((a.length==2?b:d)===A)if(I(b)){for(e=0;e<this.length;e++)for(f in b)a(this[e],
f,b[f]);return this}else{if(this.length)return a(this[0],b,d)}else{for(e=0;e<this.length;e++)a(this[e],b,d);return this}return a.$dv}});k({removeData:ac,dealoc:ua,bind:function(a,b,c){var d=hb(a,"bind");d||hb(a,"bind",d={});k(b.split(" "),function(b){var f=d[b];if(!f)d[b]=f=function(b){if(!b.preventDefault)b.preventDefault=function(){b.returnValue=!1};if(!b.stopPropagation)b.stopPropagation=function(){b.cancelBubble=!0};if(!b.target)b.target=b.srcElement||F;k(f.fns,function(c){c.call(a,b)})},f.fns=
[],Uc(a,b,f);f.fns.push(c)})},replaceWith:function(a,b){var c,d=a.parentNode;ua(a);k(new Y(b),function(b){c?d.insertBefore(b,c.nextSibling):d.replaceChild(b,a);c=b})},children:function(a){var b=[];k(a.childNodes,function(a){a.nodeName!="#text"&&b.push(a)});return b},append:function(a,b){k(new Y(b),function(b){a.nodeType===1&&a.appendChild(b)})},prepend:function(a,b){if(a.nodeType===1){var c=a.firstChild;k(new Y(b),function(b){c?a.insertBefore(b,c):(a.appendChild(b),c=b)})}},remove:function(a){ua(a);
var b=a.parentNode;b&&b.removeChild(a)},after:function(a,b){var c=a,d=a.parentNode;k(new Y(b),function(a){d.insertBefore(a,c.nextSibling);c=a})},addClass:cc,removeClass:bc,toggleClass:function(a,b,c){y(c)&&(c=!ib(a,b));(c?cc:bc)(a,b)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){return a.nextSibling},find:function(a,b){return a.getElementsByTagName(b)},clone:function(a){return a.cloneNode(!0)}},function(a,b){Y.prototype[b]=function(b,d){for(var e,f=0;f<this.length;f++)e==
A?(e=a(this[f],b,d),e!==A&&(e=n(e))):gb(e,a(this[f],b,d));return e==A?this:e}});var ca={typeOf:function(a){if(a===null)return Aa;var b=typeof a;if(b==ub){if(a instanceof Array)return"array";if(qa(a))return"date";if(a.nodeType==1)return"element"}return b}},P={copy:C,size:xb,equals:$},Wc={extend:s},pb={indexOf:ya,sum:function(a,b){for(var c=qb.compile(b),d=0,e=0;e<a.length;e++){var f=1*c(a[e]);isNaN(f)||(d+=f)}return d},remove:function(a,b){var c=ya(a,b);c>=0&&a.splice(c,1);return b},filter:function(a,
b){var c=[];c.check=function(a){for(var b=0;b<c.length;b++)if(!c[b](a))return!1;return!0};var d=function(a,b){if(b.charAt(0)==="!")return!d(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return(""+a).toLowerCase().indexOf(b)>-1;case "object":for(var c in a)if(c.charAt(0)!=="$"&&d(a[c],b))return!0;return!1;case "array":for(c=0;c<a.length;c++)if(d(a[c],b))return!0;return!1;default:return!1}};switch(typeof b){case "boolean":case "number":case "string":b={$:b};case "object":for(var e in b)e==
"$"?function(){var a=(""+b[e]).toLowerCase();a&&c.push(function(b){return d(b,a)})}():function(){var a=e,g=(""+b[e]).toLowerCase();g&&c.push(function(b){return d(Da(b,a),g)})}();break;case "function":c.push(b);break;default:return a}for(var f=[],g=0;g<a.length;g++){var h=a[g];c.check(h)&&f.push(h)}return f},add:function(a,b){a.push(y(b)?{}:b);return a},count:function(a,b){if(!b)return a.length;var c=qb.compile(b),d=0;k(a,function(a){c(a)&&d++});return d},orderBy:function(a,b,c){function d(a,b){return ma(b)?
function(b,c){return a(c,b)}:a}if(!b)return a;for(var b=U(b)?b:[b],b=qc(b,function(a){var b=!1,c=a||da;if(u(a)){if(a.charAt(0)=="+"||a.charAt(0)=="-")b=a.charAt(0)=="-",a=a.substring(1);c=W(a)}return d(function(a,b){var d;d=c(a);var e=c(b),g=typeof d,f=typeof e;g==f?(g=="string"&&(d=d.toLowerCase()),g=="string"&&(e=e.toLowerCase()),d=d===e?0:d<e?-1:1):d=g<f?-1:1;return d},b)}),e=[],f=0;f<a.length;f++)e.push(a[f]);return e.sort(d(function(a,c){for(var d=0;d<b.length;d++){var e=b[d](a,c);if(e!==0)return e}return 0},
c))},limitTo:function(a,b){var b=parseInt(b,10),c=[],d,e;b>0?(d=0,e=b):(d=a.length+b,e=a.length);for(;d<e;d++)c.push(a[d]);return c}},Xc=/^(\d{4})-(\d\d)-(\d\d)(?:T(\d\d)(?:\:(\d\d)(?:\:(\d\d)(?:\.(\d{3}))?)?)?Z)?$/,ga={quote:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v")+'"'},quoteUnicode:function(a){for(var a=w.String.quote(a),b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);
d<128?b.push(a.charAt(c)):(d="000"+d.toString(16),b.push("\\u"+d.substring(d.length-4)))}return b.join("")},toDate:function(a){var b;if(u(a)&&(b=a.match(Xc)))a=new Date(0),a.setUTCFullYear(b[1],b[2]-1,b[3]),a.setUTCHours(b[4]||0,b[5]||0,b[6]||0,b[7]||0);return a}},kc={toString:function(a){if(!a)return a;var b=a.toISOString?a.toISOString():"";return b.length==24?b:R(a.getUTCFullYear(),4)+"-"+R(a.getUTCMonth()+1,2)+"-"+R(a.getUTCDate(),2)+"T"+R(a.getUTCHours(),2)+":"+R(a.getUTCMinutes(),2)+":"+R(a.getUTCSeconds(),
2)+"."+R(a.getUTCMilliseconds(),3)+"Z"}},qb={compile:function(a){return q(a)?a:a?W(a):da}};dc.prototype={put:function(a,b){var c=jb(a),d=this[c];this[c]=b;return d},get:function(a){return this[jb(a)]},remove:function(a){var a=jb(a),b=this[a];delete this[a];return b}};ja("Global",[ca]);ja("Collection",[ca,P]);ja("Array",[ca,P,pb]);ja("Object",[ca,P,Wc]);ja("String",[ca,ga]);ja("Date",[ca,kc]);w.Date.toString=kc.toString;ja("Function",[ca,P,qb]);X.currency=function(a,b){var c=this.$service("$locale").NUMBER_FORMATS;
this.$element.toggleClass("ng-format-negative",a<0);if(y(b))b=c.CURRENCY_SYM;return ec(a,c.PATTERNS[1],c.GROUP_SEP,c.DECIMAL_SEP,2).replace(/\u00A4/g,b)};var fc=".";X.number=function(a,b){if(isNaN(a)||!isFinite(a))return"";var c=this.$service("$locale").NUMBER_FORMATS;return ec(a,c.PATTERNS[0],c.GROUP_SEP,c.DECIMAL_SEP,b)};var Yc={yyyy:E("FullYear",4),yy:E("FullYear",2,0,!0),y:E("FullYear",1),MMMM:Ha("Month"),MMM:Ha("Month",!0),MM:E("Month",2,1),M:E("Month",1,1),dd:E("Date",2),d:E("Date",1),HH:E("Hours",
2),H:E("Hours",1),hh:E("Hours",2,-12),h:E("Hours",1,-12),mm:E("Minutes",2),m:E("Minutes",1),ss:E("Seconds",2),s:E("Seconds",1),EEEE:Ha("Day"),EEE:Ha("Day",!0),a:function(a,b){return a.getHours()<12?b.AMPMS[0]:b.AMPMS[1]},Z:function(a){a=a.getTimezoneOffset();return R(a/60,2)+R(Math.abs(a%60),2)}},Zc=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,$c=/^\d+$/;X.date=function(a,b){var c=this.$service("$locale"),b=c.DATETIME_FORMATS[b]||b;u(a)&&(a=$c.test(a)?parseInt(a,
10):ga.toDate(a));oa(a)&&(a=new Date(a));if(!qa(a))return a;var d=a.toLocaleDateString(),e;if(b&&u(b)){for(var d="",f=[],g;b;)(g=Zc.exec(b))?(f=f.concat(la.call(g,1)),b=f.pop()):(f.push(b),b=null);k(f,function(b){e=Yc[b];d+=e?e(a,c.DATETIME_FORMATS):b.replace(/(^'|'$)/g,"").replace(/''/g,"'")})}return d};X.json=function(a){this.$element.addClass("ng-monospace");return Q(a,!0)};X.lowercase=H;X.uppercase=Ia;X.html=function(a,b){return new Sa(a,b)};var ad=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/,
bd=/^mailto:/;X.linky=function(a){if(!a)return a;for(var b=a,c=[],d=wb(c),e,f;a=b.match(ad);)e=a[0],a[2]==a[3]&&(e="mailto:"+e),f=a.index,d.chars(b.substr(0,f)),d.start("a",{href:e}),d.chars(a[0].replace(bd,"")),d.end("a"),b=b.substring(f+a[0].length);d.chars(b);return new Sa(c.join(""))};var cd=/^\s*[-+]?\d*(\.\d*)?\s*$/;ia.noop=na(da,da);ia.json=na(Q,function(a){return fa(a||"null")});ia["boolean"]=na(gc,ma);ia.number=na(gc,function(a){if(a==null||cd.exec(a))return a===null||a===""?null:1*a;else throw"Not a number";
});ia.list=na(function(a){return a?a.join(", "):a},function(a){var b=[];k((a||"").split(","),function(a){(a=ea(a))&&b.push(a)});return b});ia.trim=na(function(a){return a?ea(""+a):""});s(db,{noop:function(){return null},regexp:function(a,b,c){return a.match(b)?null:c||"Value does not match expected format "+b+"."},number:function(a,b,c){var d=1*a;return d==a?typeof b!=pa&&d<b?"Value can not be less than "+b+".":typeof b!=pa&&d>c?"Value can not be greater than "+c+".":null:"Not a number"},integer:function(a,
b,c){return(b=db.number(a,b,c))?b:!(""+a).match(/^\s*[\d+]*\s*$/)||a!=Math.round(a)?"Not a whole number":null},date:function(a){var b=(a=/^(\d\d?)\/(\d\d?)\/(\d\d\d\d)$/.exec(a))?new Date(a[3],a[1]-1,a[2]):0;return b&&b.getFullYear()==a[3]&&b.getMonth()==a[1]-1&&b.getDate()==a[2]?null:"Value is not a date. (Expecting format: 12/31/2009)."},email:function(a){return a.match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)?null:"Email needs to be in username@host.com format."},phone:function(a){return a.match(/^1\(\d\d\d\)\d\d\d-\d\d\d\d$/)?
null:a.match(/^\+\d{2,3} (\(\d{1,5}\))?[\d ]+\d$/)?null:"Phone number needs to be in 1(987)654-3210 format in North America or +999 (123) 45678 906 internationally."},url:function(a){return a.match(/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/)?null:"URL needs to be in http://server[:port]/path format."},json:function(a){try{return fa(a),null}catch(b){return b.toString()}},asynchronous:function(a,b,c){if(a){var d=this.$element,e=d.data("$asyncValidator");e||
d.data("$asyncValidator",e={inputs:{}});e.current=a;var f=e.inputs[a],g=this.$service("$invalidWidgets");f?f.inFlight?g.markInvalid(this.$element):(c||p)(f.response):(e.inputs[a]=f={inFlight:!0},g.markInvalid(this.$element),d.addClass("ng-input-indicator-wait"),b(a,function(b,c){f.response=c;f.error=b;f.inFlight=!1;e.current==a&&(d.removeClass("ng-input-indicator-wait"),g.markValid(d));d.data(nb)()}));return f.error}}});G("$cookieStore",function(a){return{get:function(b){return fa(a[b])},put:function(b,
c){a[b]=Q(c)},remove:function(b){delete a[b]}}},["$cookies"]);G("$cookies",function(a){var b=this,c={},d={},e,f=!1;a.addPollFn(function(){var g=a.cookies();e!=g&&(e=g,C(g,d),C(g,c),f&&b.$apply())})();f=!0;this.$watch(function(){var b,e,f;for(b in d)y(c[b])&&a.cookies(b,A);for(b in c)e=c[b],u(e)?e!==d[b]&&(a.cookies(b,e),f=!0):v(d[b])?c[b]=d[b]:delete c[b];if(f)for(b in e=a.cookies(),c)c[b]!==e[b]&&(y(e[b])?delete c[b]:c[b]=e[b])});return c},["$browser"]);G("$defer",function(a){var b=this;return function(c,
d){a.defer(function(){b.$apply(c)},d)}},["$browser"]);G("$document",function(a){return n(a.document)},["$window"]);G("$exceptionHandler",function(a){return function(b){a.error(b)}},["$log"]);G("$hover",function(a,b){var c,d,e=n(b[0].body);a.hover(function(a,b){if(b&&(d=a.attr(lb)||a.attr(wa))){c||(c={callout:n('<div id="ng-callout"></div>'),arrow:n("<div></div>"),title:n('<div class="ng-title"></div>'),content:n('<div class="ng-content"></div>')},c.callout.append(c.arrow),c.callout.append(c.title),
c.callout.append(c.content),e.append(c.callout));var h=e[0].getBoundingClientRect(),i=a[0].getBoundingClientRect(),h=h.right-i.right-10;c.title.text(a.hasClass("ng-exception")?"EXCEPTION:":"Validation error...");c.content.text(d);h<300?(c.arrow.addClass("ng-arrow-right"),c.arrow.css({left:"301px"}),c.callout.css({position:"fixed",left:i.left-10-300-4+"px",top:i.top-3+"px",width:"300px"})):(c.arrow.addClass("ng-arrow-left"),c.callout.css({position:"fixed",left:i.right+10+"px",top:i.top-3+"px",width:"300px"}))}else c&&
(c.callout.remove(),c=null)})},["$browser","$document"],!0);G("$invalidWidgets",function(){function a(b){if(b==x.document)return!1;b=b.parentNode;return!b||a(b)}var b=[];b.markValid=function(a){a=ya(b,a);a!=-1&&b.splice(a,1)};b.markInvalid=function(a){ya(b,a)===-1&&b.push(a)};b.visible=function(){var a=0;k(b,function(b){var e=a,b=b[0].getBoundingClientRect(),f=b.height||b.bottom||0-b.top||0;a=e+((b.width||b.right||0-b.left||0)>0&&f>0?1:0)});return a};this.$watch(function(){for(var c=0;c<b.length;){var d=
b[c];a(d[0])?(b.splice(c,1),d.dealoc&&d.dealoc()):c++}});return b});var dd=/^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,ed=/^([^\?]*)?(\?([^\?]*))?$/,lc={http:80,https:443,ftp:21};G("$location",function(a){function b(b){if(u(b)){var c=s,l=g,m={},o=dd.exec(b);if(o)m.href=b.replace(/#$/,""),m.protocol=o[1],m.host=o[3]||"",m.port=o[5]||lc[m.protocol]||null,m.path=o[6]||"",m.search=Ua(o[8]),m.hash=o[10]||"",s(m,f(m.hash));c(l,m)}else{v(b.hash)&&
s(b,u(b.hash)?f(b.hash):b.hash);s(g,b);if(v(b.hashPath||b.hashSearch))g.hash=e(g);g.href=d(g)}a.setUrl(g.href);C(g,h)}function c(a,c){var d={};u(a)?(d.hashPath=a,d.hashSearch=c||{}):d.hashSearch=a;d.hash=e(d);b({hash:d})}function d(a){var b=Cb(a.search),c=a.port==lc[a.protocol]?null:a.port;return a.protocol+"://"+a.host+(c?":"+c:"")+a.path+(b?"?"+b:"")+(a.hash?"#"+a.hash:"")}function e(a){var b=Cb(a.hashSearch);return escape(a.hashPath).replace(/%21/gi,"!").replace(/%3A/gi,":").replace(/%24/gi,"$")+
(b?"?"+b:"")}function f(a){var b={},c=ed.exec(a);if(c)b.hash=a,b.hashPath=unescape(c[1]||""),b.hashSearch=Ua(c[3]);return b}var g={update:b,updateHash:c},h={};a.onHashChange(M(this,this.$apply,function(){b(a.getUrl())}))();this.$watch(function(){if(!$(g,h)){if(g.href==h.href)if(g.hash!=h.hash){var a=f(g.hash);c(a.hashPath,a.hashSearch)}else g.hash=e(g),g.href=d(g);b(g.href)}});return g},["$browser"]);G("$log",function(a){function b(b){var d=a.console||{},e=d[b]||d.log||p;return e.apply?function(){var a=
[];k(arguments,function(b){a.push(tb(b))});return e.apply(d,a)}:e}return{log:b("log"),warn:b("warn"),info:b("info"),error:b("error")}},["$window"]);G("$resource",function(a){a=new Ea(a);return M(a,a.route)},["$xhr.cache"]);G("$route",function(a,b){function c(){var b,c;k(e,function(d,e){if(!c&&(b=f(a.hashPath,e)))c=Pa(d,{params:s({},a.hashSearch,b),pathParams:b}),c.$route=d});return c||e[null]&&Pa(e[null],{params:{},pathParams:{}})}function d(a,b){var c=[];k((a||"").split(":"),function(a,d){if(d==
0)c.push(a);else{var e=a.match(/(\w+)(.*)/),g=e[1];c.push(b[g]);c.push(e[2]||"");delete b[g]}});return c.join("")}var e={},f=function(a,b,c){var d="^"+b.replace(/[\.\\\(\)\^\$]/g,"$1")+"$",e=[],g={};k(b.split(/\W/),function(a){if(a){var b=RegExp(":"+a+"([\\W])");d.match(b)&&(d=d.replace(b,"([^/]*)$1"),e.push(a))}});var f=a.match(RegExp(d));f&&(k(e,function(a,b){g[a]=f[b+1]}),c&&this.$set(c,g));return f?g:null},g=this,h=this,i=0,j=!0,l={routes:e,parent:function(a){a&&(g=a)},when:function(a,b){if(y(a))return e;
var c=e[a];c||(c=e[a]={reloadOnSearch:!0});b&&s(c,b);i++;return c},otherwise:function(a){l.when(null,a)},reload:function(){i++;j=!1}};this.$watch(function(){return i+a.hash},function(){var e=c(),f=l.current;if(e&&f&&e.$route===f.$route&&$(e.pathParams,f.pathParams)&&!e.reloadOnSearch&&j)l.current=e,C(e.params,b),f.scope&&f.scope.$emit("$routeUpdate");else{j=!0;h.$broadcast("$beforeRouteChange",e,f);f&&f.scope&&f.scope.$destroy();if(l.current=e)e.redirectTo?a.update(u(e.redirectTo)?{hashSearch:e.params,
hashPath:d(e.redirectTo,e.params)}:{hash:e.redirectTo(e.pathParams,a.hash,a.hashPath,a.hashSearch)}):(C(e.params,b),e.scope=g.$new(e.controller));h.$broadcast("$afterRouteChange",e,f)}});return l},["$location","$routeParams"]);Ba("$routeParams",function(){return{}});G("$window",M(x,da,x));G("$xhr.bulk",function(a,b,c){function d(b,c,g,h,i){q(g)&&(i=h,h=g,g=null);var j;k(d.urls,function(a){if(q(a.match)?a.match(c):a.match.exec(c))j=a});if(j){if(!j.requests)j.requests=[];b={method:b,url:c,data:g,success:h};
if(i)b.error=i;j.requests.push(b)}else a(b,c,g,h,i)}d.urls={};d.flush=function(e,f){ra(e=e||p,0);ra(f=f||p,1);k(d.urls,function(d,f){var i=d.requests;if(i&&i.length)d.requests=[],d.callbacks=[],a("POST",f,{requests:i},function(a,d){k(d,function(a,d){try{a.status==200?(i[d].success||p)(a.status,a.response):q(i[d].error)?i[d].error(a.status,a.response):b(i[d],a)}catch(e){c.error(e)}});e()},function(a,d){k(i,function(e){try{q(e.error)?e.error(a,d):b(e,d)}catch(g){c.error(g)}})})})};this.$watch(function(){d.flush()});
return d},["$xhr","$xhr.error","$log"]);G("$xhr.cache",function(a,b,c,d){function e(a,h,i,j,l,m,o){q(i)?(q(j)?(o=m,m=l,l=j):(m=j,o=l,l=null),j=i,i=null):q(l)||(o=m,m=l,l=null);if(a=="GET"){var n;if(n=e.data[h])if(o?j(200,C(n.value)):b(function(){j(200,C(n.value))}),!m)return;(m=f[h])?(m.successes.push(j),m.errors.push(l)):(f[h]={successes:[j],errors:[l]},e.delegate(a,h,i,function(a,b){a==200&&(e.data[h]={value:b});var c=f[h].successes;delete f[h];k(c,function(c){try{(c||p)(a,C(b))}catch(e){d.error(e)}})},
function(b,e){var j=f[h].errors,l=f[h].successes;delete f[h];k(j,function(f,j){try{q(f)?f(b,C(e)):c({method:a,url:h,data:i,success:l[j]},{status:b,body:e})}catch(m){d.error(m)}})}))}else e.data={},e.delegate(a,h,i,j,l)}var f={};e.data={};e.delegate=a;return e},["$xhr.bulk","$defer","$xhr.error","$log"]);G("$xhr.error",function(a){return function(b,c){a.error("ERROR: XHR: "+b.url,b,c)}},["$log"]);G("$xhr",function(a,b,c){function d(d,h,i,j,l){q(i)&&(l=j,j=i,i=null);i&&I(i)&&(i=Q(i));a.xhr(d,h,i,function(a,
f){try{u(f)&&(f.match(/^\)\]\}',\n/)&&(f=f.substr(6)),/^\s*[\[\{]/.exec(f)&&/[\}\]]\s*$/.exec(f)&&(f=fa(f,!0))),e.$apply(function(){200<=a&&a<300?j(a,f):q(l)?l(a,f):b({method:d,url:h,data:i,success:j},{status:a,body:f})})}catch(k){c.error(k)}},s({"X-XSRF-TOKEN":a.cookies()["XSRF-TOKEN"]},f.common,f[H(d)]))}var e=this,f={common:{Accept:"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest"},post:{"Content-Type":"application/x-www-form-urlencoded"},get:{},head:{},put:{},"delete":{},
patch:{}};d.defaults={headers:f};return d},["$browser","$xhr.error","$log"]);G("$locale",function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),
SHORTMONTH:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),DAY:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),SHORTDAY:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(a){return a===1?"one":"other"}}});B("ng:init",function(a){return function(){this.$eval(a)}});
B("ng:controller",function(a){this.scope(function(b){b=Da(b,a,!0)||Da(x,a,!0);ra(b,a);return b});return p});B("ng:bind",function(a,b){b.addClass("ng-binding");var c=aa(a).statements();return function(a){var b=p,f=p;this.$watch(function(g){var h,i,j,l;l=g.hasOwnProperty("$element");var m=g.$element;g.$element=a;try{i=c(g)}catch(k){g.$service("$exceptionHandler")(k),h=tb(k)}finally{l?g.$element=m:delete g.$element}if(g=i instanceof Sa)i=(j=i).html;if(!(b===i&&f==h)&&(l=Ra(i),!g&&!l&&I(i)&&(i=Q(i,!0)),
i!=b||h!=f))b=i,f=h,ka(a,lb,h),h&&(i=h),g?a.html(j.get()):l?(a.html(""),a.append(i)):a.text(i==A?"":i)})}});var hc={};B("ng:bind-template",function(a,b){b.addClass("ng-binding");var c=kb(a);return function(a){var b;this.$watch(function(f){f=c(f,a,!0);f!=b&&(a.text(f),b=f)})}});var fd={disabled:"disabled",readonly:"readOnly",checked:"checked",selected:"selected",multiple:"multiple"};B("ng:bind-attr",function(a){return function(b){var c={};this.$watch(function(d){var e=d.$eval(a),f;for(f in e){var g=
kb(e[f])(d,b),h=fd[H(f)];c[f]!==g&&(c[f]=g,h?(ma(g)?(b.attr(h,h),b.attr("ng-"+h,g)):(b.removeAttr(h),b.removeAttr("ng-"+h)),(b.data(nb)||p)()):b.attr(f,g))}})}});B("ng:click",function(a){return function(b){var c=this;b.bind("click",function(b){c.$apply(a);b.stopPropagation()})}});B("ng:submit",function(a){return function(b){var c=this;b.bind("submit",function(b){c.$apply(a);b.preventDefault()})}});B("ng:class",mb(function(){return!0}));B("ng:class-odd",mb(function(a){return a%2===0}));B("ng:class-even",
mb(function(a){return a%2===1}));B("ng:show",function(a){return function(b){this.$watch(a,function(a,d){b.css("display",ma(d)?"":"none")})}});B("ng:hide",function(a){return function(b){this.$watch(a,function(a,d){b.css("display",ma(d)?"none":"")})}});B("ng:style",function(a){return function(b){var c=Pc(b);this.$watch(function(d){var d=d.$eval(a)||{},e,f={};for(e in d)c[e]===A&&(c[e]=""),f[e]=d[e];for(e in c)f[e]=f[e]||c[e];b.css(f)})}});B("ng:cloak",function(a,b){b.removeAttr("ng:cloak");b.removeClass("ng-cloak")});
Ta("{{}}",function(a,b,c){var d=Ja(a);if(d.length>1||Ka(d[0])!==null)if(rc(c[0]))c.attr("ng:bind-template",a);else{var e=b,f;k(Ja(a),function(a){var b=Ka(a);b?(f=n("<span>"),f.attr("ng:bind",b)):f=n(F.createTextNode(a));V&&a.charAt(0)==" "&&(f=n("<span>&nbsp;</span>"),b=f.html(),f.text(a.substr(1)),f.html(b+f.html()));e.after(f);e=f});b.remove()}});Ta("option",function(a,b,c){H(sa(c))=="option"&&(V<=7?vb(c[0].outerHTML,{start:function(b,e){y(e.value)&&c.attr("value",a)}}):c[0].getAttribute("value")==
null&&c.attr("value",a))});var rb={};k("src,href,checked,disabled,multiple,readonly,selected".split(","),function(a){rb["ng:"+a]=a});Bb("{{}}",function(a,b,c){if(!B(b)&&!B("@"+b)){V&&b=="src"&&(a=decodeURI(a));var d=Ja(a);if(d.length>1||Ka(d[0])!==null||rb[b])c.removeAttr(b),d=fa(c.attr("ng:bind-attr")||"{}"),d[rb[b]||b]=a,c.attr("ng:bind-attr",Q(d))}});var P=xa("keydown change",va,jc,Ma(),!0),Sc={text:P,textarea:P,hidden:P,password:P,checkbox:xa("click",ic,function(a,b){var c=b[0];return{get:function(){return!!c.checked},
set:function(a){c.checked=ma(a)}}},Ma(!1)),radio:xa("click",ic,function(a,b){var c=b[0];return{get:function(){return c.checked?c.value:null},set:function(a){c.checked=a==c.value}}},function(a,b,c){var d=a.get(),e=b.get(),c=c[0];c.checked=!1;c.name=this.$id+"@"+c.name;y(d)&&a.set(d=null);d==null&&e!==null&&a.set(e);b.set(d)}),"select-one":xa("change",va,jc,Ma(null)),"select-multiple":xa("change",va,function(a,b){var c=b.attr("ng:format")||La,d=aa(c).formatter()();return{get:function(){var c=[];k(b[0].options,
function(b){b.selected&&c.push(d.parse(a,b.value))});return c},set:function(c){var f={};k(c,function(b){f[d.format(a,b)]=!0});k(b[0].options,function(a){a.selected=f[a.value]})}}},Ma([]))};O("input",ob);O("textarea",ob);var gd=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/;O("select",function(a){this.descend(!0);this.directives(!0);var b=a.attr("multiple"),c=a.attr("ng:options"),d=W(a.attr("ng:change")||
""),e;if(!c)return ob.call(this,a);if(!(e=c.match(gd)))throw z("Expected ng:options in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+c+"'.");var f=W(e[2]||e[1]),g=e[4]||e[6],h=e[5],i=W(e[3]||""),j=W(e[2]?e[1]:g),l=W(e[7]),m=n(F.createElement("option")),o=n(F.createElement("optgroup")),D=!1;return function(c){var e=[[{element:c,label:""}]],r=this,p=va(r,a);k(c.children(),function(a){a.value==""&&(D={label:n(a).text(),id:""})});c.html("");c.bind("change",function(){var a,
f=l(r)||[],i=c.val(),m=r.$new(),k,o,n,D,s,q;if(b){k=[];D=0;for(q=e.length;D<q;D++){a=e[D];n=1;for(s=a.length;n<s;n++)if((o=a[n].element)[0].selected)h&&(m[h]=i),m[g]=f[o.val()],k.push(j(m))}}else i=="?"?k=A:i==""?k=null:(m[g]=f[i],h&&(m[h]=i),k=j(m));v(k)&&p.get()!==k&&(d(r),p.set(k));r.$root.$apply()});r.$watch(function(a){var d={"":[]},k=[""],n,r,q,u,v,w,x=l(a)||[],y=x,C,H,A,z,J,a=a.$new(),B=p.get(),G,E=!1,F,I;try{if(b){if(E=new dc,B&&oa(A=B.length))for(J=0;J<A;J++)E.put(B[J],!0)}else if(B===null||
D)d[""].push(s({selected:B===null,id:"",label:""},D)),E=!0;if(h){y=[];for(C in x)x.hasOwnProperty(C)&&y.push(C);y.sort()}for(J=0;A=y.length,J<A;J++){a[g]=x[h?a[h]=y[J]:J];n=i(a)||"";if(!(r=d[n]))r=d[n]=[],k.push(n);b?G=!!E.remove(j(a)):(G=B===j(a),E=E||G);r.push({id:h?y[J]:J,label:f(a)||"",selected:G})}k.sort();!b&&!E&&d[""].unshift({id:"?",label:"",selected:!0});z=0;for(H=k.length;z<H;z++){n=k[z];r=d[n];if(e.length<=z)e.push(v=[u={element:o.clone().attr("label",n),label:r.label}]),c.append(u.element);
else if(v=e[z],u=v[0],u.label!=n)u.element.attr("label",u.label=n);F=null;J=0;for(A=r.length;J<A;J++)if(q=r[J],w=v[J+1]){F=w.element;if(w.label!==q.label)F.text(w.label=q.label);if(w.id!==q.id)F.val(w.id=q.id);w.selected!==q.selected&&F.attr("selected",q.selected)}else(I=m.clone()).val(q.id).attr("selected",q.selected).text(q.label),v.push(w={element:I,label:q.label,id:q.id,checked:q.selected}),F?F.after(I):u.element.append(I),F=I;for(J++;v.length>J;)v.pop().element.remove()}for(;e.length>z;)e.pop()[0].element.remove()}finally{a.$destroy()}})}});
O("ng:include",function(a){var b=this,c=a.attr("src"),d=a.attr("scope")||"",e=a[0].getAttribute("onload")||"";if(a[0]["ng:compiled"])this.descend(!0),this.directives(!0);else return a[0]["ng:compiled"]=!0,s(function(a,g){var h=0,i=[],j,l;this.$watch(c,function(){h++});this.$watch(function(a){a=a.$eval(d);a!==l&&(l=a,h++)});this.$watch(function(){return h},function(h){for(var l=h.$eval(c),k=h.$eval(d);i.length;)i.pop().$destroy();l?a("GET",l,null,function(a,c){g.html(c);k?j=k:i.push(j=h.$new());b.compile(g)(j);
h.$eval(e)},!1,!0):(j=null,g.html(""))})},{$inject:["$xhr.cache"]})});O("ng:switch",function(a){var b=a.attr("on"),c=a.attr("change"),d={},e,f=a.children(),g=f.length,h,i;if(!b)throw new z("Missing 'on' attribute.");for(;g--;)h=n(f[g]),h.remove(),i=h.attr("ng:switch-when"),u(i)?d[i]=this.compile(h):u(h.attr("ng:switch-default"))&&(e=this.compile(h));f=null;a.html("");return function(a){var f=0,g,h;this.$watch(b,function(b,i){a.html("");if(h=d[i]||e)f++,g&&g.$destroy(),g=b.$new(),g.$eval(c)});this.$watch(function(){return f},
function(){a.html("");h&&h(g,function(b){a.append(b)})})}});O("a",function(){this.descend(!0);this.directives(!0);return function(a){var b=(a.attr("ng:bind-attr")||"").indexOf('"href":')!==-1;!b&&!a.attr("name")&&!a.attr("href")&&a.attr("href","");a.attr("href")===""&&!b&&a.bind("click",function(a){a.preventDefault()})}});O("@ng:repeat",function(a,b){b.removeAttr("ng:repeat");b.replaceWith(n("<\!-- ng:repeat: "+a+" --\>"));var c=this.compile(b);return function(b){var e=a.match(/^\s*(.+)\s+in\s+(.*)\s*$/),
f,g,h,i;if(!e)throw z("Expected ng:repeat in form of '_item_ in _collection_' but got '"+a+"'.");f=e[1];g=e[2];e=f.match(/^([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\)$/);if(!e)throw z("'item' in 'item in collection' should be identifier or (key, value) but got '"+keyValue+"'.");h=e[3]||e[1];i=e[2];var j=[],l=[b],k=this;this.$watch(function(a){var b=0,d=j.length,a=a.$eval(g),e=xb(a,!0),f=F.createDocumentFragment(),q=d<e?l[d]:null,p,s;for(s in a)if(a.hasOwnProperty(s))b<d?(p=j[b],p[h]=a[s],i&&(p[i]=s),
p.$position=b==0?"first":b==e-1?"last":"middle",p.$eval()):(p=k.$new(),p[h]=a[s],i&&(p[i]=s),p.$index=b,p.$position=b==0?"first":b==e-1?"last":"middle",j.push(p),c(p,function(a){a.attr("ng:repeat-index",b);f.appendChild(a[0]);p.$digest();l[b+1]=a})),b++;for(q&&q.after(n(f));j.length>b;)j.pop().$destroy(),l.pop().remove()})}});O("@ng:non-bindable",p);O("ng:view",function(a){var b=this;if(a[0]["ng:compiled"])b.descend(!0),b.directives(!0);else return a[0]["ng:compiled"]=!0,ab("$xhr.cache","$route",
function(a,d,e){var f=0;this.$on("$afterRouteChange",function(){f++});this.$watch(function(){return f},function(){var f=d.current&&d.current.template;f?a("GET",f,function(a,c){e.html(c);b.compile(e)(d.current.scope)}):e.html("")})})});O("ng:pluralize",function(a){var b=a.attr("count"),c=a.attr("when"),d=a.attr("offset")||0;return ab("$locale",function(a,f){var g=this,h=g.$eval(c),i={};k(h,function(a,c){i[c]=kb(a.replace(/{}/g,"{{"+b+"-"+d+"}}"))});g.$watch(function(){var c=parseFloat(g.$eval(b));
return isNaN(c)?"":(h[c]||(c=a.pluralCat(c-d)),i[c](g,f,!0))},function(a,b){f.text(b)})})});var Na;Ba("$browser",function(a){Na||(Na=new Gc(x,n(x.document),n(x.document.body),Tc,a),Na.bind());return Na},{$inject:["$log"]});s(w,{compile:zb,scope:$a,copy:C,extend:s,equals:$,forEach:k,injector:Hb,noop:p,bind:M,toJson:Q,fromJson:fa,identity:da,isUndefined:y,isDefined:v,isString:u,isFunction:q,isObject:I,isNumber:oa,isArray:U,version:{full:"0.10.0",major:0,minor:10,dot:0,codeName:"chicken-hands"},isDate:qa,
lowercase:H,uppercase:Ia});Db();Xa(F).ready(function(){var a=tc(F),b=F,c=a.autobind;c&&(b=u(c)?b.getElementById(c):b,b=zb(b)($a()),c=b.$service("$browser"),a.css?c.addCss(a.base_url+a.css):V<8&&c.addJs(a.ie_compat,a.ie_compat_id),b.$apply())})})(window,document);angular.element(document).find("head").append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],.ng-cloak{display:none;}.ng-format-negative{color:red;}.ng-exception{border:2px solid #FF0000;font-family:"Courier New",Courier,monospace;font-size:smaller;white-space:pre;}.ng-validation-error{border:2px solid #FF0000;}#ng-callout{margin:0;padding:0;border:0;outline:0;font-size:13px;font-weight:normal;font-family:Verdana,Arial,Helvetica,sans-serif;vertical-align:baseline;background:transparent;text-decoration:none;}#ng-callout .ng-arrow-left{background-image:url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrSLoc/AG8FeUUIN+sGebWAnbKSJodqqlsOxJtqYooU9vvk+vcJIcTkg+QAAA7");background-repeat:no-repeat;background-position:left top;position:absolute;z-index:101;left:-12px;height:23px;width:10px;top:-3px;}#ng-callout .ng-arrow-right{background-image:url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrCLTcoM29yN6k9socs91e5X3EyJloipYrO4ohTMqA0Fn2XVNswJe+H+SXAAA7");background-repeat:no-repeat;background-position:left top;position:absolute;z-index:101;height:23px;width:11px;top:-2px;}#ng-callout{position:absolute;z-index:100;border:2px solid #CCCCCC;background-color:#fff;}#ng-callout .ng-content{padding:10px 10px 10px 10px;color:#333333;}#ng-callout .ng-title{background-color:#CCCCCC;text-align:left;padding-left:8px;padding-bottom:5px;padding-top:2px;font-weight:bold;}.ng-input-indicator-wait{background-image:url("data:image/png;base64,R0lGODlhEAAQAPQAAP///wAAAPDw8IqKiuDg4EZGRnp6egAAAFhYWCQkJKysrL6+vhQUFJycnAQEBDY2NmhoaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFdyAgAgIJIeWoAkRCCMdBkKtIHIngyMKsErPBYbADpkSCwhDmQCBethRB6Vj4kFCkQPG4IlWDgrNRIwnO4UKBXDufzQvDMaoSDBgFb886MiQadgNABAokfCwzBA8LCg0Egl8jAggGAA1kBIA1BAYzlyILczULC2UhACH5BAkKAAAALAAAAAAQABAAAAV2ICACAmlAZTmOREEIyUEQjLKKxPHADhEvqxlgcGgkGI1DYSVAIAWMx+lwSKkICJ0QsHi9RgKBwnVTiRQQgwF4I4UFDQQEwi6/3YSGWRRmjhEETAJfIgMFCnAKM0KDV4EEEAQLiF18TAYNXDaSe3x6mjidN1s3IQAh+QQJCgAAACwAAAAAEAAQAAAFeCAgAgLZDGU5jgRECEUiCI+yioSDwDJyLKsXoHFQxBSHAoAAFBhqtMJg8DgQBgfrEsJAEAg4YhZIEiwgKtHiMBgtpg3wbUZXGO7kOb1MUKRFMysCChAoggJCIg0GC2aNe4gqQldfL4l/Ag1AXySJgn5LcoE3QXI3IQAh+QQJCgAAACwAAAAAEAAQAAAFdiAgAgLZNGU5joQhCEjxIssqEo8bC9BRjy9Ag7GILQ4QEoE0gBAEBcOpcBA0DoxSK/e8LRIHn+i1cK0IyKdg0VAoljYIg+GgnRrwVS/8IAkICyosBIQpBAMoKy9dImxPhS+GKkFrkX+TigtLlIyKXUF+NjagNiEAIfkECQoAAAAsAAAAABAAEAAABWwgIAICaRhlOY4EIgjH8R7LKhKHGwsMvb4AAy3WODBIBBKCsYA9TjuhDNDKEVSERezQEL0WrhXucRUQGuik7bFlngzqVW9LMl9XWvLdjFaJtDFqZ1cEZUB0dUgvL3dgP4WJZn4jkomWNpSTIyEAIfkECQoAAAAsAAAAABAAEAAABX4gIAICuSxlOY6CIgiD8RrEKgqGOwxwUrMlAoSwIzAGpJpgoSDAGifDY5kopBYDlEpAQBwevxfBtRIUGi8xwWkDNBCIwmC9Vq0aiQQDQuK+VgQPDXV9hCJjBwcFYU5pLwwHXQcMKSmNLQcIAExlbH8JBwttaX0ABAcNbWVbKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICSRBlOY7CIghN8zbEKsKoIjdFzZaEgUBHKChMJtRwcWpAWoWnifm6ESAMhO8lQK0EEAV3rFopIBCEcGwDKAqPh4HUrY4ICHH1dSoTFgcHUiZjBhAJB2AHDykpKAwHAwdzf19KkASIPl9cDgcnDkdtNwiMJCshACH5BAkKAAAALAAAAAAQABAAAAV3ICACAkkQZTmOAiosiyAoxCq+KPxCNVsSMRgBsiClWrLTSWFoIQZHl6pleBh6suxKMIhlvzbAwkBWfFWrBQTxNLq2RG2yhSUkDs2b63AYDAoJXAcFRwADeAkJDX0AQCsEfAQMDAIPBz0rCgcxky0JRWE1AmwpKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICKZzkqJ4nQZxLqZKv4NqNLKK2/Q4Ek4lFXChsg5ypJjs1II3gEDUSRInEGYAw6B6zM4JhrDAtEosVkLUtHA7RHaHAGJQEjsODcEg0FBAFVgkQJQ1pAwcDDw8KcFtSInwJAowCCA6RIwqZAgkPNgVpWndjdyohACH5BAkKAAAALAAAAAAQABAAAAV5ICACAimc5KieLEuUKvm2xAKLqDCfC2GaO9eL0LABWTiBYmA06W6kHgvCqEJiAIJiu3gcvgUsscHUERm+kaCxyxa+zRPk0SgJEgfIvbAdIAQLCAYlCj4DBw0IBQsMCjIqBAcPAooCBg9pKgsJLwUFOhCZKyQDA3YqIQAh+QQJCgAAACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQJCgAAACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==");background-position:right;background-repeat:no-repeat;}</style>');
\ No newline at end of file
(function () {
var global = this,
root = (typeof ProvideCustomRxRootObject == "undefined") ? global.Rx : ProvideCustomRxRootObject();
var observable = root.Observable;
var observableCreate = observable.Create;
observable.FromAngularScope = function (angularScope, propertyName) {
return observableCreate(function (observer) {
var unwatch = angularScope.$watch(function(){
return angularScope[propertyName];
},
function(){
observer.OnNext(angularScope[propertyName]);
});
return function () {
unwatch();
};
})
.Skip(1); //In AngularJS 0.10.x There is no way to avoid initial evaluation. So we take care about it!
};
observable.prototype.ToOutputProperty = function (scope, propertyName) {
var disposable = this.Subscribe(function (data) {
scope[propertyName] = data;
scope.$apply();
});
scope.$on('$destroy', function(event){
//we need to asure that we only dispose the observable when it's our scope that
//was destroyed.
//TODO: Figure out if thats enough to asure the above (e.g what happens when
//a child scope will be destroyed but ours won't be affected. Or the other way around,
//if a higher scope will be destroyed (and therefore ours as well) does it mean that $destroy()
//will be also called on our scope or will our scope get destroyed without actually
//calling $destroy() on it?
if (event.targetScope === scope){
disposable.Dispose();
}
});
};
})();
\ No newline at end of file
// Copyright (c) Microsoft Corporation. All rights reserved.
// This code is licensed by Microsoft Corporation under the terms
// of the MICROSOFT REACTIVE EXTENSIONS FOR JAVASCRIPT AND .NET LIBRARIES License.
// See http://go.microsoft.com/fwlink/?LinkId=186234.
(function(){var a;var b;var c=this;var d="Index out of range";if(typeof ProvideCustomRxRootObject =="undefined")b=c.Rx={}; else b=ProvideCustomRxRootObject();var e=function(){};var f=function(){return new Date().getTime();};var g=function(r0,s0){return r0===s0;};var h=function(r0){return r0;};var i=function(r0){return {Dispose:r0};};var j={Dispose:e};b.Disposable={Create:i,Empty:j};var k=b.BooleanDisposable=function(){var r0=false;this.GetIsDisposed=function(){return r0;};this.Dispose=function(){r0=true;};};var l=function(r0){var s0=false;r0.a++;this.Dispose=function(){var t0=false;if(!r0.b){if(!this.c){this.c=true;r0.a--;if(r0.a==0&&r0.d){r0.b=true;t0=true;}}}if(t0)r0.e.Dispose();};};var m=b.RefCountDisposable=function(r0){this.d=false;this.b=false;this.e=r0;this.a=0;this.Dispose=function(){var s0=false;if(!this.b){if(!this.d){this.d=true;if(this.a==0){this.b=true;s0=true;}}}if(s0)this.e.Dispose();};this.GetDisposable=function(){if(this.b)return j; else return new l(this);};};var n=b.CompositeDisposable=function(){var r0=new q();for(var s0=0;s0<arguments.length;s0++) r0.Add(arguments[s0]);var t0=false;this.GetCount=function(){return r0.GetCount();};this.Add=function(u0){if(!t0)r0.Add(u0); else u0.Dispose();};this.Remove=function(u0,v0){if(!t0){var w0=r0.Remove(u0);if(!v0&w0)u0.Dispose();}};this.Dispose=function(){if(!t0){t0=true;this.Clear();}};this.Clear=function(){for(var u0=0;u0<r0.GetCount();u0++) r0.GetItem(u0).Dispose();r0.Clear();};};var o=b.MutableDisposable=function(){var r0=false;var s0;this.Get=function(){return s0;},this.Replace=function(t0){if(r0&&t0!==a)t0.Dispose(); else{if(s0!==a)s0.Dispose();s0=t0;}};this.Dispose=function(){if(!r0){r0=true;if(s0!==a)s0.Dispose();}};};var p=function(r0){var s0=[];for(var t0=0;t0<r0.length;t0++) s0.push(r0[t0]);return s0;};var q=b.List=function(r0){var s0=[];var t0=0;var u0=r0!==a?r0:g;this.Add=function(v0){s0[t0]=v0;t0++;};this.RemoveAt=function(v0){if(v0<0||v0>=t0)throw d;if(v0==0){s0.shift();t0--;}else{s0.splice(v0,1);t0--;}};this.IndexOf=function(v0){for(var w0=0;w0<t0;w0++){if(u0(v0,s0[w0]))return w0;}return -1;};this.Remove=function(v0){var w0=this.IndexOf(v0);if(w0==-1)return false;this.RemoveAt(w0);return true;};this.Clear=function(){s0=[];t0=0;};this.GetCount=function(){return t0;};this.GetItem=function(v0){if(v0<0||v0>=t0)throw d;return s0[v0];};this.SetItem=function(v0,w0){if(v0<0||v0>=t0)throw d;s0[v0]=w0;};this.ToArray=function(){var v0=[];for(var w0=0;w0<this.GetCount();w0++) v0.push(this.GetItem(w0));return v0;};};var r=function(r0){if(r0===null)r0=g;this.f=r0;var s0=4;this.g=new Array(s0);this.h=0;};r.prototype.i=function(r0,s0){return this.f(this.g[r0],this.g[s0])<0;};r.prototype.j=function(r0){if(r0>=this.h||r0<0)return;var s0=r0-1>>1;if(s0<0||s0==r0)return;if(this.i(r0,s0)){var t0=this.g[r0];this.g[r0]=this.g[s0];this.g[s0]=t0;this.j(s0);}};r.prototype.k=function(r0){if(r0===a)r0=0;var s0=2*r0+1;var t0=2*r0+2;var u0=r0;if(s0<this.h&&this.i(s0,u0))u0=s0;if(t0<this.h&&this.i(t0,u0))u0=t0;if(u0!=r0){var v0=this.g[r0];this.g[r0]=this.g[u0];this.g[u0]=v0;this.k(u0);}};r.prototype.GetCount=function(){return this.h;};r.prototype.Peek=function(){if(this.h==0)throw "Heap is empty.";return this.g[0];};r.prototype.Dequeue=function(){var r0=this.Peek();this.g[0]=this.g[--this.h];delete this.g[this.h];this.k();return r0;};r.prototype.Enqueue=function(r0){var s0=this.h++;this.g[s0]=r0;this.j(s0);};var s=b.Scheduler=function(r0,s0,t0){this.Schedule=r0;this.ScheduleWithTime=s0;this.Now=t0;this.ScheduleRecursive=function(u0){var v0=this;var w0=new n();var x0;x0=function(){u0(function(){var y0=false;var z0=false;var A0;A0=v0.Schedule(function(){x0();if(y0)w0.Remove(A0); else z0=true;});if(!z0){w0.Add(A0);y0=true;}});};w0.Add(v0.Schedule(x0));return w0;};this.ScheduleRecursiveWithTime=function(u0,v0){var w0=this;var x0=new n();var y0;y0=function(){u0(function(z0){var A0=false;var B0=false;var C0;C0=w0.ScheduleWithTime(function(){y0();if(A0)x0.Remove(C0); else B0=true;},z0);if(!B0){x0.Add(C0);A0=true;}});};x0.Add(w0.ScheduleWithTime(y0,v0));return x0;};};var t=b.VirtualScheduler=function(r0,s0,t0,u0){var v0=new s(function(w0){return this.ScheduleWithTime(w0,0);},function(w0,x0){return this.ScheduleVirtual(w0,u0(x0));},function(){return t0(this.l);});v0.ScheduleVirtual=function(w0,x0){var y0=new k();var z0=s0(this.l,x0);var A0=function(){if(!y0.IsDisposed)w0();};var B0=new y(A0,z0);this.m.Enqueue(B0);return y0;};v0.Run=function(){while(this.m.GetCount()>0){var w0=this.m.Dequeue();this.l=w0.n;w0.o();}};v0.RunTo=function(w0){while(this.m.GetCount()>0&&this.f(this.m.Peek().n,w0)<=0){var x0=this.m.Dequeue();this.l=x0.n;x0.o();}};v0.GetTicks=function(){return this.l;};v0.l=0;v0.m=new r(function(w0,x0){return r0(w0.n,x0.n);});v0.f=r0;return v0;};var u=b.TestScheduler=function(){var r0=new t(function(s0,t0){return s0-t0;},function(s0,t0){return s0+t0;},function(s0){return new Date(s0);},function(s0){if(s0<=0)return 1;return s0;});return r0;};var v=new s(function(r0){return this.ScheduleWithTime(r0,0);},function(r0,s0){var t0=this.Now()+s0;var u0=new y(r0,t0);if(this.m===a){var v0=new w();try{this.m.Enqueue(u0);v0.p();}finally{v0.q();}}else this.m.Enqueue(u0);return u0.r();},f);v.s=function(r0){if(this.m===a){var s0=new w();try{r0();s0.p();}finally{s0.q();}}else r0();};s.CurrentThread=v;var w=function(){v.m=new r(function(r0,s0){try{return r0.n-s0.n;}catch(t0){debugger;}});this.q=function(){v.m=a;};this.p=function(){while(v.m.GetCount()>0){var r0=v.m.Dequeue();if(!r0.t()){while(r0.n-v.Now()>0);if(!r0.t())r0.o();}}};};var x=0;var y=function(r0,s0){this.u=x++;this.o=r0;this.n=s0;this.v=new k();this.t=function(){return this.v.GetIsDisposed();};this.r=function(){return this.v;};};var z=new s(function(r0){r0();return j;},function(r0,s0){while(this.Now<s0);r0();},f);s.Immediate=z;var A=new s(function(r0){var s0=c.setTimeout(r0,0);return i(function(){c.clearTimeout(s0);});},function(r0,s0){var t0=c.setTimeout(r0,s0);return i(function(){c.clearTimeout(t0);});},f);s.Timeout=A;var B=b.Observer=function(r0,s0,t0){this.OnNext=r0===a?e:r0;this.OnError=s0===a?function(u0){throw u0;}:s0;this.OnCompleted=t0===a?e:t0;this.AsObserver=function(){var u0=this;return new B(function(v0){u0.OnNext(v0);},function(v0){u0.OnError(v0);},function(){u0.OnCompleted();});};};var C=B.Create=function(r0,s0,t0){return new B(r0,s0,t0);};var D=b.Observable=function(r0){this.w=r0;};var E=D.CreateWithDisposable=function(r0){return new D(r0);};var F=D.Create=function(r0){return E(function(s0){return i(r0(s0));});};var G=function(){return this.Select(function(r0){return r0.Value;});};D.prototype={Subscribe:function(r0,s0,t0){var u0;if(arguments.length==0||arguments.length>1||typeof r0 =="function")u0=new B(r0,s0,t0); else u0=r0;return this.x(u0);},x:function(r0){var s0=false;var t0=new o();var u0=this;v.s(function(){var v0=new B(function(w0){if(!s0)r0.OnNext(w0);},function(w0){if(!s0){s0=true;t0.Dispose();r0.OnError(w0);}},function(){if(!s0){s0=true;t0.Dispose();r0.OnCompleted();}});t0.Replace(u0.w(v0));});return new n(t0,i(function(){s0=true;}));},Select:function(r0){var s0=this;return E(function(t0){var u0=0;return s0.Subscribe(new B(function(v0){var w0;try{w0=r0(v0,u0++);}catch(x0){t0.OnError(x0);return;}t0.OnNext(w0);},function(v0){t0.OnError(v0);},function(){t0.OnCompleted();}));});},Let:function(r0,s0){if(s0===a)return r0(this);var t0=this;return E(function(u0){var v0=s0();var w0;try{w0=r0(v0);}catch(A0){return L(A0).Subscribe(u0);}var x0=new o();var y0=new o();var z0=new n(y0,x0);x0.Replace(w0.Subscribe(function(A0){u0.OnNext(A0);},function(A0){u0.OnError(A0);z0.Dispose();},function(){u0.OnCompleted();z0.Dispose();}));y0.Replace(t0.Subscribe(v0));return z0;});},MergeObservable:function(){var r0=this;return E(function(s0){var t0=false;var u0=new n();var v0=new o();u0.Add(v0);v0.Replace(r0.Subscribe(function(w0){var x0=new o();u0.Add(x0);x0.Replace(w0.Subscribe(function(y0){s0.OnNext(y0);},function(y0){s0.OnError(y0);},function(){u0.Remove(x0);if(u0.GetCount()==1&&t0)s0.OnCompleted();}));},function(w0){s0.OnError(w0);},function(){t0=true;if(u0.GetCount()==1)s0.OnCompleted();}));return u0;});},y:function(r0,s0){var t0=p(s0);t0.unshift(this);return r0(t0);},Concat:function(){return this.y(I,arguments);},Merge:function(){return this.y(H,arguments);},Catch:function(){return this.y(P,arguments);},OnErrorResumeNext:function(){return this.y(V,arguments);},Zip:function(r0,s0){var t0=this;return E(function(u0){var v0=false;var w0=[];var x0=[];var y0=false;var z0=false;var A0=new n();var B0=function(C0){A0.Dispose();w0=a;x0=a;u0.OnError(C0);};A0.Add(t0.Subscribe(function(C0){if(z0){u0.OnCompleted();return;}if(x0.length>0){var D0=x0.shift();var E0;try{E0=s0(C0,D0);}catch(F0){A0.Dispose();u0.OnError(F0);return;}u0.OnNext(E0);}else w0.push(C0);},B0,function(){if(z0){u0.OnCompleted();return;}y0=true;}));A0.Add(r0.Subscribe(function(C0){if(y0){u0.OnCompleted();return;}if(w0.length>0){var D0=w0.shift();var E0;try{E0=s0(D0,C0);}catch(F0){A0.Dispose();u0.OnError(F0);return;}u0.OnNext(E0);}else x0.push(C0);},B0,function(){if(y0){u0.OnCompleted();return;}z0=true;}));return A0;});},CombineLatest:function(r0,s0){var t0=this;return E(function(u0){var v0=false;var w0=false;var x0=false;var y0;var z0;var A0=false;var B0=false;var C0=new n();var D0=function(E0){C0.Dispose();u0.OnError(E0);};C0.Add(t0.Subscribe(function(E0){if(B0){u0.OnCompleted();return;}if(x0){var F0;try{F0=s0(E0,z0);}catch(G0){C0.Dispose();u0.OnError(G0);return;}u0.OnNext(F0);}y0=E0;w0=true;},D0,function(){if(B0){u0.OnCompleted();return;}A0=true;}));C0.Add(r0.Subscribe(function(E0){if(A0){u0.OnCompleted();return;}if(w0){var F0;try{F0=s0(y0,E0);}catch(G0){C0.Dispose();u0.OnError(G0);return;}u0.OnNext(F0);}z0=E0;x0=true;},D0,function(){if(A0){u0.OnCompleted();return;}B0=true;}));});},Switch:function(){var r0=this;return E(function(s0){var t0=false;var u0=new o();var v0=new o();v0.Replace(r0.Subscribe(function(w0){if(!t0){var x0=new o();x0.Replace(w0.Subscribe(function(y0){s0.OnNext(y0);},function(y0){v0.Dispose();u0.Dispose();s0.OnError(y0);},function(){u0.Replace(a);if(t0)s0.OnCompleted();}));u0.Replace(x0);}},function(w0){u0.Dispose();s0.OnError(w0);},function(){t0=true;if(u0.Get()===a)s0.OnCompleted();}));return new n(v0,u0);});},TakeUntil:function(r0){var s0=this;return E(function(t0){var u0=new n();u0.Add(r0.Subscribe(function(){t0.OnCompleted();u0.Dispose();},function(v0){t0.OnError(v0);},function(){}));u0.Add(s0.Subscribe(t0));return u0;});},SkipUntil:function(r0){var s0=this;return E(function(t0){var u0=true;var v0=new n();v0.Add(r0.Subscribe(function(){u0=false;},function(w0){t0.OnError(w0);},e));v0.Add(s0.Subscribe(new B(function(w0){if(!u0)t0.OnNext(w0);},function(w0){t0.OnError(w0);},function(){if(!u0)t0.OnCompleted();})));return v0;});},Scan1:function(r0){var s0=this;return O(function(){var t0;var u0=false;return s0.Select(function(v0){if(u0)t0=r0(t0,v0); else{t0=v0;u0=true;}return t0;});});},Scan:function(r0,s0){var t0=this;return O(function(){var u0;var v0=false;return t0.Select(function(w0){if(v0)u0=s0(u0,w0); else{u0=s0(r0,w0);v0=true;}return u0;});});},Scan0:function(r0,s0){var t0=this;return E(function(u0){var v0=r0;var w0=true;return t0.Subscribe(function(x0){if(w0){w0=false;u0.OnNext(v0);}try{v0=s0(v0,x0);}catch(y0){u0.OnError(y0);return;}u0.OnNext(v0);},function(x0){if(w0)u0.OnNext(v0);u0.OnError(x0);},function(){if(w0)u0.OnNext(v0);u0.OnCompleted();});});},Finally:function(r0){var s0=this;return F(function(t0){var u0=s0.Subscribe(t0);return function(){try{u0.Dispose();r0();}catch(v0){r0();throw v0;}};});},Do:function(r0,s0,t0){var u0;if(arguments.length==0||arguments.length>1||typeof r0 =="function")u0=new B(r0,s0!==a?s0:e,t0); else u0=r0;var v0=this;return E(function(w0){return v0.Subscribe(new B(function(x0){try{u0.OnNext(x0);}catch(y0){w0.OnError(y0);return;}w0.OnNext(x0);},function(x0){if(s0!==a)try{u0.OnError(x0);}catch(y0){w0.OnError(y0);return;}w0.OnError(x0);},function(){if(t0!==a)try{u0.OnCompleted();}catch(x0){w0.OnError(x0);return;}w0.OnCompleted();}));});},Where:function(r0){var s0=this;return E(function(t0){var u0=0;return s0.Subscribe(new B(function(v0){var w0=false;try{w0=r0(v0,u0++);}catch(x0){t0.OnError(x0);return;}if(w0)t0.OnNext(v0);},function(v0){t0.OnError(v0);},function(){t0.OnCompleted();}));});},Take:function(r0,s0){if(s0===a)s0=z;var t0=this;return E(function(u0){if(r0<=0){t0.Subscribe().Dispose();return N(s0).Subscribe(u0);}var v0=r0;return t0.Subscribe(new B(function(w0){if(v0-->0){u0.OnNext(w0);if(v0==0)u0.OnCompleted();}},function(w0){u0.OnError(w0);},function(){u0.OnCompleted();}));});},GroupBy:function(r0,s0,t0){if(r0===a)r0=h;if(s0===a)s0=h;if(t0===a)t0=function(v0){return v0.toString();};var u0=this;return E(function(v0){var w0={};var x0=new o();var y0=new m(x0);x0.Replace(u0.Subscribe(function(z0){var A0;try{A0=r0(z0);}catch(G0){for(var H0 in w0) w0[H0].OnError(G0);v0.OnError(G0);return;}var B0=false;var C0;try{var D0=t0(A0);if(w0[D0]===a){C0=new i0();w0[D0]=C0;B0=true;}else C0=w0[D0];}catch(G0){for(var H0 in w0) w0[H0].OnError(G0);v0.OnError(G0);return;}if(B0){var E0=E(function(G0){return new n(y0.GetDisposable(),C0.Subscribe(G0));});E0.Key=A0;v0.OnNext(E0);}var F0;try{F0=s0(z0);}catch(G0){for(var H0 in w0) w0[H0].OnError(G0);v0.OnError(G0);return;}C0.OnNext(F0);},function(z0){for(var A0 in w0) w0[A0].OnError(z0);v0.OnError(z0);},function(){for(var z0 in w0) w0[z0].OnCompleted();v0.OnCompleted();}));return y0;});},TakeWhile:function(r0){var s0=this;return E(function(t0){var u0=true;return s0.Subscribe(new B(function(v0){if(u0){try{u0=r0(v0);}catch(w0){t0.OnError(w0);return;}if(u0)t0.OnNext(v0); else t0.OnCompleted();}},function(v0){t0.OnError(v0);},function(){t0.OnCompleted();}));});},SkipWhile:function(r0){var s0=this;return E(function(t0){var u0=false;return s0.Subscribe(new B(function(v0){if(!u0)try{u0=!r0(v0);}catch(w0){t0.OnError(w0);return;}if(u0)t0.OnNext(v0);},function(v0){t0.OnError(v0);},function(){t0.OnCompleted();}));});},Skip:function(r0){var s0=this;return E(function(t0){var u0=r0;return s0.Subscribe(new B(function(v0){if(u0--<=0)t0.OnNext(v0);},function(v0){t0.OnError(v0);},function(){t0.OnCompleted();}));});},SelectMany:function(r0){return this.Select(r0).MergeObservable();},TimeInterval:function(r0){if(r0===a)r0=z;var s0=this;return O(function(){var t0=r0.Now();return s0.Select(function(u0){var v0=r0.Now();var w0=v0-t0;t0=v0;return {Interval:w0,Value:u0};});});},RemoveInterval:G,Timestamp:function(r0){if(r0===a)r0=z;return this.Select(function(s0){return {Timestamp:r0.Now(),Value:s0};});},RemoveTimestamp:G,Materialize:function(){var r0=this;return E(function(s0){return r0.Subscribe(new B(function(t0){s0.OnNext(new h0("N",t0));},function(t0){s0.OnNext(new h0("E",t0));s0.OnCompleted();},function(){s0.OnNext(new h0("C"));s0.OnCompleted();}));});},Dematerialize:function(){return this.SelectMany(function(r0){return r0;});},AsObservable:function(){var r0=this;return E(function(s0){return r0.Subscribe(s0);});},Delay:function(r0,s0){if(s0===a)s0=A;var t0=this;return E(function(u0){var v0=[];var w0=false;var x0=new o();var y0=t0.Materialize().Timestamp().Subscribe(function(z0){if(z0.Value.Kind=="E"){u0.OnError(z0.Value.Value);v0=[];if(w0)x0.Dispose();return;}v0.push({Timestamp:s0.Now()+r0,Value:z0.Value});if(!w0){x0.Replace(s0.ScheduleRecursiveWithTime(function(A0){var B0;do{B0=a;if(v0.length>0&&v0[0].Timestamp<=s0.Now())B0=v0.shift().Value;if(B0!==a)B0.Accept(u0);}while(B0!==a);if(v0.length>0){A0(Math.max(0,v0[0].Timestamp-s0.Now()));w0=true;}else w0=false;},r0));w0=true;}});return new n(y0,x0);});},Throttle:function(r0,s0){if(s0===a)s0=A;var t0=this;return E(function(u0){var v0;var w0=false;var x0=new o();var y0=0;var z0=t0.Subscribe(function(A0){w0=true;v0=A0;y0++;var B0=y0;x0.Replace(s0.ScheduleWithTime(function(){if(w0&&y0==B0)u0.OnNext(v0);w0=false;},r0));},function(A0){x0.Dispose();u0.OnError(A0);w0=false;y0++;},function(){x0.Dispose();if(w0)u0.OnNext(v0);u0.OnCompleted();w0=false;y0++;});return new n(z0,x0);});},Timeout:function(r0,s0,t0){if(t0===a)t0=A;if(s0===a)s0=L("Timeout",t0);var u0=this;return E(function(v0){var w0=new o();var x0=new o();var y0=0;var z0=y0;var A0=false;x0.Replace(t0.ScheduleWithTime(function(){A0=y0==z0;if(A0)w0.Replace(s0.Subscribe(v0));},r0));w0.Replace(u0.Subscribe(function(B0){var C0=0;if(!A0){y0++;C0=y0;v0.OnNext(B0);x0.Replace(t0.ScheduleWithTime(function(){A0=y0==C0;if(A0)w0.Replace(s0.Subscribe(v0));},r0));}},function(B0){if(!A0){y0++;v0.OnError(B0);}},function(){if(!A0){y0++;v0.OnCompleted();}}));return new n(w0,x0);});},Sample:function(r0,s0){if(s0===a)s0=A;var t0=this;return E(function(u0){var v0=false;var w0;var x0=false;var y0=new n();y0.Add(Y(r0,s0).Subscribe(function(z0){if(v0){u0.OnNext(w0);v0=false;}if(x0)u0.OnCompleted();},function(z0){u0.OnError(z0);},function(){u0.OnCompleted();}));y0.Add(t0.Subscribe(function(z0){v0=true;w0=z0;},function(z0){u0.OnError(z0);y0.Dispose();},function(){x0=true;}));return y0;});},Repeat:function(r0,s0){var t0=this;if(s0===a)s0=z;if(r0===a)r0=-1;return E(function(u0){var v0=r0;var w0=new o();var x0=new n(w0);var y0=function(z0){w0.Replace(t0.Subscribe(function(A0){u0.OnNext(A0);},function(A0){u0.OnError(A0);},function(){if(v0>0){v0--;if(v0==0){u0.OnCompleted();return;}}z0();}));};x0.Add(s0.ScheduleRecursive(y0));return x0;});},Retry:function(r0,s0){var t0=this;if(s0===a)s0=z;if(r0===a)r0=-1;return E(function(u0){var v0=r0;var w0=new o();var x0=new n(w0);var y0=function(z0){w0.Replace(t0.Subscribe(function(A0){u0.OnNext(A0);},function(A0){if(v0>0){v0--;if(v0==0){u0.OnError(A0);return;}}z0();},function(){u0.OnCompleted();}));};x0.Add(s0.ScheduleRecursive(y0));return x0;});},BufferWithTime:function(r0,s0,t0){if(t0===a)t0=A;if(s0===a)s0=r0;var u0=this;return E(function(v0){var w0=new q();var x0=t0.Now();var y0=function(){var C0=[];for(var D0=0;D0<w0.GetCount();D0++){var E0=w0.GetItem(D0);if(E0.Timestamp-x0>=0)C0.push(E0.Value);}return C0;};var z0=new n();var A0=function(C0){v0.OnError(C0);};var B0=function(){v0.OnNext(y0());v0.OnCompleted();};z0.Add(u0.Subscribe(function(C0){w0.Add({Value:C0,Timestamp:t0.Now()});},A0,B0));z0.Add(a0(r0,s0,t0).Subscribe(function(C0){var D0=y0();var E0=t0.Now()+s0-r0;while(w0.GetCount()>0&&w0.GetItem(0).Timestamp-E0<=0)w0.RemoveAt(0);v0.OnNext(D0);x0=E0;},A0,B0));return z0;});},BufferWithTimeOrCount:function(r0,s0,t0){if(t0===a)t0=A;var u0=this;return E(function(v0){var w0=0;var x0=new q();var y0=function(){v0.OnNext(x0.ToArray());x0.Clear();w0++;};var z0=new o();var A0;A0=function(C0){var D0=t0.ScheduleWithTime(function(){var E0=false;var F0=0;if(C0==w0){y0();F0=w0;E0=true;}if(E0)A0(F0);},r0);z0.Replace(D0);};A0(w0);var B0=u0.Subscribe(function(C0){var D0=false;var E0=0;x0.Add(C0);if(x0.GetCount()==s0){y0();E0=w0;D0=true;}if(D0)A0(E0);},function(C0){v0.OnError(C0);x0.Clear();},function(){v0.OnNext(x0.ToArray());w0++;v0.OnCompleted();x0.Clear();});return new n(B0,z0);});},BufferWithCount:function(r0,s0){if(s0===a)s0=r0;var t0=this;return E(function(u0){var v0=[];var w0=0;return t0.Subscribe(function(x0){if(w0==0)v0.push(x0); else w0--;var y0=v0.length;if(y0==r0){var z0=v0;v0=[];var A0=Math.min(s0,y0);for(var B0=A0;B0<y0;B0++) v0.push(z0[B0]);w0=Math.max(0,s0-r0);u0.OnNext(z0);}},function(x0){u0.OnError(x0);},function(){if(v0.length>0)u0.OnNext(v0);u0.OnCompleted();});});},StartWith:function(r0,s0){if(!(r0 instanceof Array))r0=[r0];if(s0===a)s0=z;var t0=this;return E(function(u0){var v0=new n();var w0=0;v0.Add(s0.ScheduleRecursive(function(x0){if(w0<r0.length){u0.OnNext(r0[w0]);w0++;x0();}else v0.Add(t0.Subscribe(u0));}));return v0;});},DistinctUntilChanged:function(r0,s0){if(r0===a)r0=h;if(s0===a)s0=g;var t0=this;return E(function(u0){var v0;var w0=false;return t0.Subscribe(function(x0){var y0;try{y0=r0(x0);}catch(A0){u0.OnError(A0);return;}var z0=false;if(w0)try{z0=s0(v0,y0);}catch(A0){u0.OnError(A0);return;}if(!w0||!z0){w0=true;v0=y0;u0.OnNext(x0);}},function(x0){u0.OnError(x0);},function(){u0.OnCompleted();});});},Publish:function(r0){if(r0===a)return new q0(this,new i0());var s0=this;return E(function(t0){var u0=new q0(s0,new i0());return new n(r0(u0).Subscribe(B),u0.Connect());});},Prune:function(r0,s0){if(s0===a)s0=z;if(r0===a)return new q0(this,new k0(s0));var t0=this;return E(function(u0){var v0=new q0(t0,new k0(s0));return new n(r0(v0).Subscribe(B),v0.Connect());});},Replay:function(r0,s0,t0,u0){if(u0===a)u0=v;if(r0===a)return new q0(this,new m0(s0,t0,u0));var v0=this;return E(function(w0){var x0=new q0(v0,new m0(s0,t0,u0));return new n(r0(x0).Subscribe(B),x0.Connect());});},SkipLast:function(r0){var s0=this;return E(function(t0){var u0=[];return s0.Subscribe(function(v0){u0.push(v0);if(u0.length>r0)t0.OnNext(u0.shift());},function(v0){t0.OnError(v0);},function(){t0.OnCompleted();});});},TakeLast:function(r0){var s0=this;return E(function(t0){var u0=[];return s0.Subscribe(function(v0){u0.push(v0);if(u0.length>r0)u0.shift();},function(v0){t0.OnError(v0);},function(){while(u0.length>0)t0.OnNext(u0.shift());t0.OnCompleted();});});}};var H=D.Merge=function(r0,s0){if(s0===a)s0=z;return J(r0,s0).MergeObservable();};var I=D.Concat=function(r0,s0){if(s0===a)s0=z;return E(function(t0){var u0=new o();var v0=0;var w0=s0.ScheduleRecursive(function(x0){if(v0<r0.length){var y0=r0[v0];v0++;var z0=new o();u0.Replace(z0);z0.Replace(y0.Subscribe(function(A0){t0.OnNext(A0);},function(A0){t0.OnError(A0);},x0));}else t0.OnCompleted();});return new n(u0,w0);});};var J=D.FromArray=function(r0,s0){if(s0===a)s0=z;return E(function(t0){var u0=0;return s0.ScheduleRecursive(function(v0){if(u0<r0.length){t0.OnNext(r0[u0++]);v0();}else t0.OnCompleted();});});};var K=D.Return=function(r0,s0){if(s0===a)s0=z;return E(function(t0){return s0.Schedule(function(){t0.OnNext(r0);t0.OnCompleted();});});};var L=D.Throw=function(r0,s0){if(s0===a)s0=z;return E(function(t0){return s0.Schedule(function(){t0.OnError(r0);});});};var M=D.Never=function(){return E(function(r0){return j;});};var N=D.Empty=function(r0){if(r0===a)r0=z;return E(function(s0){return r0.Schedule(function(){s0.OnCompleted();});});};var O=D.Defer=function(r0){return E(function(s0){var t0;try{t0=r0();}catch(u0){s0.OnError(u0);return j;}return t0.Subscribe(s0);});};var P=D.Catch=function(r0,s0){if(s0===a)s0=z;return E(function(t0){var u0=new o();var v0=0;var w0=s0.ScheduleRecursive(function(x0){var y0=r0[v0];v0++;var z0=new o();u0.Replace(z0);z0.Replace(y0.Subscribe(function(A0){t0.OnNext(A0);},function(A0){if(v0<r0.length)x0(); else t0.OnError(A0);},function(){t0.OnCompleted();}));});return new n(u0,w0);});};var Q=D.Using=function(r0,s0){return E(function(t0){var u0;var v0=j;try{var w0=r0();if(w0!==a)v0=w0;u0=s0(w0);}catch(x0){return new n(Throw(x0).Subscribe(t0),v0);}return new n(u0.Subscribe(t0),v0);});};var R=D.Range=function(r0,s0,t0){if(t0===a)t0=z;var u0=r0+s0-1;return T(r0,function(v0){return v0<=u0;},function(v0){return v0+1;},h,t0);};var S=D.Repeat=function(r0,s0,t0){if(t0===a)t0=z;if(s0===a)s0=-1;var u0=s0;return E(function(v0){return t0.ScheduleRecursive(function(w0){v0.OnNext(r0);if(u0>0){u0--;if(u0==0){v0.OnCompleted();return;}}w0();});});};var T=D.Generate=function(r0,s0,t0,u0,v0){if(v0===a)v0=z;return E(function(w0){var x0=r0;var y0=true;return v0.ScheduleRecursive(function(z0){var A0=false;var B0;try{if(y0)y0=false; else x0=t0(x0);A0=s0(x0);if(A0)B0=u0(x0);}catch(C0){w0.OnError(C0);return;}if(A0){w0.OnNext(B0);z0();}else w0.OnCompleted();});});};var U=D.GenerateWithTime=function(r0,s0,t0,u0,v0,w0){if(w0===a)w0=A;return new E(function(x0){var y0=r0;var z0=true;var A0=false;var B0;var C0;return w0.ScheduleRecursiveWithTime(function(D0){if(A0)x0.OnNext(B0);try{if(z0)z0=false; else y0=t0(y0);A0=s0(y0);if(A0){B0=u0(y0);C0=v0(y0);}}catch(E0){x0.OnError(E0);return;}if(A0)D0(C0); else x0.OnCompleted();},0);});};var V=D.OnErrorResumeNext=function(r0,s0){if(s0===a)s0=z;return E(function(t0){var u0=new o();var v0=0;var w0=s0.ScheduleRecursive(function(x0){if(v0<r0.length){var y0=r0[v0];v0++;var z0=new o();u0.Replace(z0);z0.Replace(y0.Subscribe(function(A0){t0.OnNext(A0);},x0,x0));}else t0.OnCompleted();});return new n(u0,w0);});};var W=D.Amb=function(){var r0=arguments;return E(function(s0){var t0=new n();var u0=new o();u0.Replace(t0);var v0=false;for(var w0=0;w0<r0.length;w0++){var x0=r0[w0];var y0=new o();var z0=new B(function(A0){if(!v0){t0.Remove(this.z,true);t0.Dispose();u0.Replace(this.z);v0=true;}s0.OnNext(A0);},function(A0){s0.OnError(A0);u0.Dispose();},function(){s0.OnCompleted();u0.Dispose();});z0.z=y0;y0.Replace(x0.Subscribe(z0));t0.Add(y0);}return u0;});};var X=D.ForkJoin=function(){var r0=arguments;return E(function(s0){var t0=[];var u0=[];var v0=[];var w0=new n();for(var x0=0;x0<r0.length;x0++) (function(y0){w0.Add(r0[y0].Subscribe(function(z0){t0[y0]=true;v0[y0]=z0;},function(z0){s0.OnError(z0);},function(z0){if(!t0[y0]){s0.OnCompleted();v0=a;t0=a;return;}u0[y0]=true;var A0=true;for(var B0=0;B0<r0.length;B0++){if(!u0[B0])A0=false;}if(A0){s0.OnNext(v0);s0.OnCompleted();v0=a;u0=a;t0=a;}}));})(x0);return w0;});};var Y=D.Interval=function(r0,s0){return a0(r0,r0,s0);};var Z=function(r0){return Math.max(0,r0);};var a0=D.Timer=function(r0,s0,t0){if(t0===a)t0=A;if(r0===a)return M();if(r0 instanceof Date)return O(function(){return D.Timer(r0-new Date(),s0,t0);});var u0=Z(r0);if(s0===a)return E(function(w0){return t0.ScheduleWithTime(function(){w0.OnNext(0);w0.OnCompleted();},u0);});var v0=Z(s0);return E(function(w0){var x0=0;return t0.ScheduleRecursiveWithTime(function(y0){w0.OnNext(x0++);y0(v0);},u0);});};var b0=D.While=function(r0,s0){return E(function(t0){var u0=new o();var v0=new n(u0);v0.Add(z.ScheduleRecursive(function(w0){var x0;try{x0=r0();}catch(y0){t0.OnError(y0);return;}if(x0)u0.Replace(s0.Subscribe(function(y0){t0.OnNext(y0);},function(y0){t0.OnError(y0);},function(){w0();})); else t0.OnCompleted();}));return v0;});};var c0=D.If=function(r0,s0,t0){if(t0===a)t0=N();return O(function(){return r0()?s0:t0;});};var d0=D.DoWhile=function(r0,s0){return I([r0,b0(s0,r0)]);};var e0=D.Case=function(r0,s0,t0,u0){if(u0===a)u0=z;if(t0===a)t0=N(u0);return O(function(){var v0=s0[r0()];if(v0===a)v0=t0;return v0;});};var f0=D.For=function(r0,s0){return E(function(t0){var u0=new n();var v0=0;u0.Add(z.ScheduleRecursive(function(w0){if(v0<r0.length){var x0;try{x0=s0(r0[v0]);}catch(y0){t0.OnError(y0);return;}u0.Add(x0.Subscribe(function(y0){t0.OnNext(y0);},function(y0){t0.OnError(y0);},function(){v0++;w0();}));}else t0.OnCompleted();}));return u0;});};var g0=D.Let=function(r0,s0){return O(function(){return s0(r0);});};var h0=b.Notification=function(r0,s0){this.Kind=r0;this.Value=s0;this.toString=function(){return this.Kind+": "+this.Value;};this.Accept=function(t0){switch(this.Kind){case "N":t0.OnNext(this.Value);break;case "E":t0.OnError(this.Value);break;case "C":t0.OnCompleted();break;}return j;};this.w=function(t0){var u0=this.Accept(t0);if(r0=="N")t0.OnCompleted();return u0;};};h0.prototype=new D;var i0=b.Subject=function(){var r0=new q();var s0=false;this.OnNext=function(t0){if(!s0){var u0=r0.ToArray();for(var v0=0;v0<u0.length;v0++){var w0=u0[v0];w0.OnNext(t0);}}};this.OnError=function(t0){if(!s0){var u0=r0.ToArray();for(var v0=0;v0<u0.length;v0++){var w0=u0[v0];w0.OnError(t0);}s0=true;r0.Clear();}};this.OnCompleted=function(){if(!s0){var t0=r0.ToArray();for(var u0=0;u0<t0.length;u0++){var v0=t0[u0];v0.OnCompleted();}s0=true;r0.Clear();}};this.w=function(t0){if(!s0){r0.Add(t0);return i(function(){r0.Remove(t0);});}else return j;};};i0.prototype=new D;for(var j0 in B.prototype) i0.prototype[j0]=B.prototype[j0];var k0=b.AsyncSubject=function(r0){var s0=new q();var t0;var u0=false;if(r0===a)r0=z;this.OnNext=function(v0){if(!u0)t0=new h0("N",v0);};this.OnError=function(v0){if(!u0){t0=new h0("E",v0);var w0=s0.ToArray();for(var x0=0;x0<w0.length;x0++){var y0=w0[x0];if(y0!==a)y0.OnError(v0);}u0=true;s0.Clear();}};this.OnCompleted=function(){if(!u0){if(t0===a)t0=new h0("C");var v0=s0.ToArray();for(var w0=0;w0<v0.length;w0++){var x0=v0[w0];if(x0!==a)t0.w(x0);}u0=true;s0.Clear();}};this.w=function(v0){if(!u0){s0.Add(v0);return i(function(){s0.Remove(v0);});}else return r0.Schedule(function(){t0.w(v0);});};};k0.prototype=new i0;var l0=b.BehaviorSubject=function(r0,s0){var t0=new m0(1,-1,s0);t0.OnNext(r0);return t0;};var m0=b.ReplaySubject=function(r0,s0,t0){var u0=new q();var v0=new q();var w0=false;if(t0===a)t0=v;var x0=s0>0;var y0=function(z0,A0){v0.Add({Value:new h0(z0,A0),Timestamp:t0.Now()});};this.A=function(){if(r0!==a)while(v0.GetCount()>r0)v0.RemoveAt(0);if(x0)while(v0.GetCount()>0&&t0.Now()-v0.GetItem(0).Timestamp>s0)v0.RemoveAt(0);};this.OnNext=function(z0){if(!w0){var A0=u0.ToArray();for(var B0=0;B0<A0.length;B0++){var C0=A0[B0];C0.OnNext(z0);}y0("N",z0);}};this.OnError=function(z0){if(!w0){var A0=u0.ToArray();for(var B0=0;B0<A0.length;B0++){var C0=A0[B0];C0.OnError(z0);}w0=true;u0.Clear();y0("E",z0);}};this.OnCompleted=function(){if(!w0){var z0=u0.ToArray();for(var A0=0;A0<z0.length;A0++){var B0=z0[A0];B0.OnCompleted();}w0=true;u0.Clear();y0("C");}};this.w=function(z0){var A0=new n0(this,z0);var B0=new n(A0);var C0=this;B0.Add(t0.Schedule(function(){if(!A0.B){C0.A();for(var D0=0;D0<v0.GetCount();D0++) v0.GetItem(D0).Value.Accept(z0);u0.Add(z0);A0.C=true;}}));return B0;};this.D=function(z0){u0.Remove(z0);};};m0.prototype=new i0;var n0=function(r0,s0){this.E=r0;this.F=s0;this.C=false;this.B=false;this.Dispose=function(){if(this.C)this.E.D(this.F);this.B=true;};};var o0=D.ToAsync=function(r0,s0){if(s0===a)s0=A;return function(){var t0=new k0(s0);var u0=function(){var x0;try{x0=r0.apply(this,arguments);}catch(y0){t0.OnError(y0);return;}t0.OnNext(x0);t0.OnCompleted();};var v0=this;var w0=p(arguments);s0.Schedule(function(){u0.apply(v0,w0);});return t0;};};var p0=D.Start=function(r0,s0,t0,u0){if(t0===a)t0=[];return o0(r0,u0).apply(s0,t0);};var q0=b.ConnectableObservable=function(r0,s0){if(s0===a)s0=new i0();this.E=s0;this.G=r0;this.H=false;this.Connect=function(){var t0;var u0=false;if(!this.H){this.H=true;var v0=this;t0=new n(i(function(){v0.H=false;}));this.I=t0;t0.Add(r0.Subscribe(this.E));}return this.I;};this.w=function(t0){return this.E.Subscribe(t0);};this.RefCount=function(){var t0=0;var u0=this;var v0;return F(function(w0){var x0=false;t0++;x0=t0==1;var y0=u0.Subscribe(w0);if(x0)v0=u0.Connect();return function(){y0.Dispose();t0--;if(t0==0)v0.Dispose();};});};};q0.prototype=new D;})();
\ No newline at end of file
(The MIT License)
Copyright (c) 2012 M Krejpowicz <krebbl@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
# Simple Todo App build with rAppid.js
\ No newline at end of file
# Simple Todo App build with rAppid.js
This example app demonstrates the features and abilities of rAppid.js
## Documentation
### The index.html
In the index.html the application is bootStrapped by defining our main application file
(in this case Todo.xml). Because rAppid.js is a RIA framework, the whole rendering is done by javascript.
If you are now thinking 'yeah fine, but what about SEO ', don't worry, rAppid.js also support Node-Rendering, which can be used for things like SEO.
### The application file Todo.xml
The main view of the application is declarated in Todo.xml. The first tag of the Todo.xml defines the super class of our application and the namespaces used inside the application description.
```xml
<?xml version="1.0"?>
<app:TodoClass xmlns="http://www.w3.org/1999/xhtml"
xmlns:js="js.core" xmlns:ui="js.ui" xmlns:app="app" xmlns:view="app.view" xmlns:conf="js.conf">
...
</app:TodoClass>
```
As you can see, the default namespace is `"http://www.w3.org/1999/xhtml"` which allows us to use plain HTML elements to describe our view.
The other namespaces are used for custom components.
One example of a custom component is the Router configuration.
```xml
<js:Router cid="router">
<conf:Route name="default" route="^$" onexec="showAll"/>
<conf:Route name="active" route="^active$" onexec="showActive"/>
<conf:Route name="completed" route="^completed$" onexec="showCompleted"/>
</js:Router>
```
Inside this declaration all routes of the application are defined. The **route** attribute expects a regular expression, which matches the route.
The **onexec** attribute defines the function which will be called, if the route is triggered.
The rest of the markup defines the UI of our application.
To connect the view with our application model we use bindings. For example the header:
```html
<header id="header">
<h1>{i18n.translate('title')}</h1>
<input id="new-todo" placeholder="{i18n.translate('placeholder')}" type="text" onkeyup="addNewTodo"
value="{{newTodo.title}}" autofocus="autofocus"/>
</header>
```
The bindings tell the application to hold view and model in sync. If you're interested in more details, checkout the rAppid.js wiki.
### The code behind file TodoClass.js
The TodoClass.js is the code behind file for Todo.xml. It initializes the attributes used in this application and it defines the event handlers for routing and ui events.
So there is a clean seperation between application code and ui declaration.
In the initialize method inside TodoClass all binded models are created and set as attributes of the application. This is important for resolving the bindings used in the view declaration.
### The Todo Model (app/model/Todo.js)
In this model, the default attributes for an instance and some methods used inside the application are defined.
It also marks the functions `hasTitle` and `status` as bindable.
```javascript
status: function () {
return this.$.completed ? "done" : '';
}.onChange("completed"),
```
Calling the `onChange(...)` function tells the application that the binding value of this methods has to be refreshed everytime the attributes change.
See app/view/TodoView.xml for usage.
### The Todo List (app/collection/TodoList.js)
The Todo List is a bindable List which encapsulates some application logic for manipulating the todo instances.
It also declares bindable functions, which are used inside the view ...
### The Todo View (app/view/TodoView.xml)
The Todo view is a custom view for displaying and editing Todo instances.
Here we define view logic and view declaration in one file.
<?xml version="1.0"?>
<app:TodoClass xmlns="http://www.w3.org/1999/xhtml"
xmlns:js="js.core" xmlns:ui="js.ui" xmlns:app="app" xmlns:view="app.view">
<js:Injection>
<js:I18n locale="en_EN"/>
</js:Injection>
<div class="container">
<div id="todoapp">
<div class="language">
<select items="{locales}" selectedItem="{{i18n.locale}}">
<js:Template name="item">
<option value="{$item}">{i18n.translate({$item})}</option>
</js:Template>
</select>
</div>
xmlns:js="js.core" xmlns:ui="js.ui" xmlns:app="app" xmlns:view="app.view" xmlns:conf="js.conf"
xmlns:data="js.data">
<!-- LOCAL STORAGE CONFIGURATION -->
<data:LocalStorageDataSource cid="dataSource" name="todo-rappidjs">
<conf:Configuration path="todos" modelClassName="app.model.Todo"
collectionClassName="app.collection.TodoList"/>
</data:LocalStorageDataSource>
<div class="title">
<h1>{i18n.translate(title)}</h1>
</div>
<div class="content">
<div id="create-todo">
<!-- HERE WE USE TWO WAY BINDING TO SET THE CONTENT OF THE NEW TODO -->
<input id="new-todo" placeholder="{i18n.translate(placeholder)}" type="text" onkeyup="addNewTodo"
value="{{newTodo.content}}"/>
<!-- EACH ELEMENT WITH A CID IS REGISTERED IN THE ROOT SCOPE -->
<span class="ui-tooltip-top" cid="hint" visible="false">{i18n.translate(hint)}</span>
</div>
<!-- ROUTER CONFIGURATION -->
<js:Router cid="router">
<conf:Route name="default" route="^$" onexec="showAll"/>
<conf:Route name="active" route="^active$" onexec="showActive"/>
<conf:Route name="completed" route="^completed$" onexec="showCompleted"/>
</js:Router>
<div id="todo-list">
<div visible="{todoList.hasItems()}">
<input class="check mark-all-done" type="checkbox" onclick="markAllComplete" id="check-all"
checked="{todoList.areAllComplete()}"/>
<label for="check-all">{i18n.translate(markAllAsComplete)}</label>
</div>
<!-- CUSTOM UI COMPONENT FOR RENDERING A LIST OF ITEMS -> TODOs -->
<ui:ItemsView list="{todoList}" tagName="ul" id="todoList">
<js:Template name="item">
<view:TodoView todo="{$item}" tagName="li" onremove="removeTodo"/>
</js:Template>
</ui:ItemsView>
</div>
<div id="todo-stats">
<span class="todo-count" data-num="{todoList.numOpenTodos()}">
<span class="number">{data-num}</span>
{i18n.translate({data-num},item)} {i18n.translate(left)}.
</span>
<span class="todo-sort" visible="{todoList.hasItems()}">
<a href="javascript: void 0;" onclick="sort">
{i18n.translate(sortTodos)}
</a>
</span>
<span class="todo-clear" visible="{todoList.hasCompletedTodos()}">
<!-- FOR THE ITEMS STRING WE USE A FUNCTION WHICH GETS A NUMBER OF ITEMS AS INPUT -->
<a href="javascript: void 0;" onclick="clearCompleted"
data-num="{todoList.numCompletedTodos()}">
{i18n.translate(clear)}
<span class="number-done">{data-num}</span>
{i18n.translate(completed)}
<span class="word-done">
{i18n.translate({data-num},item)}
</span>
</a>
</span>
</div>
</div>
</div>
<div id="credits">
{i18n.translate(createdBy)}
<a href="http://github.com/krebbl">Marcus Krejpowicz</a>
<br/>
{i18n.translate(with)}
<a href="http://rappidjs.com">&lt;rAppid:js /&gt;</a>.
<!-- HERE WE START TO DEFINE THE UI WITH HTML AND CUSTOM UI COMPONENTS -->
<section id="todoapp">
<header id="header">
<h1>Todos</h1>
<input id="new-todo" placeholder="What needs to be done?" type="text" onkeyup="addNewTodo" autofocus="autofocus"/>
</header>
<section id="main" visible="{todoList.hasItems()}">
<input id="toggle-all" type="checkbox" onclick="markAllComplete"
checked="{todoList.areAllComplete()}"/>
<label for="toggle-all">Mark all as complete</label>
<!-- CUSTOM UI COMPONENT FOR RENDERING A LIST OF ITEMS -> TODOs -->
<ui:ItemsView items="{filterList.list}" tagName="ul" id="todo-list" itemKey="todo">
<js:Template name="item">
<view:TodoView todo="{$todo}" tagName="li" onremove="removeTodo"/>
</js:Template>
</ui:ItemsView>
</section>
<footer id="footer" data-num="{todoList.numOpenTodos()}" visible="{todoList.hasItems()}">
<span id="todo-count">
<strong>{data-num}</strong> {translateItems({data-num})} left
</span>
<ul id="filters">
<li>
<a href="#/" class="{selectedClass('all',{filterList.filter})}">All</a>
</li>
<li>
<a href="#/active" class="{selectedClass('active',{filterList.filter})}">Active</a>
</li>
<li>
<a href="#/completed" class="{selectedClass('completed',{filterList.filter})}">Completed</a>
</li>
</ul>
<button id="clear-completed" onclick="clearCompleted" visible="{todoList.hasCompletedTodos()}">
Clear completed ({todoList.numCompletedTodos()})
</button>
</footer>
</section>
<footer id="info">
<p visible="{todoList.hasItems()}">Double - click to edit a todo</p>
<p>Template by <a href="http://github.com/sindresorhus">Sindre Sorhus</a></p>
<p>
Created by <a href="http://github.com/krebbl">Marcus Krejpowicz</a> with<a href="http://rappidjs.com">&lt; rAppid:js/&gt;</a>
<br/>
{i18n.translate(creditsTo)} <a href="http://github.com/it-ony">Tony Findeisen</a>.
</div>
</div>
Big credits to <a href="http://github.com/it-ony">Tony Findeisen</a>
</p>
<p>Part of
<a href="http://todomvc.com">TodoMVC</a>
</p>
</footer>
</app:TodoClass>
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
define(["js/core/Application", "js/core/I18n", "app/model/Todo", "app/collection/TodoList", "js/data/FilterDataView", "js/data/LocalStorageDataSource"],
function (Application, I18n, Todo, TodoList, FilterDataView, DataSource) {
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("app.TodoClass",
["js.core.Application", "js.core.I18n", "app.model.Todo", "app.collection.TodoList"],
function (Application, I18n, Todo, TodoList) {
var ENTER_KEY = 13;
return Application.inherit({
inject:{
i18n:I18n
},
/**
* Initializes the app
* In this method we set the initial models
*/
initialize:function () {
this.set("todoList", new TodoList());
this.set("newTodo", new Todo());
this.set("locales",["en_EN","de_DE"]);
},
/**
* The rest is just controller stuff
*/
addNewTodo:function (e) {
if (e.$.keyCode === 13) {
var tmp = this.get("newTodo");
if (tmp.hasContent()) {
var newTodo = new Todo({content:tmp.get("content")});
newTodo.setDone(false);
this.get("todoList").add(newTodo);
tmp.set("content", "");
}
this.get("hint").set("visible", false);
} else {
// some hint stuff
var hint = this.get("hint");
if (!hint.get("visible")) {
setTimeout(function () {
hint.set("visible", true);
return Application.inherit("app.TodoClass", {
/**
* Initializes the app
* In this method we set the initial models
*/
initialize: function () {
this.set("todoList", null);
this.set("filterList", null);
this.callBase();
},
/**
* Are triggered
*/
showAll: function () {
this.$.filterList.set("filter", 'all');
},
showActive: function () {
this.$.filterList.set("filter", "active");
},
showCompleted: function () {
this.$.filterList.set("filter", "completed");
},
/**
* The rest is just controller stuff
*/
addNewTodo: function (e) {
if (e.domEvent.keyCode === ENTER_KEY) {
var title = e.target.get("value").trim();
if (title) {
var newTodo = this.$.dataSource.createEntity(Todo);
newTodo.set({title: title, completed: false});
this.get("todoList").add(newTodo);
setTimeout(function () {
hint.set("visible", false);
}, 2000);
}, 400);
}
// save the new item
newTodo.save();
e.target.set('value','');
}
}
},
markAllComplete: function (e) {
this.get("todoList").markAll(e.target.$el.checked);
},
clearCompleted: function () {
this.get("todoList").clearCompleted();
},
removeTodo: function (e) {
var todo = e.$, self = this;
todo.remove(null, function(err){
if(!err){
self.get("todoList").remove(todo);
}
},
markAllComplete:function (e, input) {
this.get("todoList").markAll(input.get("checked"));
},
clearCompleted:function (e) {
this.get("todoList").clearCompleted();
},
removeTodo:function (e, el) {
this.get("todoList").remove(e.$);
},
sort:function () {
this.get("todoList").sort(function (t1, t2) {
if (t1.get("isDone") && t2.get("isDone")) {
return 0;
} else if (t1.get("isDone") === true && !t2.get("isDone")) {
return 1;
});
},
/**
* Start the application and render it to the body ...
*/
start: function (parameter, callback) {
this.set('todoList', this.$.dataSource.createCollection(TodoList));
// fetch all todos, can be done sync because we use localStorage
this.$.todoList.fetch();
this.set('filterList', new FilterDataView({
baseList: this.get("todoList"),
filter: 'all',
filterFnc: function (item) {
var filter = this.$.filter;
if (filter == "active") {
return !item.isCompleted();
} else if (filter == "completed") {
return item.isCompleted();
} else {
return -1;
return true;
}
});
},
/**
* Start the application and render it to the body ...
*/
start:function (parameter, callback) {
// false - disables autostart
this.callBase(parameter, false);
this.$.i18n.set("locale","en_EN",{silent: true});
this.$.i18n.loadLocale("en_EN", callback);
}
});
}
);
});
\ No newline at end of file
}})
);
// false - disables autostart
this.callBase();
},
translateItems: function(num){
return (num === 1) ? "item" : "items";
},
selectedClass: function (expected, current) {
return expected == current ? "selected" : "";
}
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
define(["js/data/Collection", "app/model/Todo", "flow"], function (Collection, Todo, flow) {
return Collection.inherit("app.collection.TodoList", {
$modelFactory: Todo,
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("app.collection.TodoList", ["js.core.List"], function (List) {
return List.inherit({
markAll:function (done) {
this.each(function (todo) {
todo.setDone(done);
});
},
areAllComplete:function () {
if(this.$items.length == 0) return false;
for (var i = 0; i < this.$items.length; i++) {
if (!this.$items[i].get("isDone")) {
return false;
}
markAll: function (done) {
this.each(function (todo) {
todo.setCompleted(done);
todo.save();
});
},
areAllComplete: function () {
if (this.$items.length === 0) {
return false;
}
for (var i = 0; i < this.$items.length; i++) {
if (!this.$items[i].isCompleted()) {
return false;
}
return true;
}.on('change','add','remove'),
clearCompleted:function () {
console.log("clear completed");
for (var i = this.$items.length-1; i >= 0; i--) {
if (this.$items[i].get("isDone")) {
this.removeAt(i);
}
}
return true;
}.on('change', 'add', 'remove'),
clearCompleted: function () {
var self = this;
// remove all completed todos in a sequence
flow().seqEach(this.$items,function (todo, cb) {
if (todo.isCompleted()) {
// remove the todo
todo.remove(null, function (err) {
if (!err) {
self.remove(todo);
}
cb(err);
});
} else {
cb();
}
},
numOpenTodos:function () {
var num = 0;
for (var i = 0; i < this.$items.length; i++) {
if (!this.$items[i].get("isDone")) {
num++;
}
}).exec();
},
numOpenTodos: function () {
var num = 0;
for (var i = 0; i < this.$items.length; i++) {
if (!this.$items[i].isCompleted()) {
num++;
}
return num;
}.on('change','add','remove'),
numCompletedTodos: function(){
var num = 0;
for (var i = 0; i < this.$items.length; i++) {
if (this.$items[i].get("isDone")) {
num++;
}
}
return num;
}.on('change', 'add', 'remove'),
numCompletedTodos: function () {
var num = 0;
for (var i = 0; i < this.$items.length; i++) {
if (this.$items[i].isCompleted()) {
num++;
}
return num;
}.on('change', 'add', 'remove'),
hasCompletedTodos: function(){
return this.numCompletedTodos() > 0;
}.on('change','add','remove')
});
}
return num;
}.on('change', 'add', 'remove'),
hasCompletedTodos: function () {
return this.numCompletedTodos() > 0;
}.on('change', 'add', 'remove')
});
});
\ No newline at end of file
{
"language" : "Sprache",
"title":"Aufgaben",
"placeholder":"Was soll erledigt werden?",
"hint":"Drücke ENTER, um die Aufgabe anzulegen",
"markAllAsComplete":"Markiere alle als erledigt",
"item":"Aufgabe",
"item_plural":"Aufgaben",
"left":"offen",
"clear":"Entferne",
"completed":"erledigte",
"sortTodos":"Sortieren",
"de_DE" : "Deutsch",
"en_EN" : "Englisch",
"createdBy":"Erstellt von",
"with":"mit",
"creditsTo":"Vielen Dank an"
}
\ No newline at end of file
{
"language" : "Language",
"title":"Todos",
"placeholder":"What needs to be done?",
"hint":"Press Enter to save this task",
"markAllAsComplete":"Mark all as complete",
"item":"item",
"item_plural":"items",
"left":"left",
"clear":"Clear",
"completed":"completed",
"sortTodos":"Sort todos",
"de_DE":"German",
"en_EN":"English",
"createdBy" : "Created by",
"with":"with",
"creditsTo" : "Big credits to"
}
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("app.model.Todo", ["js.core.Bindable"], function (Bindable) {
return Bindable.inherit({
defaults:{
content:"",
isDone: false
},
setDone:function (done) {
this.set("isDone", done);
},
status: function(){
if(this.$.isDone){
return "done";
}else{
return "";
}
}.onChange("isDone","isEditing"),
hasContent:function () {
return this.$.content.length > 0;
}.onChange("content")
});
define(["js/data/Model"], function (Model) {
return Model.inherit("app.model.Todo", {
defaults: {
title: "",
completed: false
},
setCompleted: function (completed) {
this.set("completed", completed);
},
isCompleted: function () {
return this.$.completed;
},
status: function () {
return this.$.completed ? "completed" : '';
}.onChange("completed"),
hasTitle: function () {
return this.$.title.trim().length;
}.onChange("title")
});
});
\ No newline at end of file
<ui:View xmlns="http://www.w3.org/1999/xhtml"
xmlns:js="js.core" xmlns:ui="js.ui">
xmlns:js="js.core" xmlns:ui="js.ui" componentClass="{todo.status()}">
<js:Script>
<![CDATA[
(function (Base, Bindable, Content) {
(function () {
var ENTER_KEY = 13;
var INPUT_BLUR = "blur";
return {
defaults:{
componentClass: "todo",
defaults: {
editing: false
},
events: [
"remove"
],
editTodo:function (e, div) {
var todo = div.find("$item");
this.set("editing",true);
e.$.stopPropagation();
// we don't use jquery, so we have to select this the old fashioned way
div.$el.parentNode.parentNode.getElementsByTagName("input")[1].select();
$classAttributes: ['todo', 'inputElement'],
events: ["remove"],
editTodo: function (e) {
this.set("editing", true);
e.preventDefault();
this.$.inputElement.$el.select();
return false;
},
checkTodo:function (e, input) {
checkTodo: function () {
var todo = this.get("todo");
todo.setDone(!todo.get("isDone"));
todo.setCompleted(!todo.isCompleted());
todo.save();
},
preventEditing: function(e){
e.stopPropagation();
},
updateTodo:function (e, input) {
updateTodo: function (e) {
var todo;
if (e.$.keyCode === 13) {
todo = this.get("todo");
this.set("editing",false);
} else if (e.$.keyCode === 27) {
todo = this.get("todo");
var content = todo.get("content");
input.$el.blur();
todo.set("content", content);
this.set("editing",false);
} else if (e.$.type === "blur") {
if (e.domEvent.keyCode === ENTER_KEY || e.domEvent.type === INPUT_BLUR) {
todo = this.get("todo");
this.set("editing",false);
if (!todo.hasTitle()) {
this.trigger("remove", todo);
} else {
this.set("editing", false);
todo.save();
}
}
},
triggerOnRemove: function(e, el){
this.trigger("onremove",this.get("todo"));
triggerOnRemove: function () {
this.trigger("remove", this.get("todo"));
},
_renderEditing: function(editing){
if(editing){
_renderEditing: function (editing) {
if (editing) {
this.addClass("editing");
}else{
} else {
this.removeClass("editing");
this.$.inputElement.$el.blur();
}
},
trim: function(title){
if(title){
return title.trim();
}
return "";
}
}
......@@ -57,19 +62,14 @@
]]>
</js:Script>
<js:Template name="layout">
<div class="{todo.status()}">
<div class="display">
<input class="check" type="checkbox" onchange="checkTodo"
checked="{todo.isDone}"/>
<label class="todo-content" ondblclick="editTodo">{todo.content}</label>
<span class="todo-destroy" onclick="triggerOnRemove"></span>
</div>
<div class="edit">
<input class="todo-input" type="text" value="{{todo.content}}"
onkeyup="updateTodo" onblur="updateTodo"/>
<div class="view" ondblclick="editTodo">
<input class="toggle" type="checkbox" onclick="checkTodo" ondblclick="preventEditing"
checked="{todo.completed}"/>
<label>{todo.title}</label>
<button class="destroy" onclick="triggerOnRemove"/>
</div>
</div>
<input class="edit" cid="inputElement" type="text" value="{{todo.title|trim()}}"
onkeyup="updateTodo" onblur="updateTodo" updateOnEvent="change"/>
</js:Template>
</ui:View>
{
"xamlClasses": ["js.ui.Link", "js.ui.MenuButton", "js.ui.SplitButton" , "js.ui.TabView", "app.view.TodoView"],
"xamlClasses": ["app/Todo", "app/view/TodoView", "js/ui/ButtonGroup", "js/ui/Link", "js/ui/List", "js/ui/MenuButton", "js/ui/Modal", "js/ui/ScrollView", "js/ui/SplitButton", "js/ui/TabView"],
"namespaceMap": null,
"rewriteMap": null
}
"rewriteMap": null,
"paths": {
"xaml": "js/plugins/xaml",
"json": "js/plugins/json",
"raw": "js/plugins/raw",
"flow": "js/lib/flow",
"inherit": "js/lib/inherit",
"underscore": "js/lib/underscore",
"JSON": "js/lib/json2.js"
}, "shim": {
"inherit": {
"exports": "inherit"
},
"flow": {
"exports": "flow"
},
"underscore": {
"exports": "_"
},
"js/lib/parser": {
"exports": "parser"
},
"JSON": {
"exports": "JSON"
}
}}
\ No newline at end of file
.hide {
display: none;
}
\ No newline at end of file
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
line-height: 1;
color: black;
background: white;
}
ol, ul {
list-style: none;
}
a img {
border: none;
}
html {
background: #eeeeee;
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.4em;
background: #eeeeee;
color: #333333;
}
#todoapp {
width: 480px;
margin: 0 auto 40px;
background: white;
padding: 20px;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0;
}
#todoapp h1 {
font-size: 36px;
font-weight: bold;
text-align: center;
padding: 20px 0 30px 0;
line-height: 1;
}
#create-todo {
position: relative;
}
#create-todo input {
width: 466px;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
padding: 6px;
border: 1px solid #999999;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
}
#create-todo span {
position: absolute;
z-index: 999;
width: 170px;
left: 50%;
top: 50px;
margin-left: -85px;
}
#todo-list {
margin-top: 10px;
}
#todo-list li {
padding: 12px 20px 11px 0;
position: relative;
font-size: 24px;
line-height: 1.1em;
border-bottom: 1px solid #cccccc;
}
#todo-list li:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}
#todo-list li.editing {
padding: 0;
border-bottom: 0;
}
#todo-list .editing .display,
#todo-list .edit {
display: none;
}
#todo-list .editing .edit {
display: block;
}
#todo-list .editing input {
width: 444px;
font-size: 24px;
font-family: inherit;
margin: 0;
line-height: 1.6em;
border: 0;
outline: none;
padding: 4px 7px 0px 27px;
border: 1px solid #999999;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
}
#todo-list .check {
position: relative;
top: 9px;
margin: 0 10px 0 7px;
float: left;
}
#todo-list .done .todo-content {
text-decoration: line-through;
color: #777777;
}
#todo-list .todo-destroy {
position: absolute;
right: 5px;
top: 14px;
display: none;
cursor: pointer;
width: 20px;
height: 20px;
background: url(destroy.png) no-repeat 0 0;
}
#todo-list li:hover .todo-destroy {
display: block;
}
#todo-list .todo-destroy:hover {
background-position: 0 -20px;
}
#todo-stats {
*zoom: 1;
margin-top: 10px;
color: #777777;
}
#todo-stats:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}
#todo-stats .todo-count {
float: left;
}
#todo-stats .todo-count .number {
font-weight: bold;
color: #333333;
}
#todo-stats .todo-clear,
#todo-stats .todo-sort {
float: right;
}
#todo-stats .todo-sort {
margin-left: 5px;
}
#todo-stats .todo-clear a,
#todo-stats .todo-sort a {
color: #777777;
font-size: 12px;
}
#todo-stats .todo-clear a:visited {
color: #777777;
}
#todo-stats .todo-clear a:hover {
color: #336699;
}
#instructions {
width: 520px;
margin: 10px auto;
color: #777777;
text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0;
text-align: center;
}
#instructions a {
color: #336699;
}
#credits {
width: 520px;
margin: 30px auto;
color: #999;
text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0;
text-align: center;
}
#credits a {
color: #888;
}
/*
* François 'cahnory' Germain
*/
.ui-tooltip, .ui-tooltip-top, .ui-tooltip-right, .ui-tooltip-bottom, .ui-tooltip-left {
color: #ffffff;
cursor: normal;
display: -moz-inline-stack;
display: inline-block;
font-size: 12px;
font-family: arial;
padding: .5em 1em;
position: relative;
text-align: center;
text-shadow: 0 -1px 1px #111111;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-khtml-border-top-left-radius: 4px;
-khtml-border-top-right-radius: 4px;
-khtml-border-bottom-right-radius: 4px;
-khtml-border-bottom-left-radius: 4px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
-moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
-o-box-shadow: 0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
-moz-box-shadow: 0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
-khtml-box-shadow: 0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
-webkit-box-shadow: 0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
box-shadow: 0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444;
background-color: #3b3b3b;
background-image: -moz-linear-gradient(top, #555555, #222222);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #555555), color-stop(1, #222222));
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr = #555555, EndColorStr = #222222);
-ms-filter: progid: DXImageTransform . Microsoft . gradient(startColorStr = #555555, EndColorStr = #222222);
}
.ui-tooltip:after, .ui-tooltip-top:after, .ui-tooltip-right:after, .ui-tooltip-bottom:after, .ui-tooltip-left:after {
content: "\25B8";
display: block;
font-size: 2em;
height: 0;
line-height: 0;
position: absolute;
}
.ui-tooltip:after, .ui-tooltip-bottom:after {
color: #2a2a2a;
bottom: 0;
left: 1px;
text-align: center;
text-shadow: 1px 0 2px #000000;
-o-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-khtml-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
width: 100%;
}
.ui-tooltip-top:after {
bottom: auto;
color: #4f4f4f;
left: -2px;
top: 0;
text-align: center;
text-shadow: none;
-o-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-khtml-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
width: 100%;
}
.ui-tooltip-right:after {
color: #222222;
right: -0.375em;
top: 50%;
margin-top: -.05em;
text-shadow: 0 1px 2px #000000;
-o-transform: rotate(0);
-moz-transform: rotate(0);
-khtml-transform: rotate(0);
-webkit-transform: rotate(0);
}
.ui-tooltip-left:after {
color: #222222;
left: -0.375em;
top: 50%;
margin-top: .1em;
text-shadow: 0 -1px 2px #000000;
-o-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-khtml-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
}
/*the following changes require some cleanup and integration with the above.**/
/* line 9 */
/* line 17 */
#todoapp {
background: white;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 2px 6px 0;
-moz-border-radius-bottomleft: 5px;
-webkit-border-bottom-left-radius: 5px;
-o-border-bottom-left-radius: 5px;
-ms-border-bottom-left-radius: 5px;
-khtml-border-bottom-left-radius: 5px;
border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px;
-webkit-border-bottom-right-radius: 5px;
-o-border-bottom-right-radius: 5px;
-ms-border-bottom-right-radius: 5px;
-khtml-border-bottom-right-radius: 5px;
border-bottom-right-radius: 5px;
}
/* line 24 */
/* line 32 */
#todoapp .content #create-todo {
position: relative;
}
/* line 34 */
#todoapp .content #create-todo input {
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
padding: 6px;
border: 1px solid #999999;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
}
/* line 47 */
#todoapp .content #create-todo span {
position: absolute;
z-index: 999;
width: 170px;
left: 50%;
margin-left: -85px;
}
/* line 55 */
#todoapp .content ul#todo-list {
margin-top: 10px;
}
/* line 57 */
#todoapp .content ul#todo-list li {
padding: 15px 20px 15px 0;
position: relative;
font-size: 24px;
border-bottom: 1px solid #cccccc;
*zoom: 1;
cursor: move;
}
/* line 22, /opt/ree/lib/ruby/gems/1.8/gems/compass-0.10.5/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
#todoapp .content ul#todo-list li:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}
/* line 64 */
#todoapp .content ul#todo-list li.editing {
padding: 0;
border-bottom: 0;
}
/* line 67 */
#todoapp .content ul#todo-list li.editing .todo-input {
display: block;
width: 466px;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
padding: 6px;
border: 1px solid #999999;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset;
}
/* line 79 */
#todoapp .content ul#todo-list li.editing .todo-content {
display: none;
}
/* line 81 */
#todoapp .content ul#todo-list li.editing .todo-check {
display: none;
}
/* line 83 */
#todoapp .content ul#todo-list li.editing .todo-destroy {
display: none !important;
}
/* line 85 */
#todoapp .content ul#todo-list li .todo-input {
display: none;
}
/* line 87 */
#todoapp .content ul#todo-list li .todo-check {
position: relative;
top: 6px;
margin: 0 10px 0 7px;
float: left;
}
/* line 93 */
#todoapp .content ul#todo-list li.done .todo-content {
text-decoration: line-through;
color: #777777;
}
/* line 96 */
#todoapp .content ul#todo-list li .todo-destroy {
position: absolute;
right: 0px;
top: 16px;
display: none;
cursor: pointer;
width: 20px;
height: 20px;
}
/* line 106 */
#todoapp .content ul#todo-list li:hover .todo-destroy {
display: block;
}
/* line 109 */
#todoapp #todo-stats {
*zoom: 1;
margin-top: 10px;
color: #555555;
-moz-border-radius-bottomleft: 5px;
-webkit-border-bottom-left-radius: 5px;
-o-border-bottom-left-radius: 5px;
-ms-border-bottom-left-radius: 5px;
-khtml-border-bottom-left-radius: 5px;
border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px;
-webkit-border-bottom-right-radius: 5px;
-o-border-bottom-right-radius: 5px;
-ms-border-bottom-right-radius: 5px;
-khtml-border-bottom-right-radius: 5px;
border-bottom-right-radius: 5px;
background: #f4fce8;
border-top: 1px solid #ededed;
padding: 0 20px;
line-height: 36px;
}
/* line 22, /opt/ree/lib/ruby/gems/1.8/gems/compass-0.10.5/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
#todoapp #todo-stats:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}
/* line 118 */
#todoapp #todo-stats .todo-count {
float: left;
}
/* line 120 */
#todoapp #todo-stats .todo-count .number {
font-weight: bold;
color: #555555;
}
/* line 123 */
#todoapp #todo-stats .todo-clear {
float: right;
}
/* line 125 */
#todoapp #todo-stats .todo-clear a,
#todoapp #todo-stats .todo-sort a{
display: block;
line-height: 20px;
text-decoration: none;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
-o-border-radius: 12px;
-ms-border-radius: 12px;
-khtml-border-radius: 12px;
border-radius: 12px;
background: rgba(0, 0, 0, 0.1);
color: #555555;
font-size: 11px;
margin-top: 8px;
padding: 0 10px 1px;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
}
/* line 136 */
#todoapp #todo-stats .todo-clear a:hover, #todoapp #todo-stats .todo-clear a:focus {
background: rgba(0, 0, 0, 0.15);
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
}
/* line 139 */
#todoapp #todo-stats .todo-clear a:active {
position: relative;
top: 1px;
}
.language {
text-align: right;
}
.hidden {
display: none;
}
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<title>Todo</title>
<link rel="stylesheet" href="css/todo.css"/>
<script type="text/javascript" src="lib/require.js"></script>
<script type="text/javascript" src="lib/inherit.js"></script>
<script type="text/javascript" src="lib/underscore-min.js"></script>
<script type="text/javascript" src="lib/flow.js"></script>
<script type="text/javascript" src="lib/rAppid.js"></script>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<title>TodoMVC build with rAppid.js</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="../../../assets/base.css">
<!-- CSS overrides - remove if you don't need it -->
<link rel="stylesheet" href="css/app.css">
<!--[if IE]>
<script src="../../../assets/ie.js"></script>
<![endif]-->
<script type="text/javascript" src="package/rappidjs.min.js"></script>
<script type="text/javascript">
rAppid.bootStrap("app/Todo.xml", "config.json",
function (err, systemManager, application) {
if (!err) {
application.start(null, function () {
application.render(document.body);
});
} else {
console.warn(err);
}
});
</script>
</head>
<body>
<script type="text/javascript">
rAppid.bootStrap("app/Todo.xml", "config.json",
function (err, systemManager, application) {
if (!err) {
application.start(null, function () {
application.render(document.body);
});
} else {
console.warn(err);
}
});
</script>
</body>
<body></body>
</html>
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Application",
["js.core.UIComponent", "js.core.History"], function (UIComponent, History) {
return UIComponent.inherit({
ctor: function () {
this.history = new History();
this.callBase();
},
initialize: function () {
// set up application wide vars
this.callBase();
},
_inject: function() {
// overwrite and call inside start
},
_initializeDescriptors: function() {
this.callBase();
UIComponent.prototype._inject.call(this);
},
/**
* Method called, when application is initialized
*
* @param {Object} parameter
* @param {Function} callback
*/
start: function (parameter, callback) {
this.history.start();
if (callback) {
callback(null);
}
},
render: function (target) {
var dom = this.callBase(null);
if (target) {
target.appendChild(dom);
}
return dom;
},
toString: function () {
return "js.core.Application";
}
});
}
);
});
\ No newline at end of file
// defined under rAppid.js
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Bindable", ["js.core.EventDispatcher"],
/**
* @export js.core.Bindable
*/
function (EventDispatcher) {
/**
* @class js.core.Bindable
* @extends js.core.EventDispatcher
*/
var Bindable = EventDispatcher.inherit({
ctor: function (attributes) {
// call the base class constructor
this.callBase(null);
this.$ = {};
rAppid._.extend(this._eventAttributes, this.base._eventAttributes || {});
attributes = attributes || {};
rAppid._.defaults(attributes, this._defaultAttributes());
this.$ = attributes;
this.$previousAttributes = rAppid._.clone(attributes);
var self = this, fnc;
var bind = function(key, targetKey, method){
self.bind('change:' + key, function () {
self.set(targetKey, method.call(self));
});
};
},
defaults: {
},
_defaultAttributes: function () {
return this._generateDefaultsChain("defaults");
},
_generateDefaultsChain: function (property) {
var ret = this[property],
base = this.base;
while (base) {
rAppid._.defaults(ret, base[property]);
base = base.base;
}
// clone all attributes
for(var k in ret){
if(ret.hasOwnProperty(k) && !rAppid._.isFunction(ret[k])){
ret[k] = rAppid._.clone(ret[k]);
}
}
return ret;
},
/**
*
* @param key
* @param value
* @param options
*/
set: function (key, value, options) {
var attributes = {};
if (rAppid._.isString(key)) {
// check for path
var path = key.split(".");
if (path.length > 1) {
var scope = this.get(path.shift());
if (scope && scope.set) {
scope.set(path.join("."), value, options);
return this;
}
}
attributes[key] = value;
} else {
options = value;
attributes = key;
}
options = options || {silent: false, unset: false};
// for unsetting attributes
if (options.unset) {
for (key in attributes) {
attributes[key] = void 0;
}
}
var changedAttributes = {},
equal = true,
now = this.$,
val;
for (key in attributes) {
if (attributes.hasOwnProperty(key)) {
// get the value
val = attributes[key];
// unset attribute or change it ...
if (options.unset === true) {
delete now[key];
} else {
if (!rAppid._.isEqual(now[key], attributes[key])) {
this.$previousAttributes[key] = now[key];
now[key] = attributes[key];
changedAttributes[key] = now[key];
}
}
// if attribute has changed and there is no async changing process in the background, fire the event
}
}
this._commitChangedAttributes(changedAttributes);
if (options.silent === false && rAppid._.size(changedAttributes) > 0) {
for (key in changedAttributes) {
if (changedAttributes.hasOwnProperty(key)) {
this.trigger('change:' + key, changedAttributes[key], this);
}
}
this.trigger('change', changedAttributes, this);
}
return this;
},
get: function (key) {
//var path = key.split(".");
return this.$[key];
/*
var key;
while (path.length > 0 && prop != null) {
key = path.shift();
if (prop instanceof Bindable) {
prop = prop.get(key);
} else if (typeof(prop[key]) !== "undefined") {
prop = prop[key];
} else {
return null;
}
} */
},
has: function(key){
return typeof(this.$[key]) !== "undefined" && this.$[key] !== null;
},
_commitChangedAttributes: function (attributes) {
},
unset: function (key, options) {
(options || (options = {})).unset = true;
return this.set(key, null, options);
},
clear: function () {
return this.set(this.$, {unset: true});
}
});
return Bindable;
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Binding", ["js.core.Bindable", "js.core.EventDispatcher"], function (Bindable, EventDispatcher) {
var $splitAtReg = /\.?(?:\w+\([^(]*\)|[^.]+)/;
var splitPath = function(path){
var matches = [];
var match = path.match($splitAtReg);
while(match[0]){
matches.push(match[0]);
path = path.substr(match[0].length+1);
match = path.search($splitAtReg);
}
if(path.length > 0){
matches.push(path);
}
return matches;
};
var splitFirst = function(path){
var match = path.match($splitAtReg);
if(match){
return match[0];
}
return path;
};
var Binding = Bindable.inherit({
defaults: {
event: 'change',
path: null,
twoWay: false,
transform: function (val) {
return val;
},
transformBack: function (val) {
return val;
}
},
ctor: function () {
this.callBase();
this.initialize();
},
initialize: function () {
this._checkAttributes();
this.$parameters = [];
this.$subBinding = null;
if (!this.$.rootScope) {
this.$.rootScope = this;
}
var scope = this.$.scope;
var keys = splitPath(this.$.path);
// split up first key
this.$.key = keys.shift();
if($fncRegex.test(this.$.key)){
var matches = this.$.key.match($fncRegex);
var fncName = matches[1];
var fncParameterStr = matches[2];
if (rAppid._.isFunction(scope[fncName])) {
var fnc = scope[fncName];
var events = [];
if(fnc._events){
events = fnc._events;
}else{
events = ['change'];
}
for (var i = 0; i < events.length; i++) {
var event = events[i];
scope.bind(event, this._callback, this);
}
var self = this;
var cb = function(){
self.trigger();
};
// TODO: implement regex for , splitting
this.$parameters = fncParameterStr.split(",");
for (var j = 0; j < this.$parameters.length; j++) {
var para = this.$parameters[j];
if($bindingRegex.test(para)){
para = Binding.create(para,this.$.target,cb);
}
this.$parameters[j] = para;
}
this.$.fnc = fnc;
}
}else{
this.$.event = "change:" + this.$.key;
// on change of this key
scope.bind(this.$.event, this._callback, this);
if (this.$.twoWay === true) {
this.$.targetEvent = 'change:' + this.$.targetKey;
this.$.target.bind(this.$.targetEvent, this._revCallback, this);
}
}
this._createSubBinding();
},
_checkAttributes: function () {
// check infrastructur
if (!this.$.path) {
throw "No path defined!";
}
if (!this.$.scope) {
throw "No scope defined!"
}
if (this.$.twoWay) {
if (!this.$.target) {
throw "TwoWay binding, but no target defined!";
}
if (!this.$.target instanceof Bindable) {
throw "Target is not a Bindable!";
}
if (!this.$.targetKey) {
throw "TwoWay binding, but no target key defined!";
}
}
},
_createSubBinding: function () {
var keys = splitPath(this.$.path);
var k = keys.shift();
if (keys.length > 0) {
var nScope;
if(this.$.fnc){
nScope = this.getValue();
}else{
nScope = this.$.scope.$[k];
}
// if keys are left and has value && is bindable
// get value for first child
if (nScope && (nScope instanceof EventDispatcher)) {
// init new binding, which triggers this binding
this.$subBinding = new Binding({scope: nScope, path: keys.join("."), target: this.$.target, targetKey: this.$.targetKey, rootScope: this.$.rootScope, callback: this.$.callback});
}
}
},
_revCallback: function (e) {
this.$.scope.set(this.$.path, this.$.transformBack(e.$, this.$.target));
},
_callback: function () {
// remove subBindings!
if (this.$subBinding) {
this.$subBinding.destroy();
this.$subBinding = null;
}
// try to create subBinding
this._createSubBinding();
this.trigger();
},
destroy: function () {
this.$.scope.unbind(this.$.event, this._callback);
if (this.$.twoWay === true) {
this.$.target.unbind(this.$.targetEvent, this._revCallback);
}
if (this.$subBinding) {
this.$subBinding.destroy();
}
// destroy parameter bindings
for (var i = 0; i < this.$parameters.length; i++) {
var par = this.$parameters[i];
if(par instanceof Binding){
par.destroy();
}
}
},
getValue: function(){
if(this.$subBinding){
return this.$subBinding.getValue();
}else{
if(this.$.fnc){
var parameters = [];
for (var i = 0; i < this.$parameters.length; i++) {
var para = this.$parameters[i];
if(para instanceof Binding){
para = para.getValue();
}
parameters.push(para);
}
return this.$.fnc.apply(this.$.scope,parameters);
}else if(this.$.path == this.$.key){
return this.$.scope.get(this.$.key);
}else{
return null;
}
}
},
// trigger
trigger: function(){
// get value
var val = this.getValue();
if(this.$.targetKey){
this.$.target.set(this.$.targetKey, this.$.transform(val, this.$.rootScope));
}else if(this.$.callback){
this.$.callback.call(this.$.target,this.$.transform(val, this.$.rootScope));
}
}
});
var $bindingRegex= /^((?:\{{2}(.+)\}{2})|(?:\{(.+)\}))$/i;
var $twoWayBindingRegex= /^\{{2}([a-z_$\}][\(\)a-z0-9$\-_.,\{]*)\}{2}$/i;
var $fncRegex = /^([a-z$_]\w*)\((.*)\)$/i;
var $fncNameRegex = /^(\w+)\(.*\)$/;
Binding.matches = function(attrValue){
return $bindingRegex.test(attrValue);
};
Binding.create = function(bindingDef, targetScope, attrKey){
var cb;
if(rAppid._.isFunction(attrKey)){
cb = attrKey;
}
var match = bindingDef.match($bindingRegex);
var path = match[2] ? match[2] : match[3];
var scopeKey = splitFirst(path);
var scope;
if($fncRegex.test(scopeKey)){
match = scopeKey.match($fncNameRegex);
scope = targetScope.getScopeForFncName(match[1]);
}else{
scope = targetScope.getScopeForKey(scopeKey);
}
if(scope && (scope != targetScope || attrKey != scopeKey)){
var twoWay = !rAppid._.isUndefined(match[2]);
var options = {scope:scope, path:path, target:targetScope, twoWay: twoWay};
if(cb){
options['callback'] = cb;
}else{
options['targetKey'] = attrKey;
}
return new Binding(options);
}
return null;
};
return Binding;
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Component",
["js.core.Element", "js.core.TextElement", "js.core.Binding"],
function (Element, TextElement, Binding) {
return Element.inherit({
ctor: function (attributes, descriptor, applicationDomain, parentScope, rootScope) {
this.$components = [];
this.$templates = {};
this.$configurations = [];
this.$children = [];
this.callBase();
},
events:[],
/**
* values to be injected
* @key {String} name of the variable for this.$key
* @value {Required Class}
*/
inject: {
},
_injectChain: function () {
return this._generateDefaultsChain("inject");
},
_preinitialize: function () {
this.callBase();
this._inject();
},
_inject: function () {
var inject = this._injectChain();
if (rAppid._.keys(inject).length > 0) {
// we need to inject at least on item
// synchronous singleton instantiation of Injection,
// because if module requires injection, application also depends on
// Injection.js and class should be installed.
var injection = this.$applicationDomain.createInstance("js.core.Injection");
for (var name in inject) {
if (inject.hasOwnProperty(name)) {
this.$[name] = injection.getInstance(inject[name]);
}
}
}
},
addComponent: function (component) {
if (!component) {
throw "component null";
}
this.$components.push(component);
if (this.$rootScope && component.$.cid) {
// register component by cid in the root scope
this.$rootScope.set(component.$.cid, component);
}
},
removeComponent: function (component) {
// TODO: implement and remove cid from rootscope
},
addChild: function (child) {
if (!(child instanceof Element)) {
throw "only children of type js.core.Component can be added"
}
this.addComponent(child);
child.$parent = this;
this.$children.push(child);
},
removeChild: function (child) {
if (!(child instanceof Element)) {
throw "only children of type js.core.Component can be removed"
}
var index = this.$children.indexOf(child);
if (index != -1) {
// child found
child.$parent = null;
this.$children.splice(index, 1);
}
if (this.$templates.hasOwnProperty(child.$.name)) {
// remove it from templates
delete this.$templates[child.$.name];
}
index = this.$children.indexOf(child);
if (index != -1) {
this.$configurations.splice(index, 1);
}
},
addTemplate: function (template) {
if (!template.$.name) {
throw "template without name";
}
this.addComponent(template);
this.$templates[template.$.name] = template;
},
addConfiguration: function (config) {
this.addComponent(config);
this.$configurations.push(config);
},
getTemplate: function (name) {
var tpl = this.$templates[name];
if (tpl) {
return tpl;
} else if (this.$parent && this.$parent != this) {
return this.$parent.getTemplate(name);
} else {
return null
}
},
// /**
// *
// * @param descriptor
// * auto - do not overwrite (default),
// * all - create all children
// * TODO none?
// */
// _initializeDescriptor: function (descriptor) {
// var childrenFromDescriptor = this._createChildrenFromDescriptor(descriptor);
//
// this._initializeChildren(childrenFromDescriptor);
//
// this._childrenInitialized();
// },
_initializeChildren: function (childComponents) {
for (var i = 0; i < childComponents.length; i++) {
// FIRST ADD CHILD
var child = childComponents[i];
if (child.constructor.name == "js.core.Template") {
this.addTemplate(child);
} else if (child.className.indexOf("js.conf") == 0) {
this.addConfiguration(child);
} else {
this.addChild(childComponents[i]);
}
// THEN INITIALIZE !
if (this.$creationPolicy == "auto") {
child._initialize(this.$creationPolicy);
}
}
},
_initializeAttributes: function (attributes) {
this.callBase();
if (this.$creationPolicy != "full") {
if (attributes.hasOwnProperty("creationPolicy")) {
this.$creationPolicy = attributes.creationPolicy;
delete attributes.creationPolicy;
}
}
},
_initializeDescriptors: function () {
var children = [];
var descriptors = [];
// go inherit tree up and search for descriptors
var current = this;
while (current) {
if (current._$descriptor) {
descriptors.unshift(current._$descriptor);
}
current = current.base;
}
// and add outside descriptor
descriptors.push(this.$descriptor);
for (var d = 0; d < descriptors.length; d++) {
children = children.concat(this._getChildrenFromDescriptor(descriptors[d]));
}
this._initializeChildren(children);
this._childrenInitialized();
},
/**
* an array of attributes names, which will expect handler functions
*/
_isEventAttribute:function (attributeName) {
return attributeName.indexOf("on") == 0;
// return this._eventAttributes.hasOwnProperty(attributeName);
},
_isComponentEvent: function(event){
for(var i = 0 ; i < this.events.length; i++){
if(event == this.events[i]){
return true;
}
}
return false;
},
_getEventTypeForAttribute:function (eventName) {
// TODO: implement eventAttribites as hash
return this._eventAttributes[eventName];
},
_initializeBindings: function () {
this.$bindings = [];
this.$eventDefinitions = [];
var attributes = this.$;
var self = this;
var binding, twoWay;
// Resolve bindings and events
for (var key in attributes) {
if (attributes.hasOwnProperty(key)) {
var value = attributes[key];
if (this._isEventAttribute(key)) {
if(this.$rootScope[value]){
this.$eventDefinitions.push({
name:key,
scope:this.$rootScope,
fncName:value
});
if(this._isComponentEvent(key.substr(2))){
this.bind(key,this.$rootScope[value], this.$rootScope);
}
}else{
throw "Couldn't find callback " + value + " for " + key + " event";
}
delete attributes[key];
} else if (Binding.matches(value)) {
binding = Binding.create(value, this, key);
if(binding){
this.$[key] = binding.getValue();
}else{
throw "Binding " + value + " couldn't be created";
}
}
}
}
for (var c = 0; c < this.$components.length; c++) {
this.$components[c]._initializeBindings();
}
},
_createComponentForNode: function (node, attributes) {
attributes = attributes || {};
// only instantiation and construction but no initialization
var appDomain = this.$applicationDomain;
var fqClassName = appDomain.getFqClassName(node.namespaceURI, this._localNameFromDomNode(node), true);
var className = appDomain.getFqClassName(node.namespaceURI, this._localNameFromDomNode(node), false);
return appDomain.createInstance(fqClassName, [attributes, node, appDomain, this, this.$rootScope], className);
},
_createTextElementForNode: function (node) {
// only instantiation and construction but no initialization
var appDomain = this.$applicationDomain;
return appDomain.createInstance("js.core.TextElement", [null, node, appDomain, this, this.$rootScope]);
},
_getChildrenFromDescriptor: function (descriptor) {
var childrenFromDescriptor = [], node, component;
if (descriptor) {
for (var i = 0; i < descriptor.childNodes.length; i++) {
node = descriptor.childNodes[i];
if (node.nodeType == 1) { // Elements
component = this._createComponentForNode(node);
childrenFromDescriptor.push(component);
} else if (node.nodeType == 3) { // Textnodes
// remove whitespaces from text textnodes
var text = node.textContent ? node.textContent : node.text;
if (text.trim().length > 0) {
if (node.textContent) {
node.textContent = text;
}
childrenFromDescriptor.push(this._createTextElementForNode(node));
}
}
}
}
return childrenFromDescriptor;
},
_childrenInitialized: function () {
},
initialize: function (scope) {
},
/**
* IE8 FIXES
* @param domNode
*/
_localNameFromDomNode: function (domNode) {
if (domNode.localName) return domNode.localName;
var st = domNode.tagName.split(":");
return st[st.length - 1];
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Content", ["js.core.Component"], function (Component) {
return Component.inherit(({
// TODO
}));
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Element",
["js.core.Bindable"], function (Bindable) {
var undef;
function stringToPrimitive(str) {
// if it's not a string
if (rAppid._.isString(str)) {
var n = parseFloat(str);
if (!rAppid._.isNaN(n)) {
return n;
}
if (str === "true") {
return true;
} else if (str === "false") {
return false;
}
}
return str;
}
return Bindable.inherit({
ctor: function (attributes, descriptor, applicationDomain, parentScope, rootScope) {
attributes = attributes || {};
if (!descriptor) {
// created from node
if (!rootScope) {
rootScope = this;
}
}
this.$descriptor = descriptor;
this.$applicationDomain = applicationDomain;
this.$parentScope = parentScope || null;
this.$rootScope = rootScope || null;
rAppid._.extend(attributes, this._getAttributesFromDescriptor(descriptor), this._getAttributesFromDescriptor(this._$descriptor));
this.callBase(attributes);
this._initializeAttributes(this.$);
// manually constructed
if (descriptor === undef || descriptor === null) {
this._initialize(this.$creationPolicy);
}
},
_getAttributesFromDescriptor: function (descriptor) {
var attributes = {};
if (descriptor && descriptor.attributes) {
var node;
for (var a = 0; a < descriptor.attributes.length; a++) {
node = descriptor.attributes[a];
attributes[node.nodeName] = stringToPrimitive(node.value);
}
}
return attributes;
},
defaults: {
creationPolicy: "auto"
},
_initializeAttributes: function (attributes) {
},
_initializeDescriptors: function () {
},
/**
*
* @param creationPolicy
* auto - do not overwrite (default),
* all - create all children
* TODO none?
*/
_initialize: function (creationPolicy, withBindings) {
if (this.$initialized) {
return;
}
this._preinitialize();
this.initialize();
this._initializeDescriptors();
if (this == this.$rootScope || withBindings) {
this._initializeBindings();
}
this._initializationComplete();
},
_initializeBindings: function () {
},
_initializeDescriptor: function (descriptor) {
},
initialize: function () {
},
find: function (key) {
var scope = this.getScopeForKey(key);
if (this == scope) {
return this.callBase();
} else if (scope != null) {
return scope.get(key);
} else {
return null;
}
},
getScopeForKey: function (key) {
// try to find value for first key
var value = this.$[key];
// if value was found
if (!rAppid._.isUndefined(value)) {
return this;
} else if (this.$parentScope) {
return this.$parentScope.getScopeForKey(key);
} else {
return null;
}
},
getScopeForFncName: function(fncName){
var fnc = this[fncName];
if(!rAppid._.isUndefined(fnc) && rAppid._.isFunction(fnc)){
return this;
} else if(this.$parentScope){
return this.$parentScope.getScopeForFncName(fncName);
} else {
return null;
}
},
_preinitialize: function () {
},
_initializationComplete: function () {
this.$initialized = true;
},
_getTextContentFromDescriptor:function (desc) {
return desc.textContent ? desc.textContent : desc.text;
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
var a = 0;
rAppid.defineClass("js.core.EventDispatcher",
["js.core.Base"],
/**
* Base class for trigger and listen to events
* @export js/core/EventDispatcher
*/
function (Base) {
Function.prototype.on = function () {
var events = Array.prototype.slice.call(arguments, 0);
this._events = [];
for (var i = 0; i < events.length; i++) {
var event = events[i];
this._events.push(event);
}
return this;
};
Function.prototype.onChange = function () {
var events = Array.prototype.slice.call(arguments, 0);
this._events = [];
for (var i = 0; i < events.length; i++) {
var event = events[i];
event = "change:" + event;
this._events.push(event);
}
return this;
};
var undefinedValue;
var EventDispatcher = Base.inherit({
ctor: function () {
this.callBase();
this._eventHandlers = {};
},
bind: function (eventType, callback, scope) {
scope = scope || this;
// get the list for the event
var list = this._eventHandlers[eventType] || (this._eventHandlers[eventType] = []);
// and push the callback function
list.push(new EventDispatcher.EventHandler(callback, scope));
return this;
},
/**
*
* @param {String} eventType
* @param {js.core.EventDispatcher.Event|Object} event
* @param caller
*/
trigger: function (eventType, event, caller) {
if (this._eventHandlers[eventType]) {
if (!(event instanceof EventDispatcher.Event)) {
event = new EventDispatcher.Event(event);
}
if (!caller) {
caller = arguments.callee.caller;
}
event.type = eventType;
var list = this._eventHandlers[eventType];
for (var i = 0; i < list.length; i++) {
if (list[i]) {
var result = list[i].trigger(event, caller);
if (result !== undefinedValue) {
ret = result;
if (result === false) {
event.preventDefault();
event.stopPropagation();
}
}
if (event.isImmediatePropagationStopped) {
break;
}
}
}
}
return event;
},
unbind: function (eventType, callback) {
if (!eventType) {
// remove all events
this._eventHandlers = {};
} else if (!callback) {
// remove all callbacks for these event
this._eventHandlers[eventType] = [];
} else if (this._eventHandlers[eventType]) {
var list = this._eventHandlers[eventType];
for (var i = list.length - 1; i >= 0; i--) {
if (list[i].$callback == callback) {
list.splice(i, 1); // delete callback
}
}
}
}
});
EventDispatcher.Event = Base.inherit({
ctor: function (attributes) {
this.$ = attributes;
this.isDefaultPrevented = false;
this.isPropagationStopped = false;
this.isImmediatePropagationStopped = false;
},
preventDefault: function () {
this.isDefaultPrevented = true;
var e = this.orginalEvent;
if (e) {
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false; // IE
}
}
},
stopPropagation: function () {
this.isPropagationStopped = true;
var e = this.originalEvent;
if (e) {
if (e.stopPropagation) {
e.stopPropagation();
}
e.cancelBubble = true;
}
},
stopImmediatePropagation: function () {
this.isImmediatePropagationStopped = true;
this.stopPropagation();
}
});
EventDispatcher.EventHandler = Base.inherit({
ctor: function (callback, scope) {
this.scope = scope;
this.$callback = callback;
},
trigger: function (event, caller) {
this.$callback.call(this.scope, event, caller);
}
});
return EventDispatcher;
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.History", ["js.core.Bindable"], function (Bindable) {
var routeStripper = /^#\/?/,
undef;
return Bindable.inherit({
ctor: function () {
this.callBase();
this.$routers = [];
this.processUrl = true;
},
defaults: {
interval: 50
},
getFragment: function (fragment) {
fragment = decodeURIComponent(fragment || window.location.hash);
return fragment.replace(routeStripper, '');
},
start: function () {
var self = this;
this.$checkUrlFn = function () {
self.checkUrl.apply(self, arguments);
};
if ("onhashchange" in window) {
if (window.addEventListener) {
window.addEventListener('hashchange',
this.$checkUrlFn, false);
} else {
window.attachEvent('onhashchange', this.$checkUrlFn);
}
} else {
// polling
this.$checkUrlInterval = setInterval(this.$checkUrlFn, this.$.interval);
}
this.fragment = this.getFragment();
this.navigate(this.fragment);
},
stop: function () {
if ("onhashchange" in window) {
if (window.removeEventListener) {
window.removeEventListener('hashchange',
this.$checkUrlFn, false);
} else {
window.detachEvent('onhashchange', this.$checkUrlFn);
}
} else {
// polling
clearInterval(this.$checkUrlInterval);
}
},
addRouter: function (router) {
this.$routers.push(router);
},
checkUrl: function (e) {
if (this.processUrl) {
var currentFragment = this.getFragment();
if (currentFragment == this.fragment) {
return false;
}
}
this.processUrl = true;
},
triggerRoute: function (fragment) {
for (var i = 0; i < this.$routers.length; i++) {
if (this.$routers[i].executeRoute(fragment)) {
return true;
}
}
console.log("no route for '" + fragment + "' found.");
},
navigate: function (fragment, createHistoryEntry, triggerRoute) {
if (createHistoryEntry == undef || createHistoryEntry == null) {
createHistoryEntry = true;
}
if (triggerRoute == undef || triggerRoute == null) {
triggerRoute = true;
}
this.processUrl = false;
if (createHistoryEntry) {
window.location.hash = "/" + fragment;
} else {
// replace hash
window.location.replace("#/" + fragment);
}
this.fragment = fragment;
if (triggerRoute) {
return this.triggerRoute(fragment);
}
}
});
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.I18n", ["js.core.Component"], function(Component) {
return Component.inherit({
defaults: {
path: 'app/locale',
locale: null,
suffix: '.json',
translations: {}
},
initialize: function() {
this.callBase();
this.loadLocale(this.$.locale);
},
_commitChangedAttributes: function(attributes) {
if (attributes.locale) {
this.loadLocale(attributes.locale);
}
},
loadLocale: function(locale, callback) {
if (!locale) {
throw "locale not defined";
}
var self = this;
rAppid.require(['json!' + this.$.path + '/' + this.$.locale + this.$.suffix], function (translations) {
if (callback) {
callback();
}
self.set({
translations: translations
});
});
},
/**
* @param [num] for plural or singular
* @param key translation key
* @param - replacement for %0
* @param - replacement for %1 ...
*/
translate: function() {
var args = Array.prototype.slice.call(arguments);
var key = args.shift(), isPlural;
if(rAppid._.isNumber(key)){
isPlural = key !== 1;
key = args.shift();
}
if(isPlural){
key += "_plural";
}
var value = this.$.translations[key] || "";
for (var i = 0; i < args.length; i++) {
// replace, placeholder
value = value.split("%" + i).join(args[i]);
}
return value;
}.onChange("translations")
})
})
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Imports", ["js.core.Element"], function (Component) {
return Component.inherit({
});
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Injection", ["js.core.Component"], function (Component) {
var singleton;
function factoryInheritsFrom(factory, type) {
return factory == type || factory.prototype instanceof type;
}
return Component.inherit({
ctor: function () {
if (!singleton) {
this.callBase();
this.$singletonInstanceCache = [];
this.$factories = [];
singleton = this;
}
return singleton;
},
_childrenInitialized: function () {
this.callBase();
for (var c = 0; c < this.$configurations.length; c++) {
var config = this.$configurations[c];
if (config.className == "js.conf.Factory") {
this.addFactory(config.$);
}
}
},
getInstance: function (type) {
// TODO: add class hierarchy distance check
var instance;
// go to the singleton instance and look for requested instance
for (var i = 0; i < this.$singletonInstanceCache.length; i++) {
instance = this.$singletonInstanceCache[i];
if (instance instanceof type) {
return instance;
}
}
// instance not found -> go thought the factories
for (var f = 0; f < this.$factories.length; f++) {
var factory = this.$factories[f];
if (factoryInheritsFrom(factory.factory, type)) {
// create instance
instance = new factory.factory();
if (instance instanceof type) {
if (factory.singleton) {
this.addInstance(instance)
}
return instance;
}
}
}
throw "requested injection type not found";
},
addChild: function (child) {
this.addInstance(child);
},
addFactory: function (factory) {
if (factory instanceof Function) {
factory = {
factory: factory
}
}
rAppid._.defaults(factory, {
"type": null,
"factory": null,
"singleton": false
});
if (!factory.factory) {
// get factory from class
var fac = this.$applicationDomain.getDefinition(factory.type);
if (!fac) {
throw "factory for type '" + factory.type + "' not found";
}
factory.factory = fac;
}
this.$factories.push(factory);
},
addInstance: function (instance) {
if (instance instanceof Function) {
throw "got a factory instead of an instance"
}
this.$singletonInstanceCache.push(instance);
}
});
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.List", ["js.core.EventDispatcher","js.core.Bindable"], function(EventDispatcher, Bindable) {
return EventDispatcher.inherit({
ctor: function(items){
this.$items = [];
this.callBase();
if(items){
this.add(items);
}
var self = this;
this.bind('add', function () {
self.length = self.size();
});
this.bind('remove', function () {
self.length = self.size();
});
this.length = this.size();
},
hasItems: function(){
return this.$items.length > 0;
}.on("add","remove"),
push: function(item){
// TODO: add options
this.$items.push(item);
this.trigger('add', {item:item, index:this.$items.length-1});
},
pop: function(){
// TODO: add options
return this.removeAt(this.$items.length);
},
shift: function(){
// TODO: add options
return this.removeAt(0);
},
unshift: function(item){
// TODO: add options
this.$items.unshift(item);
this.trigger('add', {item:item, index: 0});
},
add: function(items, options){
options = options || {};
rAppid._.defaults(options, {silent:false, index:this.$items.length});
var index = options.index;
if(!rAppid._.isArray(items)){
items = [items];
}
var item, itemIndex;
for(var i = 0; i < items.length; i++){
item = items[i];
if(item instanceof Bindable){
item.bind('change',this._onItemChange,this);
}
itemIndex = index+i;
this.$items.splice(itemIndex,0,item);
if(options.silent !== true){
this.trigger('add', {item:item, index:itemIndex})
}
}
},
_onItemChange: function(e,item){
this.trigger('change',{item: item, index: this.$items.indexOf(item)});
},
remove: function(items, options){
if(!rAppid._.isArray(items)){
items = [items];
}
for(var i = 0 ; i < items.length; i++){
this.removeAt(this.$items.indexOf(items[i]),options);
}
},
removeAt: function(index,options){
options = options || {};
if(index > -1 && index < this.$items.length){
var items = this.$items.splice(index,1);
if(options.silent !== true){
this.trigger('remove', {item:items[0], index:index});
}
return items[0];
}
return null;
},
reset: function(items){
this.$items = items;
this.trigger('reset',{items: items});
},
sort: function(fnc){
this.trigger('sort', {items: this.$items.sort(fnc)});
},
clear: function(){
this.reset([]);
},
size: function(){
return this.$items.length;
}.on('add','remove')
,
at: function(index){
if(index < this.$items.length && index >= 0){
return this.$items[index];
}
return null;
},
each: function(fnc,scope){
scope = scope || this;
for(var i = 0; i < this.$items.length; i++){
fnc.call(scope,this.$items[i],i);
}
}
})
})
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Module", ["js.core.UIComponent"], function (UIComponent) {
return UIComponent.inherit({
/**
* loads the
* @param callback
*/
start: function (callback) {
},
render: function (target) {
}
});
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.ModuleLoader", ["js.core.UIComponent", "js.ui.ContentPlaceHolder",
"require", "js.core.Module"],
function (UIComponent, ContentPlaceHolder, require, Module) {
var ModuleLoader = UIComponent.inherit({
ctor: function (attributes) {
this.callBase();
this.$modules = {};
},
addChild: function (child) {
this.callBase();
if (child && child.className == "js.conf.Module") {
this.addModule(child.$);
}
},
addModule: function (module) {
rAppid._.defaults(module, {
name: null,
moduleClass: null,
route: null,
cacheInstance: true
});
if (!module.name && !module.route) {
throw "module cannot be added: route or at least name is required";
}
if (!module.moduleClass) {
throw "no moduleClass defined for module";
}
if (module.name) {
if (this.modules.hasOwnProperty(module.name)) {
throw "module with name '" + module.name + "' already registered"
}
this.modules[module.name] = module;
}
if (module.route) {
if (!this.$.router) {
throw "defining modules with routes requires a router instance to be set"
}
var self = this;
this.$.router.route(module.name, module.route, function () {
// route triggered
// load module
if (module.name) {
self.loadModuleByName(module.name, null);
} else {
self.loadModule(module.moduleClass, null);
}
});
}
},
loadModuleByName: function (moduleName, callback) {
if (this.modules.hasOwnProperty(moduleName)) {
var module = this.modules[moduleName];
if (module.cacheInstance && module.moduleInstance) {
// TODO: load instance from cache
} else {
this.loadModule(module.moduleClass, callback);
}
} else {
throw "Module '" + moduleName + "' not found";
}
},
loadModule: function (moduleFqClassName, callback) {
var eventResult = this.trigger("loadModule", {
moduleClass: moduleFqClassName
});
var internalCallback = function (err) {
// TODO Dispatch events
if (callback) {
callback(err);
}
};
var self = this;
if (!eventResult.isDefaultPrevented) {
// load module
require.require([moduleFqClassName], function (moduleBaseClass) {
var moduleInstance = new moduleBaseClass(null, moduleBaseClass.prototype._$descriptor, self.$applicationDomain, null, null);
if (moduleInstance instanceof Module) {
moduleInstance._initialize("auto");
internalCallback(null);
// TODO: show and start module
} else {
internalCallback("Module '" + moduleFqClassName + "' isn't an instance of js.core.Module");
}
});
// TODO cache model instances
// Trigger events
}
},
removeChild: function (child) {
this.callBase();
var index = this.$modules.indexOf(child);
if (index != -1) {
// TODO: remove route from router
}
},
render: function () {
// render the ContentPlaceHolder
this.callBase();
},
getContentPlaceHolders: function () {
return ModuleLoader.findContentPlaceHolders(this);
}
});
ModuleLoader.findContentPlaceHolders = function (component) {
var ret = [];
for (var i = 0; i < component.$children.length; i++) {
var child = component.$children[i];
if (child instanceof ContentPlaceHolder) {
ret.push(child);
} else {
ret.concat(ModuleLoader.findContentPlaceHolders(child));
}
}
return ret;
};
return ModuleLoader;
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Router", ["js.core.Component"],
function (Component) {
return Component.inherit({
ctor: function () {
this.$routes = [];
this.callBase();
},
initialize: function () {
this.callBase();
if (this.$.history) {
this.history = this.$.history;
} else {
this.history = rAppid.systemManager.application.history;
}
this.history.addRouter(this);
},
/**
*
* @param {Regexp|Object} route
* @param {Function} [fn]
*/
addRoute: function () {
var route;
if (arguments.length == 2) {
route = {
regex: arguments[0],
fn: arguments[1]
}
} else {
route = arguments[0];
}
rAppid._.defaults(route, {
name: null,
regex: null,
fn: null
});
if (!(route.fn && route.regex)) {
throw "fn and regex required"
}
this.$routes.push(route);
},
executeRoute: function (fragment) {
// Test routes and call callback
for (var i = 0; i < this.$routes.length; i++) {
var route = this.$routes[i];
var params = route.regex.exec(fragment);
if (params) {
params.shift();
route.fn.apply(this, params);
return true;
}
}
return false;
},
/**
* shortcut to history.navigate
* @param to
* @param createHistoryEntry
* @param triggerRoute
*/
navigate: function (to, createHistoryEntry, triggerRoute) {
return this.history.navigate(to, createHistoryEntry, triggerRoute);
}
});
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Script", ["js.core.Element"], function (El) {
return El.inherit({
// all the crazy stuff is done in xaml.js
evaluate: function (imports) {
var textContent = this.$descriptor.textContent ? this.$descriptor.textContent : this.$descriptor.text;
var fn = eval("this.javascript = (" + textContent + ")");
return fn.apply(this, imports);
}
});
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.Template", ["js.core.Component"],
function (Component) {
// this is because circular dependency
return Component.inherit({
_initializeDescriptors: function () {
this._childrenInitialized();
},
createComponents: function (attributes, parentScope, rootScope) {
rootScope = rootScope || this.$rootScope;
parentScope = parentScope || this.$parentScope;
// foreach child Descriptor
var components = this._getChildrenFromDescriptor(this.$descriptor);
for (var c = 0; c < components.length; c++) {
components[c].$parentScope = parentScope;
components[c].$rootScope = rootScope;
components[c].set(attributes);
components[c]._initialize("auto", true);
}
return components
}
});
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.TextElement",
["js.core.Element", "js.core.Binding"], function (Element, Binding) {
var bindingRegEx = /\{(([^{]*\{[^{}]*\})|[^{}])*?}/g;
return Element.inherit({
_initializeBindings: function () {
this.$textBindings = {};
var textContent = this._getTextContentFromDescriptor(this.$descriptor);
// find bindings and register for onchange event
var key, match, binding;
while (match = bindingRegEx.exec(textContent)) {
key = match[0];
if(Binding.matches(key)){
binding = Binding.create(key, this, key);
if(binding){
this.$textBindings[key] = binding;
this.$[key] = this.$textBindings[key].getValue();
}else{
throw "could not create binding for " + key;
}
}
}
},
render: function () {
if (!this.$initialized) {
this._initialize(this.$creationPolicy);
}
this.$el = document.createTextNode("");
if (this.$descriptor) {
this._renderTextContent(this._getTextContentFromDescriptor(this.$descriptor));
}
return this.$el;
},
_renderTextContent: function (textContent) {
for(var key in this.$textBindings){
if(this.$textBindings.hasOwnProperty(key)){
var val = this.$textBindings[key].getValue();
if(rAppid._.isUndefined(val) || val == null){
val = "";
}
textContent = textContent.split(key).join(val);
}
}
if(this.$el.textContent){
this.$el.textContent = textContent;
}else{
this.$el.nodeValue = textContent;
}
},
_commitChangedAttributes: function () {
if (this.$el && this.$descriptor) {
this._renderTextContent(this._getTextContentFromDescriptor(this.$descriptor));
}
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.core.UIComponent",
["js.html.DomElement"], function (DomElement) {
return DomElement.inherit({
defaults: {
tagName: "div"
},
$behavesAsDomElement: false
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.data.Collection", ["js.core.List", "js.data.Model"], function (List, Model) {
var Collection = List.inherit({
ctor: function(items, options) {
this.callBase(items);
rAppid._.defaults(options, {
rootCollection: null,
chunkSize: null,
queryParameters: {},
factory: Model,
type: null
});
this.$queryCollectionsCache = {};
this.$options = options;
},
getRootCollection: function() {
return this.$options.rootCollection ? this.$options.rootCollection : this;
},
createQueryCacheKey: function(queryParameters) {
queryParameters = queryParameters || {};
var ret = [];
for (var key in queryParameters) {
if (queryParameters.hasOwnProperty(key)) {
ret.push(key + "=" + queryParameters[key]);
}
}
ret.sort();
if (ret.length == 0) {
return "root";
}
return ret.join("&");
},
createQueryCollection: function(queryParameter) {
var options = {
queryParameter: queryParameter,
rootCollection: this.getRootCollection
};
// different queryParameter, same options
rAppid._.defaults(options, this.$options);
return new Collection(null, options);
},
// fetches the complete list
fetch: function(options, callback) {
options = options || {};
},
// returns a new collections
find: function(parameters) {
var queryKey = this.createQueryCacheKey(parameters);
if (!this.$queryCollectionsCache.hasOwnProperty(queryKey)) {
this.$queryCollectionsCache[queryKey] = this.createQueryCollection(parameters);
}
return this.$queryCollectionsCache[queryKey];
}
});
return Collection;
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.data.DataSource",
["js.core.Component", "js.core.Base", "js.data.Collection"],
function (Component, Base, Collection) {
var Context = Base.inherit({
ctor: function (datasource, properties, parentContext) {
this.callBase();
this.$datasource = datasource;
this.$properties = properties;
this.$parent = parentContext;
this.$cache = {};
},
addModelToCache: function (model) {
this.$cache[Context.generateCacheIdFromModel(model)] = model;
},
addCollectionToCache: function (collection) {
this.$cache[Context.generateCacheIdFromCollection(collection)] = collection;
},
getInstanceByCacheId: function (cacheId) {
return this.$cache[cacheId];
},
createModel: function (factory, id, type) {
if (rAppid._.isFunction(factory)) {
type = type || factory.prototype.constructor.name;
var cachedItem = this.getInstanceByCacheId(Context.generateCacheId(type));
if (!cachedItem) {
// create new Collection
cachedItem = new factory({
id: id
});
// set context
cachedItem.$context = this;
cachedItem.className = type;
// and add it to the cache
this.addModelToCache(cachedItem);
}
return cachedItem;
} else {
throw "Factory has to be a function";
}
},
createCollection: function (factory, options, type) {
options = options || {};
if (rAppid._.isFunction(factory)) {
type = type || factory.prototype.constructor.name;
rAppid._.defaults(options, {
factory: factory,
type: type
});
var cachedCollection = this.getInstanceByCacheId(Context.generateCacheId(type));
if (!cachedCollection) {
// create new Collection
cachedCollection = new Collection(null, options);
// set context
cachedCollection.$context = this;
cachedCollection.className = type;
// and add it to the cache
this.addCollectionToCache(cachedCollection);
}
return cachedCollection;
} else {
throw "Factory has to be a function";
}
}
});
Context.generateCacheId = function (type, id) {
if (id) {
return type + "_" + id;
} else {
return type;
}
};
Context.generateCacheIdFromModel = function (model) {
return Context.generateCacheId(model.className, model.$.id);
};
Context.generateCacheIdFromCollection = function (collection) {
return Context.generateCacheId(collection.className);
};
var DataSource = Component.inherit({
ctor: function () {
this.callBase();
this.$configuredTypes = [];
this.$contextCache = {};
},
_childrenInitialized: function () {
this.callBase();
for (var c = 0; c < this.$configurations.length; c++) {
var config = this.$configurations[c];
if (config.className == "js.conf.Type") {
this.addTypeConfiguration(config);
}
}
},
addTypeConfiguration: function (configuration) {
if (!configuration.$.className && !configuration.$.alias) {
throw "neither className nor alias defined";
}
if (configuration.$.className && !configuration.$.alias) {
configuration.$.alias = configuration.$.className.split(".").pop();
}
if (!configuration.$.className) {
configuration.$.className = "js.data.Model";
}
this.$configuredTypes.push(configuration);
},
getFqClassName: function (alias) {
for (var i = 0; i < this.$configuredTypes.length; i++) {
var typeConfig = this.$configuredTypes[i];
if (typeConfig.$.alias == alias) {
return typeConfig.$.className;
}
}
},
getModelClassNameForAlias: function (alias) {
var fqClassname = this.getFqClassName(alias) || alias;
if (fqClassname == "js.data.Model") {
return alias;
}
return fqClassname;
},
getContext: function (properties, parentContext) {
var cacheId = this.createContextCacheId(properties, parentContext ? parentContext.$properties : null);
if (!this.$contextCache.hasOwnProperty(cacheId)) {
this.$contextCache[cacheId] = this.createContext(properties, parentContext);
}
return this.$contextCache[cacheId];
},
/**
* returns the root context
*/
root: function () {
return this.getContext();
},
createContext: function (properties, parentContext) {
return new Context(this, properties, parentContext)
},
createContextCacheId: function (properties, parentProperties) {
var ret = [];
rAppid._.each(rAppid._.extend({}, parentProperties, properties), function (value, key) {
ret.push(key + "=" + value);
});
rAppid._.sortBy(ret, function (value) {
return value;
});
if (ret.length == 0) {
return "root";
}
return ret.join("&");
},
createModel: function (factory, id, type, context) {
context = context || this.getContext();
return context.createModel(factory, id, type);
},
createCollection: function (factory, options, type, context) {
context = context || this.getContext();
return context.createCollection(factory, options, type);
},
/**
* resolve references to models and collections
* @param {js.data.Model} model
* @param {JSON} data deserialized, parsed data
* @param {Object} options
* @param {Function} callback - function (err, resolvedData)
*/
resolveReferences: function (model, data, options, callback) {
if (callback) {
callback("Abstract method", data);
}
},
loadModel: function (model, options, callback) {
if (callback) {
callback("Abstract method", model);
}
},
update: function (data, callback) {
},
remove: function (data, callback) {
},
find: function (data, callback) {
}
});
DataSource.Context = Context;
return DataSource;
});
})
;
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.data.Model", ["js.core.Bindable", "js.core.List", "flow"], function (Bindable, List, flow) {
var cid = 0;
var State = {
CREATED: 0,
LOADING: 1,
LOADED: 2,
ERROR: -1
};
var Model = Bindable.inherit({
ctor: function (attributes) {
this.callBase(attributes);
this.$cid = ++cid;
// stores the current fetch state
this._fetch = {
callbacks: [],
state: State.CREATED
}
},
save: function (options, callback) {
this.$context.$datasource.save(options, callback);
},
/**
* @param options
* @param options.fetchSubModels
*
*
* @param {Function} callback - function(err, model, options)
*/
fetch: function (options, callback) {
options = options || {};
var self = this;
if (this._fetch.state === State.LOADING) {
// currently fetching -> register callback
this._fetch.callbacks.push(function(err, model) {
modelFetchedComplete(err, model, options, callback);
});
} else if (this._fetch.state == State.LOADED) {
// completed loaded -> execute
modelFetchedComplete(null, this, options, callback);
} else {
// set state and start loading
self._fetch.state = State.LOADING;
this.$context.$datasource.loadModel(this, options, function(err, model) {
self._fetch.state = err ? State.ERROR : State.LOADED;
// execute callbacks
modelFetchedComplete(err, model, options, callback);
rAppid._.each(self._fetch.callbacks, function(cb) {
cb(err, model);
});
});
}
},
remove: function (options, callback) {
this.$context.$datasource.remove(options, callback);
},
/**
* prepares the data for serialisation
* @return {Object} all data that should be serialized
*/
prepare: function() {
var ret = {};
for (var key in this.$) {
if (this.$.hasOwnProperty(key)) {
var value = this.$[key];
if (!rAppid._.isFunction(value)) {
ret[key] = value;
}
}
}
return ret;
},
/**
* parse the deserializied data
* @param data
*/
parse: function(data) {
// convert all arrays to List
function convertArrayToList(obj) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
var value = obj[prop];
if (rAppid._.isArray(value)) {
// convert array to js.core.List
obj[prop] = new List(value);
for (var i = 0; i < value.length; i++) {
convertArrayToList(value[i]);
}
} else if (value instanceof Object) {
convertArrayToList(value);
}
}
}
}
convertArrayToList(data);
return data;
},
status: function() {
if (this.$.id === false) {
return "DELETED";
} else {
return this.$.id ? "CREATED" : "NEW";
}
}.on("id")
});
function fetchSubModels(attributes, subModelTypes, delegates) {
rAppid._.each(attributes, function (value) {
if (value instanceof Model) {
// check if the model is required
var subModelTypeEntry = subModelTypes[value.className];
if (subModelTypeEntry) {
// model required -> create delegate
subModelTypeEntry.found = true;
delegates.push(function (cb) {
value.fetch({
fetchSubModels: subModelTypeEntry.subModels
}, cb);
});
}
} else if (value instanceof Object) {
fetchSubModels(value, subModelTypes, delegates);
}
});
}
function modelFetchedComplete(err, model, options, originalCallback) {
var callback = function (err, model) {
if (originalCallback) {
originalCallback(err, model, options)
}
};
if (err) {
callback(err, model);
} else {
var delegates = [];
if (options.fetchSubModels && options.fetchSubModels.length > 0) {
// for example fetch an article with ["currency", "product/design", "product/productType"]
var subModelTypes = createSubModelLoadingChain(model, options.fetchSubModels);
fetchSubModels(model.$, subModelTypes, delegates);
// check that all subResources where found
var missingSubModels = rAppid._.filter(subModelTypes, function (subModel) {
return !subModel.found;
});
if (missingSubModels.length > 0) {
// TODO load again with fullData=true if not laoded with fullData=false
console.log(["requested submodel missing", missingSubModels]);
callback("requested submodel missing", model);
return;
}
}
// execute all delegates in parallel and then execute callback
flow()
.par(delegates)
.exec(function (err) {
callback(err, model);
});
}
}
function createSubModelLoadingChain(model, subModels) {
var ret = {},
subModelParser = /^([\w][\w.]*)(?:\/([\w][\w.]*))?$/;
rAppid._.each(subModels, function (item) {
var parts = subModelParser.exec(item);
if (parts) {
var subModelType = model.$context.$datasource.getModelClassNameForAlias(parts[1]);
var subModelSubType = parts[2];
var subModelTypeEntry = ret[subModelType];
if (!subModelTypeEntry) {
// create an entry
subModelTypeEntry = {
type: subModelType,
found: false,
subModels: []
};
}
// add required subModelTypeStrings
if (subModelSubType) {
subModelTypeEntry.subModels.push(subModelSubType);
}
ret[subModelType] = subModelTypeEntry;
}
});
return ret;
}
return Model;
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.data.RestDataSource",
["js.data.DataSource", "js.core.Base", "js.core.List"], function (DataSource, Base, List) {
var RestContext = DataSource.Context.inherit({
createCollection: function(factory, options, type) {
options = options || {};
rAppid._.defaults(options, {
chunkSize: 1000
});
return this.callBase(factory, options, type);
},
getPathComponents: function() {
return [];
},
getQueryParameter: function() {
return {};
}
});
var referenceCollectionTypeExtractor = /^.*\/([^/]+)$/i,
referenceModelTypeExtractor = /^.*\/([^/]+)\/(\w+)$/i;
var RestDataSource = DataSource.inherit({
ctor: function() {
this.callBase();
this.$processors = [];
this.initializeProcessors();
},
initializeProcessors: function () {
this.$processors.push({
regex: /json/,
processor: new RestDataSource.JsonProcessor()
});
},
defaults: {
endPoint: null,
gateway: null,
identifierProperty: "id",
referenceProperty: "href"
},
initialize: function () {
if (!this.$.endPoint) {
console.warn("No end-point for RestDataSource defined");
}
if (!this.$.gateway) {
this.$.gateway = this.$.endPoint;
}
},
getClass: function (type) {
if (rAppid._.isFunction(type)) {
return type;
} else {
return rAppid.getDefinition(this.getFqClassName(type));
}
},
createContext: function (properties, parentContext) {
return new RestContext(this, properties, parentContext);
},
loadClass: function (type, callback) {
if (rAppid._.isFunction(type)) {
callback(null, type);
} else {
var className = this.getFqClassName(type);
if (className) {
rAppid.require(className, function (klass) {
callback(null, klass);
});
} else {
callback("className not found for type '" + type + "'");
}
}
},
getRestPathForModel: function(fqClassname) {
var typeConfig,
i;
// first search via className
for (i = 0; i < this.$configuredTypes.length; i++) {
typeConfig = this.$configuredTypes[i];
if (typeConfig.$.className == fqClassname) {
return typeConfig.$.path;
}
}
// search via alias
for (i = 0; i < this.$configuredTypes.length; i++) {
typeConfig = this.$configuredTypes[i];
if (typeConfig.$.alias == fqClassname) {
return typeConfig.$.path;
}
}
return null;
},
getPathComponentsForModel: function(model) {
var path = this.getRestPathForModel(model.className);
if (path) {
var ret = [path];
if (model.status() == "CREATED"){
ret.push(model.$.id);
}
return ret;
}
return null;
},
/**
* serialize the data
* @param data
*/
serialize: function (data) {
return JSON.stringify(data);
},
/**
* deserialize
* @param input
*/
deserialize: function (input) {
// TODO: enable IE7 and FF3 support? Or should the user add json2.js lib
return JSON.parse(input);
},
getQueryParameter: function() {
return {};
},
/**
*
* @param obj
*/
isReferencedModel: function(obj) {
return obj[this.$.identifierProperty] && obj[this.$.referenceProperty] &&
rAppid._.keys(obj).length == 2;
},
isReferencedCollection: function(obj) {
return obj[this.$.referenceProperty] && rAppid._.keys(obj).length == 1;
},
getContextPropertiesFromReference: function(reference) {
return null;
},
getReferenceInformation: function(reference, id) {
// url is something like
// http://example.com/api/context/resourceType/id
var extractor = id ? referenceModelTypeExtractor : referenceCollectionTypeExtractor;
var match = extractor.exec(reference);
if (match) {
var path = match[1];
for (var i = 0; i < this.$configuredTypes.length; i++) {
var config = this.$configuredTypes[i];
if (config.$.path == path) {
return {
context: this.getContextPropertiesFromReference(reference),
className: config.$.className,
requireClassName: config.$.className.replace(/\./g, "/"),
type: config.$.alias,
id: id
}
}
}
}
// could not retrieve reference information
return null;
},
resolveReferences: function(model, data, options, callback) {
// in REST models and collections will be referenced by href
// first identify all needed model classes
var referenceInformation = [],
self = this;
function findReferences(obj, api) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
var value = obj[prop];
// TODO: test if we need also go through array value and convert them
// or if this is actually done
if (value instanceof List) {
value.each(function(item) {
findReferences(item, api);
});
} else if (value instanceof Object) {
// value is object and could contain sub objects with references
// first resolve references
findReferences(value, api);
if (self.isReferencedModel(value) || self.isReferencedCollection(value)) {
var info = self.getReferenceInformation(value[self.$.referenceProperty], value[self.$.identifierProperty]);
if (info) {
info.referenceObject = obj;
info.propertyName = prop;
referenceInformation.push(info);
} else {
throw "Cannot determinate referenceInformation for reference '" + value[self.$.referenceProperty] + "'.";
}
}
}
}
}
}
findReferences(data);
var requiredClasses = [];
for (var i = 0; i < referenceInformation.length; i++) {
var info = referenceInformation[i];
var requiredClassname = info.requireClassName;
if (rAppid._.indexOf(requiredClasses, requiredClassname) == -1) {
requiredClasses.push(requiredClassname);
}
}
// require model classes
// TODO: how to handle errors here? require.onError?
// some unique hash and extending of requirejs required
rAppid.require(requiredClasses, function () {
var factories = Array.prototype.slice.call(arguments);
for (var i = 0; i < referenceInformation.length; i++) {
var info = referenceInformation[i];
var factory = factories[rAppid._.indexOf(requiredClasses, info.requireClassName)];
if (factory) {
// create instance in correct context
var context = self.getContext(info.context, model.$context);
var isModel = info.id;
var referenceInstance = isModel ?
self.createModel(factory, info.id, info.type, context) :
self.createCollection(factory, null, info.type, context);
if (referenceInstance) {
var value = info.referenceObject[info.propertyName];
info.referenceObject[info.propertyName] = referenceInstance;
if (isModel) {
referenceInstance.set(value);
} else {
// TODO: set loaded data for collection, if available in payload
}
} else {
callback("Instance for model '" + info.className + "' couldn't be created");
}
} else {
callback("Factory for class '" + info.className + "' missing");
}
}
callback(null, data);
});
},
/**
*
* @param model
* @param options
* @param callback function(err, model, options)
*/
loadModel: function (model, options, callback) {
// map model to url
var modelPathComponents = this.getPathComponentsForModel(model);
if (!modelPathComponents) {
callback("path for model unknown", null, options);
return;
}
// build uri
var uri = [this.$.gateway];
uri = uri.concat(model.$context.getPathComponents());
uri = uri.concat(modelPathComponents);
// get queryParameter
var params = rAppid._.defaults(model.$context.getQueryParameter(),this.getQueryParameter());
// create url
var url = uri.join("/");
var self = this;
// send request
rAppid.ajax(url, {
type: "GET",
queryParameter: params
}, function (err, xhr) {
if (!err && (xhr.status == 200 || xhr.status == 304)) {
// find processor that matches the content-type
var processor,
contentType = xhr.getResponseHeader("Content-Type");
for (var i = 0; i < self.$processors.length; i++) {
var processorEntry = self.$processors[i];
if (processorEntry.regex.test(contentType)) {
processor = processorEntry.processor;
break;
}
}
if (!processor) {
callback("No processor for content type '" + contentType + "' found", null, options);
return;
}
try {
// deserialize data with processor
var data = processor.deserialize(xhr.responses);
// parse data inside model
data = model.parse(data);
self.resolveReferences(model, data, options, function(err, resolvedData) {
// set data
model.set(resolvedData);
// and return
callback(null, model, options);
});
} catch (e) {
callback(e, null, options);
}
} else {
// TODO: better error handling
err = err || "wrong status code";
callback(err, null, options);
}
});
}
});
RestDataSource.RestContext = RestContext;
RestDataSource.Processor = Base.inherit({
serialize: function(data) {
throw "abstract method";
},
deserialize: function(responses) {
throw "abstract method";
}
});
RestDataSource.JsonProcessor = RestDataSource.Processor.inherit({
serialize: function (data) {
return JSON.stringify(data);
},
deserialize: function (responses) {
return JSON.parse(responses.text);
}
});
return RestDataSource;
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.html.DomElement",
["js.core.Component", "js.core.Content", "js.core.Binding"], function (Component, Content, Binding) {
var rspace = /\s+/;
var domEvents = ['click','dblclick','keyup', 'keydown' , 'change'];
var DomElementFunctions = {
defaults:{
selected:false,
selectable:false
},
$behavesAsDomElement:true,
ctor:function (attributes, descriptor, applicationDomain, parentScope, rootScope) {
this.$renderMap = {};
this.$childViews = [];
this.$contentChildren = [];
this.callBase();
if (descriptor) {
if (!this.$tagName) {
this.$tagName = descriptor.tagName;
}
if (!this.$namespace) {
this.$namespace = descriptor.namespaceURI;
}
}
},
_initializeAttributes:function (attributes) {
this.callBase();
if (attributes.tagName) {
this.$tagName = attributes.tagName;
delete(attributes.tagName);
}
},
addChild:function (child) {
this.callBase();
if (child instanceof DomElement || child.render) {
this.$childViews.push(child);
if(this.isRendered()){
this._renderChild(child);
}
}else if(child instanceof Content){
this.$contentChildren.push(child);
}
},
getPlaceHolder:function (name) {
for (var i = 0; i < this.$children.length; i++) {
if (this.$children[i].$.name === name) {
return this.$children[i];
}
}
var placeholder;
for (i = 0; i < this.$children.length; i++) {
if (this.$children[i].getPlaceHolder) {
placeholder = this.$children[i].getPlaceHolder(name);
if (placeholder) {
return placeholder;
}
}
}
return null;
},
render:function () {
if (!this.$initialized) {
this._initialize(this.$creationPolicy);
}
// check if it is already rendered
if (this.isRendered()) {
return this.$el;
}
this.$renderedChildren = [];
this.$el = document.createElement(this.$tagName);
this.$el.owner = this;
// TODO: read layout and create renderMAP
/**
* <js:Template name="layout"><placeholder cid="icon"/><placeholder cid="label"/></js:Template>
*/
this._renderChildren(this.$childViews);
this._renderContentChildren(this.$contentChildren);
this._renderAttributes(this.$);
this._bindDomEvents(this.$el);
return this.$el;
},
_bindDomEvents:function (el) {
var self = this, domEvent;
function bindDomEvent(eventName,scope,fncName){
self.bind(eventName,scope[fncName],scope);
domEvent = eventName.substr(2);
self.addEventListener(domEvent, function (e) {
self.trigger(eventName, e, self);
});
}
var eventDef;
for(var i = 0 ; i < this.$eventDefinitions.length; i++){
eventDef = this.$eventDefinitions[i];
if(!this._isComponentEvent(eventDef.name.substr(2))){
bindDomEvent(eventDef.name, eventDef.scope, eventDef.fncName);
}
}
},
_renderChildren:function (children) {
// for all children
var child;
for (var i = 0; i < children.length; i++) {
child = children[i];
this._renderChild(child);
}
},
_renderContentChildren: function(children){
var child;
for(var i = 0; i < children.length; i++){
child = children[i];
var ref = child.get('ref');
var placeHolder = this.getPlaceHolder(ref);
if (placeHolder) {
placeHolder.set({content:child});
}
}
},
_renderChild:function (child) {
if (rAppid._.isFunction(child.render)) {
var el = child.render();
this.$renderedChildren.push(child);
if (el) {
this.$el.appendChild(el);
}
}
},
_getIndexOfPlaceHolder:function (placeHolder) {
if (this.$layoutTpl) {
var child;
for (var i = 0; i < this.$layoutTpl.$children.length; i++) {
child = this.$layoutTpl.$children[i];
if (placeHolderId == child.$cid) {
return i;
}
}
}
return -1;
},
isRendered:function () {
return typeof (this.$el) !== "undefined";
},
_renderAttributes:function (attributes) {
var attr;
for (var key in attributes) {
if (attributes.hasOwnProperty(key) && key.indexOf("$") !== 0 && key.indexOf("data") !== 0) {
attr = attributes[key];
this._renderAttribute(key, attr);
}
}
},
_renderAttribute:function (key, attr) {
var method = this.$renderMap[key];
var prev = this.$previousAttributes[key];
if (rAppid._.isUndefined(method)) {
// generic call of render functions
var k = key[0].toUpperCase() + key.substr(1);
var methodName = "_render" + k;
method = this[methodName];
if (!rAppid._.isFunction(method)) {
method = false;
}
this.$renderMap[key] = method;
}
if (method !== false) {
method.call(this, attr, prev);
} else if (this.$behavesAsDomElement) {
this.$el.setAttribute(key, attr);
}
},
_renderVisible:function (visible) {
if (visible === true) {
this.removeClass('hidden');
} else if (visible === false) {
this.addClass('hidden');
}
},
_renderHidden:function (hidden) {
if (typeof(hidden) !== "undefined") {
this.set({visible:!hidden});
}
},
_renderSelected:function (selected) {
if (selected === true) {
this.addClass('active');
} else if (selected === false) {
this.removeClass('active');
}
},
_renderSelectable:function (selectable) {
if (selectable === true) {
var self = this;
this.addEventListener('click', function (e) {
// e.preventDefault();
self.set({selected:!self.$.selected});
});
} else {
this.set({selected:false});
}
},
_renderWidth:function (width) {
if (width) {
if (typeof(width) !== "string") {
width += "px";
}
this.$el.style.width = width;
}
},
_renderHeight:function (height) {
if (height) {
if (typeof(height) !== "string") {
height += "px";
}
this.$el.style.height = height;
}
},
_commitChangedAttributes:function (attributes) {
if (this.isRendered()) {
this._renderAttributes(attributes);
}
},
dom:function (element) {
return new DomManipulation(element || this);
}
};
var DomManipulationFunctions = {
hasClass:function (value) {
// var classes = this.$el.className.split(" "+value+" ");
},
addClass:function (value) {
var classNames = value.split(rspace);
if (!this.$el.className && classNames.length === 1) {
this.$el.className = value;
} else {
var setClasses = this.$el.className.split(rspace);
for (var i = 0; i < classNames.length; i++) {
if (setClasses.indexOf(classNames[i]) == -1) {
setClasses.push(classNames[i]);
}
}
this.$el.className = setClasses.join(" ");
}
},
removeClass:function (value) {
if (this.$el.className.length === 0) {
return;
}
var removeClasses = value.split(rspace);
var classes = this.$el.className.split(rspace);
for (var i = 0; i < removeClasses.length; i++) {
var index = classes.indexOf(removeClasses[i]);
if (index != -1) {
classes.splice(index, 1);
}
}
if (classes.length === 0) {
this.$el.removeAttribute('class');
} else {
this.$el.className = classes.join(" ");
}
},
addEventListener:function (type, eventHandle) {
if (this.$el.addEventListener) {
this.$el.addEventListener(type, eventHandle, false);
} else if (this.$el.attachEvent) {
this.$el.attachEvent("on" + type, eventHandle);
}
},
removeEvent:document.removeEventListener ?
function (type, handle) {
if (this.$el.removeEventListener) {
this.$el.removeEventListener(type, handle, false);
}
} :
function (type, handle) {
if (this.$el.detachEvent) {
this.$el.detachEvent("on" + type, handle);
}
}
};
var DomManipulation = inherit.Base.inherit(rAppid._.extend({
ctor:function (elm) {
this.$el = elm;
}
}, DomManipulationFunctions));
var DomElement = Component.inherit(rAppid._.extend(DomElementFunctions, DomManipulationFunctions));
return DomElement;
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.html.Input",
["js.html.DomElement"], function (DomElement) {
return DomElement.inherit({
defaults: {
checked: false
},
_renderValue: function(value){
this.$el.value = value;
},
_renderChecked: function(checked){
this.$el.checked = checked;
},
_bindDomEvents: function(){
var self = this;
if (this.$el.type == "text" || this.$el.type == "password") {
this.addEventListener('change', function (e) {
self.set('value', self.$el.value);
});
} else if (this.$el.type == "checkbox" || this.$el.type == "radio") {
this.addEventListener('click', function (e) {
self.set('checked', self.$el.checked);
});
}
this.callBase();
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.html.Option",
["js.html.DomElement"], function (DomElement) {
return DomElement.inherit({
_renderSelected: function(selected){
this.$el.selected = selected;
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.html.Select",
["js.ui.SelectionView"], function (SelectionView) {
return SelectionView.inherit({
defaults:{
multiSelect:false,
forceSelectable:false,
tagName:'select'
},
_renderMultiSelect:function (multiSelect) {
this.$el.multiple = multiSelect;
},
_renderSelectedItems:function (items) {
var comp, ri;
// go through items, find option and set selected
for (var i = 0; i < this.$renderedItems.length; i++) {
ri = this.$renderedItems[i];
comp = ri.component;
comp.set({selected: rAppid._.contains(items, ri.item)});
}
},
_bindDomEvents:function () {
var self = this;
this.addEventListener('change', function (e) {
self._checkOptions();
});
},
_checkOptions:function () {
for (var i = 0; i < this.$childViews.length; i++) {
this.$childViews[i].set({selected:this.$childViews[i].$el.selected});
}
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.html.TextArea",
["js.html.DomElement", "js.core.TextElement"], function (DomElement, TextElement) {
return DomElement.inherit({
_renderChild: function(child){
if(child instanceof TextElement){
// contains two way binding ...
var text = this._getTextContentFromDescriptor(child.$descriptor);
/*
if(this._isBindingDefinition(text)){
this._initBinding(text,"value");
} */
}
},
_renderValue: function(value){
if(Element.textContent){
this.$el.textContent = value;
}else{
this.$el.innerText = value;
}
},
_bindDomEvents: function(){
var self = this;
this.addEventListener('change', function (e) {
self.set('value', e.target ? e.target.value : self.$el.innerText);
});
}
});
}
);
});
\ No newline at end of file
(function () {
var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
var importRegEx = /((?:xaml!)?[a-z]+(\.[a-z]+[a-z0-9]*)*)/mgi;
define(function () {
return {
version: '0.1.0',
createXhr: function () {
var xhr, i, progId;
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
} else {
for (i = 0; i < 3; i++) {
progId = progIds[i];
try {
xhr = new ActiveXObject(progId);
} catch (e) {
}
if (xhr) {
progIds = [progId]; // so faster next time
break;
}
}
}
if (!xhr) {
throw new Error("createXhr(): XMLHttpRequest not available");
}
return xhr;
},
get: function (url, callback) {
var xhr;
try {
xhr = this.createXhr();
xhr.open('GET', url, true);
xhr.onreadystatechange = function (evt) {
//Do not explicitly handle errors, those should be
//visible via console output in the browser.
if (xhr.readyState === 4) {
callback(null, xhr);
}
};
xhr.send(null);
} catch (e) {
callback(e);
}
},
load: function (name, req, onLoad, config) {
var jsonParse = (typeof JSON !== 'undefined' && typeof JSON.parse === 'function') ? JSON.parse : function (val) {
return eval('(' + val + ')');
};
this.get(name, function (err, xhr) {
if (!err) {
onLoad(jsonParse(xhr.responseText));
} else {
throw err;
}
});
}
};
});
}());
\ No newline at end of file
(function () {
var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
var importRegEx = /((?:xaml!)?[a-z]+(\.[a-z]+[a-z0-9]*)*)/mgi;
define(function () {
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (obj) {
for (var i = 0; i < this.length; i++) {
if (this[i] == obj) {
return i;
}
}
return -1;
}
}
/**
* IE8 FIXES
* @param domNode
*/
var localNameFromDomNode = function(domNode){
if(domNode.localName) return domNode.localName;
var st = domNode.tagName.split(":");
return st[st.length-1];
};
return {
version: '0.1.0',
createXhr: function () {
var xhr, i, progId;
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
} else {
for (i = 0; i < 3; i++) {
progId = progIds[i];
try {
xhr = new ActiveXObject(progId);
} catch (e) {
}
if (xhr) {
progIds = [progId]; // so faster next time
break;
}
}
}
if (!xhr) {
throw new Error("createXhr(): XMLHttpRequest not available");
}
return xhr;
},
get: function (url, callback) {
var xhr;
try {
xhr = this.createXhr();
xhr.open('GET', url, true);
xhr.onreadystatechange = function (evt) {
//Do not explicitly handle errors, those should be
//visible via console output in the browser.
if (xhr.readyState === 4) {
callback(null, xhr);
}
};
xhr.send(null);
} catch (e) {
callback(e);
}
},
getDependency: function(namespace, localName, namespaceMap, xamlClasses, rewriteMap) {
var fqClassName = [namespaceMap[namespace] || namespace, localName].join(".");
for (var i = 0; i < rewriteMap.length; i++) {
var entry = rewriteMap[i];
if (entry.$from && entry.$to) {
if (entry.$from.test(fqClassName)) {
fqClassName = fqClassName.replace(entry.$from, entry.$to);
break;
}
}
}
// TODO fix
if (xamlClasses.indexOf(fqClassName) != -1) {
fqClassName = "xaml!" + fqClassName;
}
return fqClassName.replace(/\./g, "/");
},
findDependencies: function (xaml, namespaceMap, xamlClasses, rewriteMap, imports) {
var self = this;
var ret = [];
function findDependencies(domNode) {
var localName = localNameFromDomNode(domNode);
var dep = self.getDependency(domNode.namespaceURI, localName, namespaceMap, xamlClasses, rewriteMap);
// console.log(dep);
if (dep == "js/core/Imports") {
for (var t = 0; t < domNode.childNodes.length; t++) {
var importNode = domNode.childNodes[t];
if (importNode.nodeType == 3) {
// text node
var m;
var textContent = importNode.textContent ? importNode.textContent : importNode.text;
while ((m = importRegEx.exec(textContent+" ")) != null) {
var importClass = m[0].replace(/\./g, "/");
if(importClass !== "undefined"){
if (ret.indexOf(importClass) == -1) {
ret.push(importClass);
}
if (imports) {
imports.push(importClass);
}
}
}
}
}
}
if (ret.indexOf(dep) == -1) {
ret.push(dep);
}
for (var i = 0; i < domNode.childNodes.length; i++) {
var childNode = domNode.childNodes[i];
// element
if (childNode.nodeType == 1) {
findDependencies(childNode);
}
}
}
if (xaml) {
findDependencies(xaml);
}
return ret;
},
findScripts: function(xaml, namespaceMap, xamlClasses, rewriteMap) {
var ret = [];
for (var i = 0; i < xaml.childNodes.length; i++) {
var node = xaml.childNodes[i];
if (node.nodeType == 1) {
if ("js/core/Script" == this.getDependency(node.namespaceURI, localNameFromDomNode(node), namespaceMap, xamlClasses, rewriteMap)) {
ret.push(node);
}
}
}
return ret;
},
getDeclarationFromScripts: function(scripts) {
var ret = {};
if (scripts) {
for (var s = 0; s < scripts.length; s++) {
var script = scripts[s];
for (var fn in script) {
if (script.hasOwnProperty(fn)) {
ret[fn] = script[fn];
}
}
}
}
return ret;
},
load: function (name, req, onLoad, config) {
// if (config.isBuild && !config.inlineText) {
// onLoad();
// return;
// }
var self = this;
var url = req.toUrl(name.replace(/\./g, "/") + ".xml");
this.get(url, function (err, xhr) {
if (!err) {
if (xhr.responseXML) {
// require all dependencies
var imports = [];
var dependencies = self.findDependencies(xhr.responseXML.documentElement,
config.namespaceMap, config.xamlClasses, config.rewriteMap, imports);
for (var i = 0; i < imports.length; i++) {
// console.log(imports[i]);
}
var scripts = self.findScripts(xhr.responseXML.documentElement,
config.namespaceMap, config.xamlClasses, config.rewriteMap);
if (scripts.length > 0) {
// at least one script
dependencies.splice(1, 0, "js/core/Script");
}
if(imports.length > 0){
dependencies = dependencies.concat(imports);
}
for(i = 0 ; i < dependencies.length; i++){
// console.log("AFTER: "+dependencies[i]);
}
// first item should be the dependency of the document element
req(dependencies, function() {
// dependencies are loaded
var baseClass = arguments[0],
Script = arguments[1];
var args = [];
for(var i = 1; i < arguments.length; i++){
args.push(arguments[i]);
}
var scriptObjects = [];
var importedClasses = args.slice(args.length - imports.length);
if (scripts.length > 0) {
for (var s = 0; s < scripts.length; s++) {
try {
var scriptInstance = new Script(null, scripts[s]);
scriptObjects.push(scriptInstance.evaluate(importedClasses));
} catch (e) {
throw "Script cannot be loaded";
}
}
}
var xamlFactory = baseClass.inherit(
self.getDeclarationFromScripts(scriptObjects)
);
xamlFactory.prototype._$descriptor = xhr.responseXML.documentElement;
if (config.applicationDomain) {
config.applicationDomain.defineXamlClass(name, dependencies, xamlFactory);
onLoad(xamlFactory);
}
});
} else {
throw name + " wasn't a valid xml document";
}
} else {
throw err;
}
});
}
};
});
})();
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.Button",
["xaml!js.ui.Link", "js.core.Content"], function (Link) {
return Link.inherit({
defaults: {
'componentClass': 'btn'
},
_renderType: function (type, oldType) {
if (oldType) {
this.removeClass("btn-" + oldType);
}
if (type) {
this.addClass("btn-" + type);
}
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.Button",
["xaml!js.ui.Link", "js.core.Content"], function (Link) {
return Link.inherit({
defaults: {
'tagName': 'label',
'componentClass': 'checkbox'
},
_renderLabel: function (label) {
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.ContentPlaceHolder", ["js.ui.View"], function (View) {
return View.inherit(({
_renderContent: function (content) {
if (content) {
this._renderChildren(content.$children);
} else {
var cv;
for(var i = 0 ; i < this.$childViews.length; i++){
cv = this.$childViews[i];
this.$el.removeChild(cv.$el);
}
}
}
}));
});
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.ItemsView",
["js.ui.View", "js.core.Template", "js.core.List"], function (View, Template, List) {
return View.inherit({
defaults: {
tagName: "div",
items: []
},
hasItems: function(){
return this.$.items.length > 0;
}.on('items'),
addItem: function (item) {
this.$.items.push(item);
if (this.isRendered()) {
this._renderItem(item);
}
},
render: function(){
this.$renderedItems = [];
return this.callBase();
},
removeItem: function(item){
var index = this.$.items.indexOf(item);
if(index > -1){
this.$.items.slice(index,1);
if (this.isRendered()) {
this._removeRenderedItem(item);
}
}
},
clear: function(){
},
_renderList: function(list, oldList){
if(oldList){
// TODO: unbind!
}
if(list instanceof List){
list.bind('sort', this._onSort, this);
list.bind('reset', this._onReset, this);
list.bind('add', this._onItemAdd,this);
list.bind('remove', this._onItemRemove,this);
this.set({items: list.$items});
}
},
_onSort: function(e){
if(this.isRendered()){
var item, c;
for (var i = 0; i < e.$.items.length; i++) {
item = e.$.items[i];
c = this.getComponentForItem(item);
this.$el.removeChild(c.$el);
this.$el.appendChild(c.$el);
}
}
},
_onReset: function(e){
this.set('items',e.$.items);
},
_onItemAdd: function(e){
this._renderItem(e.$.item,e.$.index);
},
_onItemRemove: function(e){
this._removeRenderedItem(e.$.item);
},
_renderItems: function (items) {
if (this.$renderedItems) {
var c;
for (var j = this.$renderedItems.length - 1; j >= 0; j--) {
c = this.$renderedItems[j];
this.$el.removeChild(c.component.$el);
}
}
this.$renderedItems = [];
for (var i = 0; i < items.length; i++) {
this._renderItem(items[i],i);
}
},
_renderItem: function (item,i) {
var comp = this.$templates['item'].createComponents({$item: item, $index: i})[0];
// add to rendered item map
this.$renderedItems.push({
item: item,
component: comp
});
this.addChild(comp);
},
_removeRenderedItem: function(item){
var ri;
for (var i = 0; i < this.$renderedItems.length; i++) {
ri = this.$renderedItems[i];
if (ri.item === item) {
this.$el.removeChild(ri.component.$el);
this.$renderedItems.slice(i,1);
return;
}
}
},
getComponentForItem: function (item) {
var ri;
for (var i = 0; i < this.$renderedItems.length; i++) {
ri = this.$renderedItems[i];
if (ri.item === item) {
return ri.component;
}
}
return null;
}
});
}
);
});
\ No newline at end of file
<?xml version="1.0"?>
<ui:View xmlns="http://www.w3.org/1999/xhtml" xmlns:js="js.core" xmlns:ui="js.ui">
<js:Script>
(function () {
return {
defaults:{
tagName:'a',
href:null,
label:' '
},
_renderIconClass:function (iconClass, oldIconClass) {
if (iconClass) {
this._renderTemplateToPlaceHolder('iconTemplate', 'icon', {$iconClass:iconClass});
} else {
this.getPlaceHolder("icon").clear();
}
},
_renderHref:function (href) {
if (this.$tagName == "a") {
this.$el.setAttribute("href", href || "#");
if (!href) {
this.$el.setAttribute('onclick', "return false;");
}
}
}
}
})
</js:Script>
<js:Template name="layout">
<ui:PlaceHolder name="icon"/>{label}
</js:Template>
<js:Template name="iconTemplate">
<i class="{$iconClass}"/>
</js:Template>
</ui:View>
\ No newline at end of file
<?xml version="1.0"?>
<ui:View xmlns="http://www.w3.org/1999/xhtml" xmlns:js="js.core" xmlns:ui="js.ui">
<js:Imports>
js.core.Content;
js.ui.Button;
</js:Imports>
<js:Script type="text/javascript">
<![CDATA[
(function (Content, Button) {
return {
defaults:{
tagName:'div',
'class':'btn-group',
'menuClassName':"dropdown-menu",
menuVisible:false
},
$instances:[],
addChild:function (child) {
if (child instanceof Button) {
this._collectButton(child);
}
this.callBase();
},
_collectButton:function (child) {
this.$button = child;
this.$toggleButton = child;
},
_renderType:function (type) {
this.$button.set({type:type});
},
_renderIconClass:function (iconClass) {
this.$button.set({iconClass:iconClass});
},
_renderLabel:function (label) {
this.$button.set({label:label});
},
_renderMenuVisible:function (visible) {
if (visible === true) {
for (var i = 0; i < this.$instances.length; i++) {
if (this.$instances[i] != this) {
this.$instances[i].set({menuVisible:false});
}
}
this.addClass('open');
} else {
this.removeClass('open');
}
},
_bindDomEvents:function (el) {
if (!rAppid._.contains(this.$instances, this)) {
this.$instances.push(this);
}
var self = this;
document.addEventListener('click', function (e) {
self.set({menuVisible:false});
});
this.$toggleButton.$el.addEventListener('click', function (e) {
e.stopPropagation();
e.preventDefault();
self.set({menuVisible:!self.$.menuVisible});
});
this.$button.addEventListener('click', function (e) {
self.trigger('onclick', e, self);
});
}
}
})
]]>
</js:Script>
<js:Template name="layout">
<ui:Button class="dropdown-toggle">
<js:Template name="layout">
<ui:PlaceHolder name="icon"/>{label}<span class="caret"/>
</js:Template>
</ui:Button>
<ui:ContentPlaceHolder tagName="div" name="menu" class="{menuClassName}"/>
</js:Template>
</ui:View>
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.PlaceHolder",
["js.core.UIComponent", "js.core.Content"], function (UIComponent, Content) {
return UIComponent.inherit({
render: function () {
if (this.isRendered()) {
return this.$el;
}
this.$textNode = document.createTextNode("");
this.$el = this.$textNode;
return this.$el;
},
clear: function () {
this.set({content: this.$textNode});
},
_renderContent: function (content) {
var children;
if (content instanceof Content) {
children = content.$children;
} else if (rAppid._.isArray(content)) {
children = content;
} else {
children = [content];
}
var child, el;
for (var i = 0; i < children.length; i++) {
child = children[i];
if (child.render) {
el = child.render();
var parentNode = this.$el.parentNode;
parentNode.insertBefore(el, this.$el);
}
}
}
});
}
);
});
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.ScrollableView",
["js.ui.View", "js.ui.ItemsView", "js.html.DomElement", "jQuery"], function (View, ItemsView, DomElement, $) {
var VERTICAL = "vertical";
var HORIZONTAL = "horizontal";
return View.inherit({
defaults:{
tagName:"div",
direction:HORIZONTAL,
selectedPage:0,
componentClass:'scrollable'
},
ctor:function () {
this.callBase();
this.$childViews = [];
},
addChild:function (child) {
this.callBase();
if (!this.$scrollView && child instanceof DomElement) {
this.$scrollView = child;
}
},
_renderDirection: function(direction,oldDirection){
if(oldDirection){
this.removeClass(oldDirection);
}
if(direction){
this.addClass(direction);
}
},
_renderSelectedPage:function (page, oldPage) {
if (this.$scrollView && this.$scrollView.isRendered()) {
this.$scrollView.addClass('scroller');
if(this.$.direction === HORIZONTAL){
$(this.$scrollView.$el).animate({
left:-parseInt(this.$el.style.width) * page,
specialEasing:{
width:'linear',
height:'easeInOutQuad'
}
}, 'slow');
}else if(this.$.direction === VERTICAL){
$(this.$scrollView.$el).animate({
top:-parseInt(this.$el.style.height) * page,
specialEasing:{
width:'linear',
height:'easeInOutQuad'
}
}, 'slow');
}
}
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.SegmentedView",
["js.ui.ItemsView", "js.html.DomElement"], function (ItemsView, DomElement) {
return ItemsView.inherit({
defaults: {
tagName: "div",
visibleIndex: 0,
visibleView: null
},
ctor: function(){
this.$childViews = [];
this.callBase();
},
addChild: function (child) {
this.callBase();
if (child instanceof DomElement) {
this.$childViews.push(child);
}
},
_renderChild: function (child) {
if (this.$.visibleView == child) {
child.set({visible: true});
this.callBase();
}
},
_renderVisibleView: function (child, oldView) {
if (oldView) {
oldView.set({visible: false});
}
if (child) {
if (!child.isRendered()) {
child.set({visible: false});
this._renderChild(child);
}
child.set({visible: true});
}
},
_renderVisibleIndex: function (index) {
if (index > -1 && index < this.$childViews.length) {
this.set({visibleView: this.$childViews[index]});
} else if (this.$.visibleView) {
this.$.visibleView.set({visible: false});
}
}
});
}
);
});
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.SelectionView",
["js.ui.ItemsView", "js.html.DomElement"], function (ItemsView, DomElement) {
return ItemsView.inherit({
defaults: {
tagName: "div",
needsSelection: false,
multiSelect: false,
selectedViews: [],
selectedItems: [],
selectedItem: null,
items: [],
forceSelectable: true
},
hasSelectedItems: function(){
return this.$.selectedItems.length > 0;
},
hasSelection: function () {
return this.$.selectedViews.length > 0;
}.onChange('selectedViews'),
_renderChild: function (child) {
if (child instanceof DomElement) {
var self = this;
if(this.$.forceSelectable === true){
child.set({selectable:true});
}
child.bind('change:selected', function (e, c) {
self._onChildSelected(c);
}, child);
}
this.callBase();
if (this.$.needsSelection === true && this.$.selectedItem === null && this.hasSelection() === false ) {
child.set({selected: true});
} else {
// get item for child, if item is in selectedItems, select child!
if (child.has("$item")) {
for (var i = 0; i < this.$.selectedItems.length; i++) {
if (child.$.$item === this.$.selectedItems[i] || child.$.$item === this.$.selectedItem) {
child.set({selected:true});
break;
}
}
}
}
},
_renderSelectedItem: function(item){
var comp = this.getComponentForItem(item);
if(comp){
comp.set({selected: true});
}
},
_renderSelectedItems: function (items) {
var item;
for (var i = 0; i < this.$renderedItems.length; i++) {
item = this.$renderedItems[i].item;
this.$renderedItems[i].component.set({selected:rAppid._.contains(items, item)});
}
},
_renderSelectedIndex: function (i) {
if (i != null && i > -1 && i < this.$renderedChildren.length) {
this.$renderedChildren[i].set({selected: true});
}
},
_onChildSelected: function (child) {
var c, i;
var checkMultiSelect = (child.$.selected === true && this.$.multiSelect === false);
var checkMinSelect = !checkMultiSelect && (child.$.selected === false && this.$.needsSelection === true);
var correctSelection = false;
var somethingSelected = false;
var selectedChildren = [];
var selectedItems = [];
var selectedIndex, selectedItem = null;
for (i = 0; i < this.$renderedChildren.length; i++) {
c = this.$children[i];
if (checkMultiSelect) {
if (c != child && c.$.selected === true) {
correctSelection = true;
c.set({selected: false});
}
} else if (checkMinSelect) {
if (c.$.selected === true) {
somethingSelected = true;
}
}
if (c.$.selected === true) {
selectedIndex = i;
selectedChildren.push(c);
if (c.has("$item")) {
selectedItems.push(c.$.$item);
selectedItem = c.$.$item;
}
}
}
if (this.$.needsSelection === true && somethingSelected === false && child.$.selected === false) {
child.set({selected: true});
correctSelection = true;
}
if (!correctSelection) {
this.set({selectedViews: selectedChildren, selectedItems: selectedItems, selectedIndex: selectedIndex, selectedItem: selectedItem});
}
}
});
}
);
});
\ No newline at end of file
<?xml version="1.0"?>
<ui:MenuButton xmlns="http://www.w3.org/1999/xhtml" xmlns:js="js.core" xmlns:ui="js.ui">
<js:Imports>
js.ui.Button
</js:Imports>
<js:Script type="text/javascript">
<![CDATA[
(function (Button) {
return {
defaults:{
'menuClassName':"dropdown-menu right"
},
_renderType:function (type) {
this.$toggleButton.set({type:type});
this.$button.set({type:type});
},
_collectButton:function (child) {
if (child.$['class'].indexOf("dropdown-toggle") > -1) {
this.$toggleButton = child;
} else {
this.$button = child;
}
}
}
})
]]>
</js:Script>
<js:Template name="layout">
<ui:Button class="btn"/>
<ui:Button class="btn dropdown-toggle">
<js:Template name="layout">
<span class="caret"/>
</js:Template>
</ui:Button>
<ui:ContentPlaceHolder tagName="div" name="menu" class="{menuClassName}"/>
</js:Template>
</ui:MenuButton>
\ No newline at end of file
<?xml version="1.0"?>
<ui:View xmlns="http://www.w3.org/1999/xhtml" xmlns:js="js.core" xmlns:ui="js.ui">
<js:Script>
(function () {
return {
defaults:{
tagName:'button',
'class':'btn'
},
_renderIconClass:function (iconClass) {
if (iconClass) {
if (!this.$iconComponent) {
// get Icon Template
var tpl = this.getTemplate('icon');
// TODO: remove this shop!
tpl._initialize();
// render icon template
this.$iconComponent = tpl.createComponent({$iconClass:iconClass});
this.$iconComponent.initialize();
this.getPlaceholderByCid('icon').set({content:this.$iconComponent});
} else {
this.$iconComponent.set({$iconClass:iconClass});
}
// append as child first child
} else {
this.$iconComponent.$el.remove();
delete this.$iconComponent;
}
},
_renderLabel:function (label) {
if (label) {
if (!this.$labelComponent) {
var tpl = this.getTemplate('label');
if (tpl) {
tpl._initialize();
this.$labelComponent = tpl.createComponent({$label:label});
this.$labelComponent.initialize();
this.getPlaceholderByCid('label').set({content:this.$labelComponent});
}
}
}
}
}
})();
</js:Script>
<js:Template name="layout">
<asdsad>
<js:Template ref="left"/>
</asdsad>
<js:Template ref="right"/>
</js:Template>
<js:Template name="layout">
<js:Template ref="left" />
<js:Template ref="right"/>
</js:Template>
<!-- DEFAULT ICON CLASS TEMPLATE-->
<js:Template name="left">
<div>
<js:PlaceHolder cid="innerleft"/>
</div>
</js:Template>
<js:Template name="left">
<div>
<span>splitterbar</span>
<js:PlaceHolder cid="innerright"/>
</div>
</js:Template>
</ui:View>
\ No newline at end of file
<?xml version="1.0"?>
<ui:ItemsView xmlns="http://www.w3.org/1999/xhtml" xmlns:js="js.core" xmlns:ui="js.ui">
<js:Imports>
js.ui.View;
js.ui.SelectionView;
js.ui.SegmentedView;
</js:Imports>
<js:Script>
<![CDATA[
(function (View, SelectionView, SegmentedView) {
return {
defaults:{
selectedIndex:0,
selectedView:null,
tabClassName: 'nav nav-tabs'
},
_initializeLayoutChildren:function (children) {
var child;
var self = this;
for (var i = 0; i < children.length; i++) {
child = children[i];
if (!this.$selectionView && child instanceof SelectionView) {
this.$selectionView = child;
this.$selectionView.set({items: []});
this.$selectionView.bind('change:selectedViews', this._onTabChange, this);
} else if (!this.$segmentedView && child instanceof SegmentedView) {
this.$segmentedView = child;
}
}
this.callBase();
},
_renderChild:function (child) {
if (child instanceof View && child != this.$selectionView && child != this.$segmentedView) {
this.$selectionView.addItem(child);
this.$segmentedView.addChild(child);
} else {
this.callBase();
}
},
_onTabChange:function (e) {
if (e.$.length > 0) {
this.$segmentedView.set({visibleView:e.$[0].$.$item});
}
},
_renderSelectedIndex:function (index) {
this.$selectionView.set({selectedIndex:index});
},
_renderSelectedView:function (view) {
this.$selectionView.set({selectedView:view});
}
}
})
]]>
</js:Script>
<js:Template name="layout">
<ui:SelectionView tagName="ul" class="{tabClassName}" needsSelection="true" forceSelectable="true">
<js:Template name="item">
<ui:View tagName="li"><ui:Link label="{$item.title}"/></ui:View>
</js:Template>
</ui:SelectionView>
<ui:SegmentedView/>
</js:Template>
</ui:ItemsView>
\ No newline at end of file
var requirejs = (typeof requirejs === "undefined" ? require("requirejs") : requirejs);
requirejs(["rAppid"], function (rAppid) {
rAppid.defineClass("js.ui.View",
["js.html.DomElement", "js.core.Template", "js.core.Content"], function (DomElement, Template, Content) {
return DomElement.inherit({
defaults: {
tagName: "div"
},
$behavesAsDomElement: false,
render: function () {
// look if the component has a layout defined
var layout = this.$templates['layout'];
// if layout template available...
if (layout) {
var children = layout.createComponents({},this,this);
this._initializeLayoutChildren(children);
}
return this.callBase();
},
_initializeLayoutChildren: function (children) {
for (var i = 0; i < children.length; i++) {
children[i].$rootScope = this;
this.addChild(children[i]);
}
},
_renderChild: function (child) {
this.callBase();
if (child instanceof Content) {
var ref = child.get('ref');
if (ref) {
var placeHolder = this.getPlaceHolder(ref);
if (placeHolder) {
placeHolder.set({content: child});
}
}
}
},
_renderLayoutClass: function(layoutClass, oldLayoutClass){
rAppid._.each(this.$renderedChildren,function(child){
if(oldLayoutClass){
child.removeClass(oldLayoutClass);
}
if(layoutClass){
child.addClass(layoutClass)
}
});
},
_renderComponentClass: function (cls, oldCls) {
if (oldCls) {
this.removeClass(oldCls);
}
if (cls) {
this.addClass(cls);
}
},
_renderClass: function (className) {
if (className) {
this.addClass(className);
}
},
_renderTemplateToPlaceHolder: function (templateName, placeholderName, attributes) {
this.$renderedPlaceholders = this.$renderedPlaceholders || {};
var renderedComponent = this.$renderedPlaceholders[placeholderName];
if (!renderedComponent) {
var template = this.getTemplate(templateName);
if (template) {
// TODO: maybe render all components returned
// or create special method createComponent
renderedComponent = template.createComponents(attributes)[0];
// renderedComponent._initialize();
var placeholder = this.getPlaceHolder(placeholderName);
if (placeholder) {
placeholder.set({content: renderedComponent});
this.$renderedPlaceholders[placeholderName] = renderedComponent;
} else {
// throw "No placeholder '"+placeholderName+"' found";
}
}
} else {
renderedComponent.set(attributes);
}
},
_renderId: function(id){
if(id){
this.$el.setAttribute("id",id);
}
}
});
}
);
});
\ No newline at end of file
/*!
* flow.js JavaScript Library v0.1.0
* https://github.com/it-ony/flow.js
*
* Copyright 2012, Tony Findeisen
* Licensed under the MIT license.
* https://raw.github.com/it-ony/flow.js/master/LICENSE
*
* Date: Mon Mar 12 2012 12:36:34 GMT+0100 (CET)
*/
(function (exports) {
"use strict";
var Flow = function(context) {
this.$context = context || {
error: null,
actions: [],
vars: {}
};
};
var flow = function () {
return new Flow();
};
/**
*
* @param {String} [name] variable name
* @param {Function} fn function to execute
* fn - function() {} // syncron
* fn - function(cb) {} // asyncron
*/
Flow.prototype.seq = function (name, fn) {
if (name instanceof Function) {
fn = name;
name = null;
}
if (!fn) {
throw "Sequence action not defined";
}
var self = this;
this.$context.actions.push(function (cb) {
var sync_end = false;
/**
* @param err
* @param data
* @param end
*/
var thisArg = function (err, data, end) {
if (!err && name) {
// save result to var
self.$context.vars[name] = data;
}
cb(err, end);
};
thisArg.vars = self.$context.vars;
if (fn.length) {
// end for async case
thisArg.end = function (err, data) {
// end
thisArg(err, data, true);
};
fn.call(thisArg, thisArg);
} else {
// sync
thisArg.end = function() {
sync_end = true;
};
try {
thisArg(null, fn.call(thisArg), sync_end);
} catch (e) {
thisArg(e, null, sync_end);
}
}
}
);
return this;
};
var ParallelAction = function (name, fn) {
if (!fn) {
throw "Parallel action not defined";
}
return function (parallelInstance, context, results, parallelFinishedCallback) {
var sync_end = false;
var thisArg = function (err, data, end) {
if (!err && name) {
// save result to tmp. var
results[name] = data;
}
parallelFinishedCallback(parallelInstance, err, end);
};
thisArg.vars = context.vars;
if (fn.length) {
// async
thisArg.end = function (err, data) {
// end
thisArg(err, data, true);
};
fn.call(thisArg, thisArg);
} else {
// sync
thisArg.end = function () {
sync_end = true;
};
try {
thisArg(null, fn.call(thisArg), sync_end);
} catch (e) {
thisArg(e, null, sync_end);
}
}
};
};
/**
* Executes the given functions parallel
*
* @param {Object, Array} fns
* {Object} fns - keys will be variable name for returned value
*/
Flow.prototype.par = function (fns) {
var self = this, i, key;
if (fns) {
var parallelActions = [];
if (fns instanceof Array) {
for (i = 0; i < fns.length; i++) {
var fn = fns[i];
parallelActions.push(new ParallelAction(null, fn));
}
} else {
for (key in fns) {
if (fns.hasOwnProperty(key)) {
parallelActions.push(new ParallelAction(key, fns[key]));
}
}
}
if (parallelActions.length > 0) {
// we got at least one function executing in parallel
// push new action
this.$context.actions.push(function (cb) {
(function (parallelActions, cb) {
var results = {}, p;
var parallelFinished = function (fn, err, end) {
var key;
if (!cb) {
// callback, already called, because end called multiple times
return;
}
if (err || end) {
// some error occurred
cb(err, end);
cb = null;
} else {
var index = parallelActions.indexOf(fn);
if (index >= 0 && index < parallelActions.length) {
// remove parallel executed function from actions
parallelActions.splice(index, 1);
} else {
cb("Parallel function returned which wasn't part of this parallel actions");
cb = null;
return;
}
if (parallelActions.length === 0) {
// copy results to var
for (key in results) {
if (results.hasOwnProperty(key)) {
self.$context.vars[key] = results[key];
}
}
cb(null, false);
cb = null;
}
}
};
// copy array of parallel actions, to avoid array is modified by returning of function
// before all functions are started
var copyParallelActions = parallelActions.slice();
// start all functions
for (p = 0; p < copyParallelActions.length; p++) {
// start parallel action
var parallelInstance = copyParallelActions[p];
parallelInstance(parallelInstance, self.$context, results, parallelFinished);
}
}(parallelActions, cb));
});
}
}
return this;
};
Flow.prototype.exec = function (cb) {
var self = this;
var callback = function(err, data) {
if (cb) {
cb(err, data);
}
};
function execNext(index) {
if (index < self.$context.actions.length) {
// execute action
self.$context.actions[index](function(err, end) {
if (err || end) {
callback(err, self.$context.vars);
} else {
execNext(index+1);
}
});
} else {
// finished
callback(null, self.$context.vars);
}
}
execNext(0);
};
// global on the server, window in the browser
var previous_flow = exports.flow;
flow.noConflict = function () {
exports.flow = previous_flow;
return flow;
};
exports.flow = flow;
}(typeof(exports) === "undefined" ? this : exports));
\ No newline at end of file
var inherit;
(function (global, exports) {
/**
*
* @param {Object} classDefinition The definition for the prototype methods
* @param {Function} [baseClass] The prototype to inherit from
*
* @return {Function} returns a constructor function describing the class
*/
inherit = function (classDefinition, baseClass) {
baseClass = baseClass || Object;
var newClass = function () {
if (this.ctor) {
return this.ctor.apply(this, arguments);
}
};
if (baseClass.constructor == Function) {
function Inheritance() {
}
Inheritance.prototype = baseClass.prototype;
newClass.prototype = new Inheritance();
newClass.prototype.constructor = classDefinition;
newClass.prototype.base = baseClass.prototype;
} else {
newClass.prototype = baseClass;
newClass.prototype.constructor = classDefinition;
newClass.prototype.base = baseClass;
}
for (var publicMethod in classDefinition) {
if (classDefinition.hasOwnProperty(publicMethod)) {
var baseFunction = newClass.prototype[publicMethod];
newClass.prototype[publicMethod] = classDefinition[publicMethod];
if (baseFunction instanceof Function) {
newClass.prototype[publicMethod].baseImplementation = baseFunction;
}
}
}
newClass.prototype.callBase = inherit.callBase;
return newClass;
};
inherit.callBase = function () {
// get arguments
var args = Array.prototype.slice.call(arguments);
if (args.length == 0) {
// use arguments from call
args = Array.prototype.slice.call(arguments.callee.caller.arguments);
}
return arguments.callee.caller.baseImplementation.apply(this, args);
};
/**
*
* @param classDefinition The definition for the prototype methods
*
* @return {Function} returns a constructor function describing the class
*/
Function.prototype.inherit = function (classDefinition) {
return inherit(classDefinition, this);
};
Function.prototype.callBase = function () {
var args = Array.prototype.slice.call(arguments);
var that = args.shift();
if (that && that.base) {
var caller = arguments.callee.caller;
if (this == caller) {
return this.baseImplementation.apply(that, args);
} else {
return this.apply(that, args);
}
} else {
throw "base not definied";
}
};
/**
* @property {Function} base class
*/
inherit.Base = inherit({
ctor: function () {
}
});
exports.inherit = inherit;
})(this, typeof exports === "undefined" ? this : exports);
var rAppid;
/** ECMA SCRIPT COMPLIANT**/
if(!String.prototype.trim){
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g, '');
};
}
(function (exports, inherit, require, define, underscore, XMLHttpRequest, flow) {
if (!require) {
throw "require.js is needed";
}
if (!define) {
throw "define is needed";
}
if (!underscore) {
// TODO include own implementation
throw "underscore is needed"
}
if (!flow) {
throw "flow.js is needed";
}
define("flowjs", function() {
return flow;
});
require.config({
paths: {
"xaml": "js/plugins/xaml",
"json": "js/plugins/json"
}
});
var Base = inherit.Base.inherit({
ctor: function () {
if (!this.className) {
this.className = this.constructor.name;
}
}
});
// define js.core.Base
define("js/core/Base", [], function() {
return Base;
});
define("rAppid", function() {
return _rAppid;
});
function SystemManager(applicationDomain, application) {
this.applicationDomain = applicationDomain;
this.application = application;
}
var xamlApplication = /^(xaml!)?(.+?)(\.xml)?$/;
var defaultNamespaceMap = {
"http://www.w3.org/1999/xhtml": "js.html"
};
var currentApplicationDomain = null;
var _rAppid = {
defineClass: function(fqName, dependencies, generateFactory){
if (currentApplicationDomain) {
currentApplicationDomain.defineClass(fqName, dependencies, generateFactory);
} else {
throw "CurrentApplicationDomain not available! Application not bootstrapped?";
}
},
defineXamlClass: function(fqClassName, dependencies, factory) {
if (currentApplicationDomain) {
currentApplicationDomain.defineXamlClass(fqClassName, dependencies, factory);
} else {
throw "CurrentApplicationDomain not available! Application not bootstrapped?";
}
},
getDefinition: function(fqClassName) {
if (currentApplicationDomain) {
currentApplicationDomain.getDefinition(fqClassName);
} else {
throw "CurrentApplicationDomain not available! Application not bootstrapped?";
}
},
bootStrap: function (mainClass, config, callback) {
config = config || {};
var internalBootstrap = function(config) {
var xamlClasses = config.xamlClasses || [];
var namespaceMap = config.namespaceMap || defaultNamespaceMap;
var rewriteMap = config.rewriteMap;
var applicationDomain = currentApplicationDomain = new ApplicationDomain(namespaceMap, rewriteMap);
require.config({
xamlClasses: xamlClasses,
namespaceMap: namespaceMap,
rewriteMap: applicationDomain.$rewriteMap,
applicationDomain: applicationDomain
});
if (mainClass) {
var parts = xamlApplication.exec(mainClass);
if (parts) {
// mainClass is xaml
mainClass = "xaml!" + parts[2];
} else {
// mainClass is javascript factory
mainClass = mainClass.replace(/\./g, "/");
}
require(["./js/core/Imports"], function () {
require(["./js/core/Application", mainClass], function (Application, mainClassFactory) {
// create instance
var application = new mainClassFactory(null, false, applicationDomain, null, null);
if (application instanceof Application) {
var systemManager = new SystemManager(applicationDomain, application);
rAppid.systemManager = systemManager;
application.$config = config;
application._initialize("auto");
// return system manager
if (callback) {
callback(null, systemManager, application);
}
} else {
var errMessage = "mainClass isn't an instance of js.core.Application";
if (callback) {
callback(errMessage);
} else {
throw(errMessage);
}
}
});
});
}
};
if (Object.prototype.toString.call(config) == '[object String]') {
require(["json!" + config], function(config) {
internalBootstrap(config);
});
} else {
internalBootstrap(config);
}
},
createQueryString: function(parameter) {
var ret = [];
for (var key in parameter) {
if (parameter.hasOwnProperty(key)) {
ret.push(encodeURIComponent(key) + "=" + encodeURIComponent(parameter[key]));
}
}
return ret.join("&");
},
ajax: function(url, options, callback) {
var s = {
url: url
};
rAppid._.extend(s, options, _rAppid.ajaxSettings);
if (s.data && !rAppid._.isString(s.data)) {
throw "data must be a string";
}
s.hasContent = !/^(?:GET|HEAD)$/.test(s.type);
if (s.queryParameter) {
// append query parameter to url
s.url += /\?/.test(s.url) ? "&" : "?" + this.createQueryString(s.queryParameter);
}
if (s.data && s.hasContent && s.contentType !== false) {
xhr.setRequestHeader("Content-Type", s.contentType);
}
// create new xhr
var xhr = s.xhr();
xhr.open(s.type, s.url, s.async);
try {
for (var header in s.headers) {
xhr.setRequestHeader(header, s.headers[header]);
}
} catch (e) {} // FF3
xhr.send();
var xhrCallback = function(_, isAbort) {
var wrappedXhr;
if (xhrCallback && (isAbort || xhr.readyState === 4)) {
xhrCallback = undefined;
if (isAbort) {
// Abort it manually if needed
if (xhr.readyState !== 4) {
xhr.abort();
}
} else {
wrappedXhr = new rAppidXhr(xhr);
}
if (callback) {
callback(isAbort, wrappedXhr)
}
}
};
if (!s.async || xhr.readyState === 4) {
xhrCallback();
} else {
xhr.onreadystatechange = xhrCallback
}
return xhr;
},
// export underscore
_: underscore,
// export inherit
inherit: inherit,
require: require
};
var rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg; // IE leaves an \r character at EOL
var rAppidXhr = Base.inherit({
ctor: function(xhr) {
this.xhr = xhr;
this.status = xhr.status;
this.$nativeResponseHeaders = xhr.getAllResponseHeaders();
this.responses = {};
var xml = xhr.responseXML;
// Construct response list
if (xml && xml.documentElement) {
this.responses.xml = xml;
}
this.responses.text = xhr.responseText;
try {
this.statusText = xhr.statusText;
} catch (e) {
this.statusText = "";
}
},
getResponseHeader: function(key) {
var match;
if (!this.$responseHeaders) {
this.$responseHeaders = {};
while (( match = rheaders.exec(this.$nativeResponseHeaders) )) {
this.$responseHeaders[match[1].toLowerCase()] = match[2];
}
}
return this.$responseHeaders[key.toLowerCase()];
}
});
_rAppid.ajaxSettings = {
type: "GET",
contentType: "application/x-www-form-urlencoded",
async: true,
// TODO: add ie7 support for local file requests via ActiveX
xhr: function() {
return new XMLHttpRequest();
},
headers: {
}
};
var Rewrite = _rAppid.rewriteMapEntry = function (from, to) {
this.$from = from;
this.$to = to;
};
_rAppid.defaultRewriteMap = [
new Rewrite(/^js.html.(input)$/, "js.html.Input"),
new Rewrite(/^js.html.(select)$/, "js.html.Select"),
new Rewrite(/^js.html.(textarea)$/, "js.html.TextArea"),
new Rewrite(/^js.html.(option)$/, "js.html.Option"),
new Rewrite(/^js.html.(.+)$/, "js.html.DomElement"),
new Rewrite(/^js.conf.(.+)$/, "js.core.Component")
];
var ApplicationDomain = inherit.Base.inherit({
ctor: function(namespaceMap, rewriteMap) {
this.$namespaceMap = namespaceMap || {};
this.$rewriteMap = rewriteMap || rAppid.defaultRewriteMap;
this.$ns = {};
},
/**
*
* loads all dependencies and defines a class under the given fqClassname
*
* @param fqClassName full qualified classname (e.g. js.ui.myComponent)
* @param dependencies as hash or array
* @param generateFactor a function that return the factory function invoked after all dependencies are loaded
*/
defineClass: function (fqClassName, dependencies, generateFactor) {
// create the namespace and install the class
if (!fqClassName || fqClassName == "") {
throw "Full qualified class name '" + fqClassName + "' in wrong format. Use dot notation.";
}
var self = this;
var realDependencies = [];
if (dependencies) {
for (var i = 0; i < dependencies.length; i++) {
realDependencies.push(dependencies[i].replace(/\./g, "/"));
}
}
define(fqClassName.replace(/\./g, "/"), realDependencies, function () {
var factory = generateFactor.apply(this, arguments);
factory.prototype.constructor.name = fqClassName;
if (!self.installClass(self.$ns, fqClassName.split("."), factory)) {
throw "Class '" + fqClassName + "' could not be installed";
}
return factory;
});
},
/**
* registers an XAML component
*
* differs from normal class registration because, dependencies are loaded
* and class has to be installed immedently
*
* @param fqClassName
* @param dependencies
* @param factory
*/
defineXamlClass: function (fqClassName, dependencies, factory) {
// create the namespace and install the class
if (!fqClassName || fqClassName == "") {
throw "Full qualified class name '" + fqClassName + "' in wrong format. Use dot notation.";
}
var normalizeRegex = /\//g;
fqClassName = fqClassName.replace(normalizeRegex, ".");
factory.prototype.constructor.name = fqClassName;
if (!this.installClass(this.$ns, fqClassName.split("."), factory)) {
throw "Class '" + fqClassName + "' could not be installed";
}
define(fqClassName.replace(/\./g, "/"), dependencies, function () {
return factory;
});
},
getDefinition: function (fqClassName) {
function getDefinition (currentNamespace, classPath) {
if (classPath.length > 0) {
var part = classPath.shift();
if (currentNamespace.hasOwnProperty(part)) {
var value = currentNamespace[part];
if (value instanceof Function) {
if (classPath.length == 0) {
return value;
} else {
throw "unterminated classpath";
}
} else {
return getDefinition.call(this, currentNamespace[part], classPath);
}
}
}
return null;
}
return getDefinition.call(this, this.$ns, fqClassName.split("."));
},
hasDefinition: function (fqClassName) {
return this.getDefinition(fqClassName) ? true : false;
},
createInstance: function (fqClassName, args, className) {
className = className || fqClassName;
args = args || [];
var classDefinition = this.getDefinition(fqClassName);
function construct(constructor, args) {
function F() {
return constructor.apply(this, args);
}
F.prototype = constructor.prototype;
return new F();
}
var ret = construct(classDefinition, args);
ret.className = className;
return ret;
},
getFqClassName: function (namespace, className, useRewriteMap) {
if (useRewriteMap == undefined || useRewriteMap == null) {
useRewriteMap = true;
}
var fqClassName = [this.$namespaceMap[namespace] || namespace, className].join(".");
if (useRewriteMap) {
for (var i = 0; i < this.$rewriteMap.length; i++) {
var entry = this.$rewriteMap[i];
if (entry instanceof rAppid.rewriteMapEntry) {
if (entry.$from.test(fqClassName)) {
return fqClassName.replace(entry.$from, entry.$to);
}
}
}
}
return fqClassName;
},
installClass: function (currentNamespace, path, value) {
if (path.length == 0) {
return false;
}
var part = path.shift();
if (!currentNamespace.hasOwnProperty(part)) {
if (path.length == 0) {
// create class
currentNamespace[part] = value;
return true;
} else {
// create namespace
currentNamespace[part] = {};
}
}
// step into namespace
return this.installClass(currentNamespace[part], path, value);
}
});
rAppid = exports.rAppid = _rAppid;
})(typeof exports === "undefined" ? this : exports,
typeof inherit === "undefined" ? global.inherit : inherit,
requirejs,
requirejs.define ? requirejs.define : define,
typeof this._ === "undefined" ? global.underscore : this._,
typeof window !== "undefined" ? window.XMLHttpRequest : global.XMLHttpRequest,
typeof flow === "undefined" ? global.flow : flow);
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
/*jslint strict: false, plusplus: false, sub: true */
/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
var requirejs, require, define;
(function () {
//Change this version number for each release.
var version = "1.0.7",
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
currDirRegExp = /^\.\//,
jsSuffixRegExp = /\.js$/,
ostring = Object.prototype.toString,
ap = Array.prototype,
aps = ap.slice,
apsp = ap.splice,
isBrowser = !!(typeof window !== "undefined" && navigator && document),
isWebWorker = !isBrowser && typeof importScripts !== "undefined",
//PS3 indicates loaded and complete, but need to wait for complete
//specifically. Sequence is "loading", "loaded", execution,
// then "complete". The UA check is unfortunate, but not sure how
//to feature test w/o causing perf issues.
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
/^complete$/ : /^(complete|loaded)$/,
defContextName = "_",
//Oh the tragedy, detecting opera. See the usage of isOpera for reason.
isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
empty = {},
contexts = {},
globalDefQueue = [],
interactiveScript = null,
checkLoadedDepth = 0,
useInteractive = false,
reservedDependencies = {
require: true,
module: true,
exports: true
},
req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;
function isFunction(it) {
return ostring.call(it) === "[object Function]";
}
function isArray(it) {
return ostring.call(it) === "[object Array]";
}
/**
* Simple function to mix in properties from source into target,
* but only if target does not already have a property of the same name.
* This is not robust in IE for transferring methods that match
* Object.prototype names, but the uses of mixin here seem unlikely to
* trigger a problem related to that.
*/
function mixin(target, source, force) {
for (var prop in source) {
if (!(prop in empty) && (!(prop in target) || force)) {
target[prop] = source[prop];
}
}
return req;
}
/**
* Constructs an error with a pointer to an URL with more information.
* @param {String} id the error ID that maps to an ID on a web page.
* @param {String} message human readable error.
* @param {Error} [err] the original error, if there is one.
*
* @returns {Error}
*/
function makeError(id, msg, err) {
var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
if (err) {
e.originalError = err;
}
return e;
}
/**
* Used to set up package paths from a packagePaths or packages config object.
* @param {Object} pkgs the object to store the new package config
* @param {Array} currentPackages an array of packages to configure
* @param {String} [dir] a prefix dir to use.
*/
function configurePackageDir(pkgs, currentPackages, dir) {
var i, location, pkgObj;
for (i = 0; (pkgObj = currentPackages[i]); i++) {
pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
location = pkgObj.location;
//Add dir to the path, but avoid paths that start with a slash
//or have a colon (indicates a protocol)
if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
location = dir + "/" + (location || pkgObj.name);
}
//Create a brand new object on pkgs, since currentPackages can
//be passed in again, and config.pkgs is the internal transformed
//state for all package configs.
pkgs[pkgObj.name] = {
name: pkgObj.name,
location: location || pkgObj.name,
//Remove leading dot in main, so main paths are normalized,
//and remove any trailing .js, since different package
//envs have different conventions: some use a module name,
//some use a file name.
main: (pkgObj.main || "main")
.replace(currDirRegExp, '')
.replace(jsSuffixRegExp, '')
};
}
}
/**
* jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
* ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
* At some point remove the readyWait/ready() support and just stick
* with using holdReady.
*/
function jQueryHoldReady($, shouldHold) {
if ($.holdReady) {
$.holdReady(shouldHold);
} else if (shouldHold) {
$.readyWait += 1;
} else {
$.ready(true);
}
}
if (typeof define !== "undefined") {
//If a define is already in play via another AMD loader,
//do not overwrite.
return;
}
if (typeof requirejs !== "undefined") {
if (isFunction(requirejs)) {
//Do not overwrite and existing requirejs instance.
return;
} else {
cfg = requirejs;
requirejs = undefined;
}
}
//Allow for a require config object
if (typeof require !== "undefined" && !isFunction(require)) {
//assume it is a config object.
cfg = require;
require = undefined;
}
/**
* Creates a new context for use in require and define calls.
* Handle most of the heavy lifting. Do not want to use an object
* with prototype here to avoid using "this" in require, in case it
* needs to be used in more super secure envs that do not want this.
* Also there should not be that many contexts in the page. Usually just
* one for the default context, but could be extra for multiversion cases
* or if a package needs a special context for a dependency that conflicts
* with the standard context.
*/
function newContext(contextName) {
var context, resume,
config = {
waitSeconds: 7,
baseUrl: "./",
paths: {},
pkgs: {},
catchError: {}
},
defQueue = [],
specified = {
"require": true,
"exports": true,
"module": true
},
urlMap = {},
defined = {},
loaded = {},
waiting = {},
waitAry = [],
urlFetched = {},
managerCounter = 0,
managerCallbacks = {},
plugins = {},
//Used to indicate which modules in a build scenario
//need to be full executed.
needFullExec = {},
fullExec = {},
resumeDepth = 0;
/**
* Trims the . and .. from an array of path segments.
* It will keep a leading path segment if a .. will become
* the first path segment, to help with module name lookups,
* which act like paths, but can be remapped. But the end result,
* all paths that use this function should look normalized.
* NOTE: this method MODIFIES the input array.
* @param {Array} ary the array of path segments.
*/
function trimDots(ary) {
var i, part;
for (i = 0; (part = ary[i]); i++) {
if (part === ".") {
ary.splice(i, 1);
i -= 1;
} else if (part === "..") {
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
ary.splice(i - 1, 2);
i -= 2;
}
}
}
}
/**
* Given a relative module name, like ./something, normalize it to
* a real name that can be mapped to a path.
* @param {String} name the relative name
* @param {String} baseName a real name that the name arg is relative
* to.
* @returns {String} normalized name
*/
function normalize(name, baseName) {
var pkgName, pkgConfig;
//Adjust any relative paths.
if (name && name.charAt(0) === ".") {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
if (config.pkgs[baseName]) {
//If the baseName is a package name, then just treat it as one
//name to concat the name with.
baseName = [baseName];
} else {
//Convert baseName to array, and lop off the last part,
//so that . matches that "directory" and not name of the baseName's
//module. For instance, baseName of "one/two/three", maps to
//"one/two/three.js", but we want the directory, "one/two" for
//this normalization.
baseName = baseName.split("/");
baseName = baseName.slice(0, baseName.length - 1);
}
name = baseName.concat(name.split("/"));
trimDots(name);
//Some use of packages may use a . path to reference the
//"main" module name, so normalize for that.
pkgConfig = config.pkgs[(pkgName = name[0])];
name = name.join("/");
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
name = pkgName;
}
} else if (name.indexOf("./") === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
name = name.substring(2);
}
}
return name;
}
/**
* Creates a module mapping that includes plugin prefix, module
* name, and path. If parentModuleMap is provided it will
* also normalize the name via require.normalize()
*
* @param {String} name the module name
* @param {String} [parentModuleMap] parent module map
* for the module name, used to resolve relative names.
*
* @returns {Object}
*/
function makeModuleMap(name, parentModuleMap) {
var index = name ? name.indexOf("!") : -1,
prefix = null,
parentName = parentModuleMap ? parentModuleMap.name : null,
originalName = name,
normalizedName, url, pluginModule;
if (index !== -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1, name.length);
}
if (prefix) {
prefix = normalize(prefix, parentName);
}
//Account for relative paths if there is a base name.
if (name) {
if (prefix) {
pluginModule = defined[prefix];
if (pluginModule && pluginModule.normalize) {
//Plugin is loaded, use its normalize method.
normalizedName = pluginModule.normalize(name, function (name) {
return normalize(name, parentName);
});
} else {
normalizedName = normalize(name, parentName);
}
} else {
//A regular module.
normalizedName = normalize(name, parentName);
url = urlMap[normalizedName];
if (!url) {
//Calculate url for the module, if it has a name.
//Use name here since nameToUrl also calls normalize,
//and for relative names that are outside the baseUrl
//this causes havoc. Was thinking of just removing
//parentModuleMap to avoid extra normalization, but
//normalize() still does a dot removal because of
//issue #142, so just pass in name here and redo
//the normalization. Paths outside baseUrl are just
//messy to support.
url = context.nameToUrl(name, null, parentModuleMap);
//Store the URL mapping for later.
urlMap[normalizedName] = url;
}
}
}
return {
prefix: prefix,
name: normalizedName,
parentMap: parentModuleMap,
url: url,
originalName: originalName,
fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
};
}
/**
* Determine if priority loading is done. If so clear the priorityWait
*/
function isPriorityDone() {
var priorityDone = true,
priorityWait = config.priorityWait,
priorityName, i;
if (priorityWait) {
for (i = 0; (priorityName = priorityWait[i]); i++) {
if (!loaded[priorityName]) {
priorityDone = false;
break;
}
}
if (priorityDone) {
delete config.priorityWait;
}
}
return priorityDone;
}
function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
return function () {
//A version of a require function that passes a moduleName
//value for items that may need to
//look up paths relative to the moduleName
var args = aps.call(arguments, 0), lastArg;
if (enableBuildCallback &&
isFunction((lastArg = args[args.length - 1]))) {
lastArg.__requireJsBuild = true;
}
args.push(relModuleMap);
return func.apply(null, args);
};
}
/**
* Helper function that creates a require function object to give to
* modules that ask for it as a dependency. It needs to be specific
* per module because of the implication of path mappings that may
* need to be relative to the module name.
*/
function makeRequire(relModuleMap, enableBuildCallback, altRequire) {
var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);
mixin(modRequire, {
nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
isBrowser: req.isBrowser
});
return modRequire;
}
/*
* Queues a dependency for checking after the loader is out of a
* "paused" state, for example while a script file is being loaded
* in the browser, where it may have many modules defined in it.
*/
function queueDependency(manager) {
context.paused.push(manager);
}
function execManager(manager) {
var i, ret, err, errFile, errModuleTree,
cb = manager.callback,
map = manager.map,
fullName = map.fullName,
args = manager.deps,
listeners = manager.listeners,
cjsModule;
//Call the callback to define the module, if necessary.
if (cb && isFunction(cb)) {
if (config.catchError.define) {
try {
ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
} catch (e) {
err = e;
}
} else {
ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
}
if (fullName) {
//If setting exports via "module" is in play,
//favor that over return value and exports. After that,
//favor a non-undefined return value over exports use.
cjsModule = manager.cjsModule;
if (cjsModule &&
cjsModule.exports !== undefined &&
//Make sure it is not already the exports value
cjsModule.exports !== defined[fullName]) {
ret = defined[fullName] = manager.cjsModule.exports;
} else if (ret === undefined && manager.usingExports) {
//exports already set the defined value.
ret = defined[fullName];
} else {
//Use the return value from the function.
defined[fullName] = ret;
//If this module needed full execution in a build
//environment, mark that now.
if (needFullExec[fullName]) {
fullExec[fullName] = true;
}
}
}
} else if (fullName) {
//May just be an object definition for the module. Only
//worry about defining if have a module name.
ret = defined[fullName] = cb;
//If this module needed full execution in a build
//environment, mark that now.
if (needFullExec[fullName]) {
fullExec[fullName] = true;
}
}
//Clean up waiting. Do this before error calls, and before
//calling back listeners, so that bookkeeping is correct
//in the event of an error and error is reported in correct order,
//since the listeners will likely have errors if the
//onError function does not throw.
if (waiting[manager.id]) {
delete waiting[manager.id];
manager.isDone = true;
context.waitCount -= 1;
if (context.waitCount === 0) {
//Clear the wait array used for cycles.
waitAry = [];
}
}
//Do not need to track manager callback now that it is defined.
delete managerCallbacks[fullName];
//Allow instrumentation like the optimizer to know the order
//of modules executed and their dependencies.
if (req.onResourceLoad && !manager.placeholder) {
req.onResourceLoad(context, map, manager.depArray);
}
if (err) {
errFile = (fullName ? makeModuleMap(fullName).url : '') ||
err.fileName || err.sourceURL;
errModuleTree = err.moduleTree;
err = makeError('defineerror', 'Error evaluating ' +
'module "' + fullName + '" at location "' +
errFile + '":\n' +
err + '\nfileName:' + errFile +
'\nlineNumber: ' + (err.lineNumber || err.line), err);
err.moduleName = fullName;
err.moduleTree = errModuleTree;
return req.onError(err);
}
//Let listeners know of this manager's value.
for (i = 0; (cb = listeners[i]); i++) {
cb(ret);
}
return undefined;
}
/**
* Helper that creates a callack function that is called when a dependency
* is ready, and sets the i-th dependency for the manager as the
* value passed to the callback generated by this function.
*/
function makeArgCallback(manager, i) {
return function (value) {
//Only do the work if it has not been done
//already for a dependency. Cycle breaking
//logic in forceExec could mean this function
//is called more than once for a given dependency.
if (!manager.depDone[i]) {
manager.depDone[i] = true;
manager.deps[i] = value;
manager.depCount -= 1;
if (!manager.depCount) {
//All done, execute!
execManager(manager);
}
}
};
}
function callPlugin(pluginName, depManager) {
var map = depManager.map,
fullName = map.fullName,
name = map.name,
plugin = plugins[pluginName] ||
(plugins[pluginName] = defined[pluginName]),
load;
//No need to continue if the manager is already
//in the process of loading.
if (depManager.loading) {
return;
}
depManager.loading = true;
load = function (ret) {
depManager.callback = function () {
return ret;
};
execManager(depManager);
loaded[depManager.id] = true;
//The loading of this plugin
//might have placed other things
//in the paused queue. In particular,
//a loader plugin that depends on
//a different plugin loaded resource.
resume();
};
//Allow plugins to load other code without having to know the
//context or how to "complete" the load.
load.fromText = function (moduleName, text) {
/*jslint evil: true */
var hasInteractive = useInteractive;
//Indicate a the module is in process of loading.
loaded[moduleName] = false;
context.scriptCount += 1;
//Indicate this is not a "real" module, so do not track it
//for builds, it does not map to a real file.
context.fake[moduleName] = true;
//Turn off interactive script matching for IE for any define
//calls in the text, then turn it back on at the end.
if (hasInteractive) {
useInteractive = false;
}
req.exec(text);
if (hasInteractive) {
useInteractive = true;
}
//Support anonymous modules.
context.completeLoad(moduleName);
};
//No need to continue if the plugin value has already been
//defined by a build.
if (fullName in defined) {
load(defined[fullName]);
} else {
//Use parentName here since the plugin's name is not reliable,
//could be some weird string with no path that actually wants to
//reference the parentName's path.
plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {
var moduleDeps = [],
i, dep, depMap;
//Convert deps to full names and hold on to them
//for reference later, when figuring out if they
//are blocked by a circular dependency.
for (i = 0; (dep = deps[i]); i++) {
depMap = makeModuleMap(dep, map.parentMap);
deps[i] = depMap.fullName;
if (!depMap.prefix) {
moduleDeps.push(deps[i]);
}
}
depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);
return context.require(deps, cb);
}), load, config);
}
}
/**
* Adds the manager to the waiting queue. Only fully
* resolved items should be in the waiting queue.
*/
function addWait(manager) {
if (!waiting[manager.id]) {
waiting[manager.id] = manager;
waitAry.push(manager);
context.waitCount += 1;
}
}
/**
* Function added to every manager object. Created out here
* to avoid new function creation for each manager instance.
*/
function managerAdd(cb) {
this.listeners.push(cb);
}
function getManager(map, shouldQueue) {
var fullName = map.fullName,
prefix = map.prefix,
plugin = prefix ? plugins[prefix] ||
(plugins[prefix] = defined[prefix]) : null,
manager, created, pluginManager, prefixMap;
if (fullName) {
manager = managerCallbacks[fullName];
}
if (!manager) {
created = true;
manager = {
//ID is just the full name, but if it is a plugin resource
//for a plugin that has not been loaded,
//then add an ID counter to it.
id: (prefix && !plugin ?
(managerCounter++) + '__p@:' : '') +
(fullName || '__r@' + (managerCounter++)),
map: map,
depCount: 0,
depDone: [],
depCallbacks: [],
deps: [],
listeners: [],
add: managerAdd
};
specified[manager.id] = true;
//Only track the manager/reuse it if this is a non-plugin
//resource. Also only track plugin resources once
//the plugin has been loaded, and so the fullName is the
//true normalized value.
if (fullName && (!prefix || plugins[prefix])) {
managerCallbacks[fullName] = manager;
}
}
//If there is a plugin needed, but it is not loaded,
//first load the plugin, then continue on.
if (prefix && !plugin) {
prefixMap = makeModuleMap(prefix);
//Clear out defined and urlFetched if the plugin was previously
//loaded/defined, but not as full module (as in a build
//situation). However, only do this work if the plugin is in
//defined but does not have a module export value.
if (prefix in defined && !defined[prefix]) {
delete defined[prefix];
delete urlFetched[prefixMap.url];
}
pluginManager = getManager(prefixMap, true);
pluginManager.add(function (plugin) {
//Create a new manager for the normalized
//resource ID and have it call this manager when
//done.
var newMap = makeModuleMap(map.originalName, map.parentMap),
normalizedManager = getManager(newMap, true);
//Indicate this manager is a placeholder for the real,
//normalized thing. Important for when trying to map
//modules and dependencies, for instance, in a build.
manager.placeholder = true;
normalizedManager.add(function (resource) {
manager.callback = function () {
return resource;
};
execManager(manager);
});
});
} else if (created && shouldQueue) {
//Indicate the resource is not loaded yet if it is to be
//queued.
loaded[manager.id] = false;
queueDependency(manager);
addWait(manager);
}
return manager;
}
function main(inName, depArray, callback, relModuleMap) {
var moduleMap = makeModuleMap(inName, relModuleMap),
name = moduleMap.name,
fullName = moduleMap.fullName,
manager = getManager(moduleMap),
id = manager.id,
deps = manager.deps,
i, depArg, depName, depPrefix, cjsMod;
if (fullName) {
//If module already defined for context, or already loaded,
//then leave. Also leave if jQuery is registering but it does
//not match the desired version number in the config.
if (fullName in defined || loaded[id] === true ||
(fullName === "jquery" && config.jQuery &&
config.jQuery !== callback().fn.jquery)) {
return;
}
//Set specified/loaded here for modules that are also loaded
//as part of a layer, where onScriptLoad is not fired
//for those cases. Do this after the inline define and
//dependency tracing is done.
specified[id] = true;
loaded[id] = true;
//If module is jQuery set up delaying its dom ready listeners.
if (fullName === "jquery" && callback) {
jQueryCheck(callback());
}
}
//Attach real depArray and callback to the manager. Do this
//only if the module has not been defined already, so do this after
//the fullName checks above. IE can call main() more than once
//for a module.
manager.depArray = depArray;
manager.callback = callback;
//Add the dependencies to the deps field, and register for callbacks
//on the dependencies.
for (i = 0; i < depArray.length; i++) {
depArg = depArray[i];
//There could be cases like in IE, where a trailing comma will
//introduce a null dependency, so only treat a real dependency
//value as a dependency.
if (depArg) {
//Split the dependency name into plugin and name parts
depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
depName = depArg.fullName;
depPrefix = depArg.prefix;
//Fix the name in depArray to be just the name, since
//that is how it will be called back later.
depArray[i] = depName;
//Fast path CommonJS standard dependencies.
if (depName === "require") {
deps[i] = makeRequire(moduleMap);
} else if (depName === "exports") {
//CommonJS module spec 1.1
deps[i] = defined[fullName] = {};
manager.usingExports = true;
} else if (depName === "module") {
//CommonJS module spec 1.1
manager.cjsModule = cjsMod = deps[i] = {
id: name,
uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
exports: defined[fullName]
};
} else if (depName in defined && !(depName in waiting) &&
(!(fullName in needFullExec) ||
(fullName in needFullExec && fullExec[depName]))) {
//Module already defined, and not in a build situation
//where the module is a something that needs full
//execution and this dependency has not been fully
//executed. See r.js's requirePatch.js for more info
//on fullExec.
deps[i] = defined[depName];
} else {
//Mark this dependency as needing full exec if
//the current module needs full exec.
if (fullName in needFullExec) {
needFullExec[depName] = true;
//Reset state so fully executed code will get
//picked up correctly.
delete defined[depName];
urlFetched[depArg.url] = false;
}
//Either a resource that is not loaded yet, or a plugin
//resource for either a plugin that has not
//loaded yet.
manager.depCount += 1;
manager.depCallbacks[i] = makeArgCallback(manager, i);
getManager(depArg, true).add(manager.depCallbacks[i]);
}
}
}
//Do not bother tracking the manager if it is all done.
if (!manager.depCount) {
//All done, execute!
execManager(manager);
} else {
addWait(manager);
}
}
/**
* Convenience method to call main for a define call that was put on
* hold in the defQueue.
*/
function callDefMain(args) {
main.apply(null, args);
}
/**
* jQuery 1.4.3+ supports ways to hold off calling
* calling jQuery ready callbacks until all scripts are loaded. Be sure
* to track it if the capability exists.. Also, since jQuery 1.4.3 does
* not register as a module, need to do some global inference checking.
* Even if it does register as a module, not guaranteed to be the precise
* name of the global. If a jQuery is tracked for this context, then go
* ahead and register it as a module too, if not already in process.
*/
jQueryCheck = function (jqCandidate) {
if (!context.jQuery) {
var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
if ($) {
//If a specific version of jQuery is wanted, make sure to only
//use this jQuery if it matches.
if (config.jQuery && $.fn.jquery !== config.jQuery) {
return;
}
if ("holdReady" in $ || "readyWait" in $) {
context.jQuery = $;
//Manually create a "jquery" module entry if not one already
//or in process. Note this could trigger an attempt at
//a second jQuery registration, but does no harm since
//the first one wins, and it is the same value anyway.
callDefMain(["jquery", [], function () {
return jQuery;
}]);
//Ask jQuery to hold DOM ready callbacks.
if (context.scriptCount) {
jQueryHoldReady($, true);
context.jQueryIncremented = true;
}
}
}
}
};
function findCycle(manager, traced) {
var fullName = manager.map.fullName,
depArray = manager.depArray,
fullyLoaded = true,
i, depName, depManager, result;
if (manager.isDone || !fullName || !loaded[fullName]) {
return result;
}
//Found the cycle.
if (traced[fullName]) {
return manager;
}
traced[fullName] = true;
//Trace through the dependencies.
if (depArray) {
for (i = 0; i < depArray.length; i++) {
//Some array members may be null, like if a trailing comma
//IE, so do the explicit [i] access and check if it has a value.
depName = depArray[i];
if (!loaded[depName] && !reservedDependencies[depName]) {
fullyLoaded = false;
break;
}
depManager = waiting[depName];
if (depManager && !depManager.isDone && loaded[depName]) {
result = findCycle(depManager, traced);
if (result) {
break;
}
}
}
if (!fullyLoaded) {
//Discard the cycle that was found, since it cannot
//be forced yet. Also clear this module from traced.
result = undefined;
delete traced[fullName];
}
}
return result;
}
function forceExec(manager, traced) {
var fullName = manager.map.fullName,
depArray = manager.depArray,
i, depName, depManager, prefix, prefixManager, value;
if (manager.isDone || !fullName || !loaded[fullName]) {
return undefined;
}
if (fullName) {
if (traced[fullName]) {
return defined[fullName];
}
traced[fullName] = true;
}
//Trace through the dependencies.
if (depArray) {
for (i = 0; i < depArray.length; i++) {
//Some array members may be null, like if a trailing comma
//IE, so do the explicit [i] access and check if it has a value.
depName = depArray[i];
if (depName) {
//First, make sure if it is a plugin resource that the
//plugin is not blocked.
prefix = makeModuleMap(depName).prefix;
if (prefix && (prefixManager = waiting[prefix])) {
forceExec(prefixManager, traced);
}
depManager = waiting[depName];
if (depManager && !depManager.isDone && loaded[depName]) {
value = forceExec(depManager, traced);
manager.depCallbacks[i](value);
}
}
}
}
return defined[fullName];
}
/**
* Checks if all modules for a context are loaded, and if so, evaluates the
* new ones in right dependency order.
*
* @private
*/
function checkLoaded() {
var waitInterval = config.waitSeconds * 1000,
//It is possible to disable the wait interval by using waitSeconds of 0.
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
noLoads = "", hasLoadedProp = false, stillLoading = false,
cycleDeps = [],
i, prop, err, manager, cycleManager, moduleDeps;
//If there are items still in the paused queue processing wait.
//This is particularly important in the sync case where each paused
//item is processed right away but there may be more waiting.
if (context.pausedCount > 0) {
return undefined;
}
//Determine if priority loading is done. If so clear the priority. If
//not, then do not check
if (config.priorityWait) {
if (isPriorityDone()) {
//Call resume, since it could have
//some waiting dependencies to trace.
resume();
} else {
return undefined;
}
}
//See if anything is still in flight.
for (prop in loaded) {
if (!(prop in empty)) {
hasLoadedProp = true;
if (!loaded[prop]) {
if (expired) {
noLoads += prop + " ";
} else {
stillLoading = true;
if (prop.indexOf('!') === -1) {
//No reason to keep looking for unfinished
//loading. If the only stillLoading is a
//plugin resource though, keep going,
//because it may be that a plugin resource
//is waiting on a non-plugin cycle.
cycleDeps = [];
break;
} else {
moduleDeps = managerCallbacks[prop] && managerCallbacks[prop].moduleDeps;
if (moduleDeps) {
cycleDeps.push.apply(cycleDeps, moduleDeps);
}
}
}
}
}
}
//Check for exit conditions.
if (!hasLoadedProp && !context.waitCount) {
//If the loaded object had no items, then the rest of
//the work below does not need to be done.
return undefined;
}
if (expired && noLoads) {
//If wait time expired, throw error of unloaded modules.
err = makeError("timeout", "Load timeout for modules: " + noLoads);
err.requireType = "timeout";
err.requireModules = noLoads;
err.contextName = context.contextName;
return req.onError(err);
}
//If still loading but a plugin is waiting on a regular module cycle
//break the cycle.
if (stillLoading && cycleDeps.length) {
for (i = 0; (manager = waiting[cycleDeps[i]]); i++) {
if ((cycleManager = findCycle(manager, {}))) {
forceExec(cycleManager, {});
break;
}
}
}
//If still waiting on loads, and the waiting load is something
//other than a plugin resource, or there are still outstanding
//scripts, then just try back later.
if (!expired && (stillLoading || context.scriptCount)) {
//Something is still waiting to load. Wait for it, but only
//if a timeout is not already in effect.
if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
checkLoadedTimeoutId = setTimeout(function () {
checkLoadedTimeoutId = 0;
checkLoaded();
}, 50);
}
return undefined;
}
//If still have items in the waiting cue, but all modules have
//been loaded, then it means there are some circular dependencies
//that need to be broken.
//However, as a waiting thing is fired, then it can add items to
//the waiting cue, and those items should not be fired yet, so
//make sure to redo the checkLoaded call after breaking a single
//cycle, if nothing else loaded then this logic will pick it up
//again.
if (context.waitCount) {
//Cycle through the waitAry, and call items in sequence.
for (i = 0; (manager = waitAry[i]); i++) {
forceExec(manager, {});
}
//If anything got placed in the paused queue, run it down.
if (context.paused.length) {
resume();
}
//Only allow this recursion to a certain depth. Only
//triggered by errors in calling a module in which its
//modules waiting on it cannot finish loading, or some circular
//dependencies that then may add more dependencies.
//The value of 5 is a bit arbitrary. Hopefully just one extra
//pass, or two for the case of circular dependencies generating
//more work that gets resolved in the sync node case.
if (checkLoadedDepth < 5) {
checkLoadedDepth += 1;
checkLoaded();
}
}
checkLoadedDepth = 0;
//Check for DOM ready, and nothing is waiting across contexts.
req.checkReadyState();
return undefined;
}
/**
* Resumes tracing of dependencies and then checks if everything is loaded.
*/
resume = function () {
var manager, map, url, i, p, args, fullName;
//Any defined modules in the global queue, intake them now.
context.takeGlobalQueue();
resumeDepth += 1;
if (context.scriptCount <= 0) {
//Synchronous envs will push the number below zero with the
//decrement above, be sure to set it back to zero for good measure.
//require() calls that also do not end up loading scripts could
//push the number negative too.
context.scriptCount = 0;
}
//Make sure any remaining defQueue items get properly processed.
while (defQueue.length) {
args = defQueue.shift();
if (args[0] === null) {
return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
} else {
callDefMain(args);
}
}
//Skip the resume of paused dependencies
//if current context is in priority wait.
if (!config.priorityWait || isPriorityDone()) {
while (context.paused.length) {
p = context.paused;
context.pausedCount += p.length;
//Reset paused list
context.paused = [];
for (i = 0; (manager = p[i]); i++) {
map = manager.map;
url = map.url;
fullName = map.fullName;
//If the manager is for a plugin managed resource,
//ask the plugin to load it now.
if (map.prefix) {
callPlugin(map.prefix, manager);
} else {
//Regular dependency.
if (!urlFetched[url] && !loaded[fullName]) {
req.load(context, fullName, url);
//Mark the URL as fetched, but only if it is
//not an empty: URL, used by the optimizer.
//In that case we need to be sure to call
//load() for each module that is mapped to
//empty: so that dependencies are satisfied
//correctly.
if (url.indexOf('empty:') !== 0) {
urlFetched[url] = true;
}
}
}
}
//Move the start time for timeout forward.
context.startTime = (new Date()).getTime();
context.pausedCount -= p.length;
}
}
//Only check if loaded when resume depth is 1. It is likely that
//it is only greater than 1 in sync environments where a factory
//function also then calls the callback-style require. In those
//cases, the checkLoaded should not occur until the resume
//depth is back at the top level.
if (resumeDepth === 1) {
checkLoaded();
}
resumeDepth -= 1;
return undefined;
};
//Define the context object. Many of these fields are on here
//just to make debugging easier.
context = {
contextName: contextName,
config: config,
defQueue: defQueue,
waiting: waiting,
waitCount: 0,
specified: specified,
loaded: loaded,
urlMap: urlMap,
urlFetched: urlFetched,
scriptCount: 0,
defined: defined,
paused: [],
pausedCount: 0,
plugins: plugins,
needFullExec: needFullExec,
fake: {},
fullExec: fullExec,
managerCallbacks: managerCallbacks,
makeModuleMap: makeModuleMap,
normalize: normalize,
/**
* Set a configuration for the context.
* @param {Object} cfg config object to integrate.
*/
configure: function (cfg) {
var paths, prop, packages, pkgs, packagePaths, requireWait;
//Make sure the baseUrl ends in a slash.
if (cfg.baseUrl) {
if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
cfg.baseUrl += "/";
}
}
//Save off the paths and packages since they require special processing,
//they are additive.
paths = config.paths;
packages = config.packages;
pkgs = config.pkgs;
//Mix in the config values, favoring the new values over
//existing ones in context.config.
mixin(config, cfg, true);
//Adjust paths if necessary.
if (cfg.paths) {
for (prop in cfg.paths) {
if (!(prop in empty)) {
paths[prop] = cfg.paths[prop];
}
}
config.paths = paths;
}
packagePaths = cfg.packagePaths;
if (packagePaths || cfg.packages) {
//Convert packagePaths into a packages config.
if (packagePaths) {
for (prop in packagePaths) {
if (!(prop in empty)) {
configurePackageDir(pkgs, packagePaths[prop], prop);
}
}
}
//Adjust packages if necessary.
if (cfg.packages) {
configurePackageDir(pkgs, cfg.packages);
}
//Done with modifications, assing packages back to context config
config.pkgs = pkgs;
}
//If priority loading is in effect, trigger the loads now
if (cfg.priority) {
//Hold on to requireWait value, and reset it after done
requireWait = context.requireWait;
//Allow tracing some require calls to allow the fetching
//of the priority config.
context.requireWait = false;
//But first, call resume to register any defined modules that may
//be in a data-main built file before the priority config
//call.
resume();
context.require(cfg.priority);
//Trigger a resume right away, for the case when
//the script with the priority load is done as part
//of a data-main call. In that case the normal resume
//call will not happen because the scriptCount will be
//at 1, since the script for data-main is being processed.
resume();
//Restore previous state.
context.requireWait = requireWait;
config.priorityWait = cfg.priority;
}
//If a deps array or a config callback is specified, then call
//require with those args. This is useful when require is defined as a
//config object before require.js is loaded.
if (cfg.deps || cfg.callback) {
context.require(cfg.deps || [], cfg.callback);
}
},
requireDefined: function (moduleName, relModuleMap) {
return makeModuleMap(moduleName, relModuleMap).fullName in defined;
},
requireSpecified: function (moduleName, relModuleMap) {
return makeModuleMap(moduleName, relModuleMap).fullName in specified;
},
require: function (deps, callback, relModuleMap) {
var moduleName, fullName, moduleMap;
if (typeof deps === "string") {
if (isFunction(callback)) {
//Invalid call
return req.onError(makeError("requireargs", "Invalid require call"));
}
//Synchronous access to one module. If require.get is
//available (as in the Node adapter), prefer that.
//In this case deps is the moduleName and callback is
//the relModuleMap
if (req.get) {
return req.get(context, deps, callback);
}
//Just return the module wanted. In this scenario, the
//second arg (if passed) is just the relModuleMap.
moduleName = deps;
relModuleMap = callback;
//Normalize module name, if it contains . or ..
moduleMap = makeModuleMap(moduleName, relModuleMap);
fullName = moduleMap.fullName;
if (!(fullName in defined)) {
return req.onError(makeError("notloaded", "Module name '" +
moduleMap.fullName +
"' has not been loaded yet for context: " +
contextName));
}
return defined[fullName];
}
//Call main but only if there are dependencies or
//a callback to call.
if (deps && deps.length || callback) {
main(null, deps, callback, relModuleMap);
}
//If the require call does not trigger anything new to load,
//then resume the dependency processing.
if (!context.requireWait) {
while (!context.scriptCount && context.paused.length) {
resume();
}
}
return context.require;
},
/**
* Internal method to transfer globalQueue items to this context's
* defQueue.
*/
takeGlobalQueue: function () {
//Push all the globalDefQueue items into the context's defQueue
if (globalDefQueue.length) {
//Array splice in the values since the context code has a
//local var ref to defQueue, so cannot just reassign the one
//on context.
apsp.apply(context.defQueue,
[context.defQueue.length - 1, 0].concat(globalDefQueue));
globalDefQueue = [];
}
},
/**
* Internal method used by environment adapters to complete a load event.
* A load event could be a script load or just a load pass from a synchronous
* load call.
* @param {String} moduleName the name of the module to potentially complete.
*/
completeLoad: function (moduleName) {
var args;
context.takeGlobalQueue();
while (defQueue.length) {
args = defQueue.shift();
if (args[0] === null) {
args[0] = moduleName;
break;
} else if (args[0] === moduleName) {
//Found matching define call for this script!
break;
} else {
//Some other named define call, most likely the result
//of a build layer that included many define calls.
callDefMain(args);
args = null;
}
}
if (args) {
callDefMain(args);
} else {
//A script that does not call define(), so just simulate
//the call for it. Special exception for jQuery dynamic load.
callDefMain([moduleName, [],
moduleName === "jquery" && typeof jQuery !== "undefined" ?
function () {
return jQuery;
} : null]);
}
//Doing this scriptCount decrement branching because sync envs
//need to decrement after resume, otherwise it looks like
//loading is complete after the first dependency is fetched.
//For browsers, it works fine to decrement after, but it means
//the checkLoaded setTimeout 50 ms cost is taken. To avoid
//that cost, decrement beforehand.
if (req.isAsync) {
context.scriptCount -= 1;
}
resume();
if (!req.isAsync) {
context.scriptCount -= 1;
}
},
/**
* Converts a module name + .extension into an URL path.
* *Requires* the use of a module name. It does not support using
* plain URLs like nameToUrl.
*/
toUrl: function (moduleNamePlusExt, relModuleMap) {
var index = moduleNamePlusExt.lastIndexOf("."),
ext = null;
if (index !== -1) {
ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
}
return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
},
/**
* Converts a module name to a file path. Supports cases where
* moduleName may actually be just an URL.
*/
nameToUrl: function (moduleName, ext, relModuleMap) {
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
config = context.config;
//Normalize module name if have a base relative module name to work from.
moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
//If a colon is in the URL, it indicates a protocol is used and it is just
//an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
//The slash is important for protocol-less URLs as well as full paths.
if (req.jsExtRegExp.test(moduleName)) {
//Just a plain path, not module name lookup, so just return it.
//Add extension if it is included. This is a bit wonky, only non-.js things pass
//an extension, this method probably needs to be reworked.
url = moduleName + (ext ? ext : "");
} else {
//A module that needs to be converted to a path.
paths = config.paths;
pkgs = config.pkgs;
syms = moduleName.split("/");
//For each module name segment, see if there is a path
//registered for it. Start with most specific name
//and work up from it.
for (i = syms.length; i > 0; i--) {
parentModule = syms.slice(0, i).join("/");
if (paths[parentModule]) {
syms.splice(0, i, paths[parentModule]);
break;
} else if ((pkg = pkgs[parentModule])) {
//If module name is just the package name, then looking
//for the main module.
if (moduleName === pkg.name) {
pkgPath = pkg.location + '/' + pkg.main;
} else {
pkgPath = pkg.location;
}
syms.splice(0, i, pkgPath);
break;
}
}
//Join the path parts together, then figure out if baseUrl is needed.
url = syms.join("/") + (ext || ".js");
url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
}
return config.urlArgs ? url +
((url.indexOf('?') === -1 ? '?' : '&') +
config.urlArgs) : url;
}
};
//Make these visible on the context so can be called at the very
//end of the file to bootstrap
context.jQueryCheck = jQueryCheck;
context.resume = resume;
return context;
}
/**
* Main entry point.
*
* If the only argument to require is a string, then the module that
* is represented by that string is fetched for the appropriate context.
*
* If the first argument is an array, then it will be treated as an array
* of dependency string names to fetch. An optional function callback can
* be specified to execute when all of those dependencies are available.
*
* Make a local req variable to help Caja compliance (it assumes things
* on a require that are not standardized), and to give a short
* name for minification/local scope use.
*/
req = requirejs = function (deps, callback) {
//Find the right context, use default
var contextName = defContextName,
context, config;
// Determine if have config object in the call.
if (!isArray(deps) && typeof deps !== "string") {
// deps is a config object
config = deps;
if (isArray(callback)) {
// Adjust args if there are dependencies
deps = callback;
callback = arguments[2];
} else {
deps = [];
}
}
if (config && config.context) {
contextName = config.context;
}
context = contexts[contextName] ||
(contexts[contextName] = newContext(contextName));
if (config) {
context.configure(config);
}
return context.require(deps, callback);
};
/**
* Support require.config() to make it easier to cooperate with other
* AMD loaders on globally agreed names.
*/
req.config = function (config) {
return req(config);
};
/**
* Export require as a global, but only if it does not already exist.
*/
if (!require) {
require = req;
}
/**
* Global require.toUrl(), to match global require, mostly useful
* for debugging/work in the global space.
*/
req.toUrl = function (moduleNamePlusExt) {
return contexts[defContextName].toUrl(moduleNamePlusExt);
};
req.version = version;
//Used to filter out dependencies that are already paths.
req.jsExtRegExp = /^\/|:|\?|\.js$/;
s = req.s = {
contexts: contexts,
//Stores a list of URLs that should not get async script tag treatment.
skipAsync: {}
};
req.isAsync = req.isBrowser = isBrowser;
if (isBrowser) {
head = s.head = document.getElementsByTagName("head")[0];
//If BASE tag is in play, using appendChild is a problem for IE6.
//When that browser dies, this can be removed. Details in this jQuery bug:
//http://dev.jquery.com/ticket/2709
baseElement = document.getElementsByTagName("base")[0];
if (baseElement) {
head = s.head = baseElement.parentNode;
}
}
/**
* Any errors that require explicitly generates will be passed to this
* function. Intercept/override it if you want custom error handling.
* @param {Error} err the error object.
*/
req.onError = function (err) {
throw err;
};
/**
* Does the request to load a module for the browser case.
* Make this a separate function to allow other environments
* to override it.
*
* @param {Object} context the require context to find state.
* @param {String} moduleName the name of the module.
* @param {Object} url the URL to the module.
*/
req.load = function (context, moduleName, url) {
req.resourcesReady(false);
context.scriptCount += 1;
req.attach(url, context, moduleName);
//If tracking a jQuery, then make sure its ready callbacks
//are put on hold to prevent its ready callbacks from
//triggering too soon.
if (context.jQuery && !context.jQueryIncremented) {
jQueryHoldReady(context.jQuery, true);
context.jQueryIncremented = true;
}
};
function getInteractiveScript() {
var scripts, i, script;
if (interactiveScript && interactiveScript.readyState === 'interactive') {
return interactiveScript;
}
scripts = document.getElementsByTagName('script');
for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
if (script.readyState === 'interactive') {
return (interactiveScript = script);
}
}
return null;
}
/**
* The function that handles definitions of modules. Differs from
* require() in that a string for the module should be the first argument,
* and the function to execute after dependencies are loaded should
* return a value to define the module corresponding to the first argument's
* name.
*/
define = function (name, deps, callback) {
var node, context;
//Allow for anonymous functions
if (typeof name !== 'string') {
//Adjust args appropriately
callback = deps;
deps = name;
name = null;
}
//This module may not have dependencies
if (!isArray(deps)) {
callback = deps;
deps = [];
}
//If no name, and callback is a function, then figure out if it a
//CommonJS thing with dependencies.
if (!deps.length && isFunction(callback)) {
//Remove comments from the callback string,
//look for require calls, and pull them into the dependencies,
//but only if there are function args.
if (callback.length) {
callback
.toString()
.replace(commentRegExp, "")
.replace(cjsRequireRegExp, function (match, dep) {
deps.push(dep);
});
//May be a CommonJS thing even without require calls, but still
//could use exports, and module. Avoid doing exports and module
//work though if it just needs require.
//REQUIRES the function to expect the CommonJS variables in the
//order listed below.
deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
}
}
//If in IE 6-8 and hit an anonymous define() call, do the interactive
//work.
if (useInteractive) {
node = currentlyAddingScript || getInteractiveScript();
if (node) {
if (!name) {
name = node.getAttribute("data-requiremodule");
}
context = contexts[node.getAttribute("data-requirecontext")];
}
}
//Always save off evaluating the def call until the script onload handler.
//This allows multiple modules to be in a file without prematurely
//tracing dependencies, and allows for anonymous module support,
//where the module name is not known until the script onload event
//occurs. If no context, use the global queue, and get it processed
//in the onscript load callback.
(context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
return undefined;
};
define.amd = {
multiversion: true,
plugins: true,
jQuery: true
};
/**
* Executes the text. Normally just uses eval, but can be modified
* to use a more environment specific call.
* @param {String} text the text to execute/evaluate.
*/
req.exec = function (text) {
return eval(text);
};
/**
* Executes a module callack function. Broken out as a separate function
* solely to allow the build system to sequence the files in the built
* layer in the right sequence.
*
* @private
*/
req.execCb = function (name, callback, args, exports) {
return callback.apply(exports, args);
};
/**
* Adds a node to the DOM. Public function since used by the order plugin.
* This method should not normally be called by outside code.
*/
req.addScriptToDom = function (node) {
//For some cache cases in IE 6-8, the script executes before the end
//of the appendChild execution, so to tie an anonymous define
//call to the module name (which is stored on the node), hold on
//to a reference to this node, but clear after the DOM insertion.
currentlyAddingScript = node;
if (baseElement) {
head.insertBefore(node, baseElement);
} else {
head.appendChild(node);
}
currentlyAddingScript = null;
};
/**
* callback for script loads, used to check status of loading.
*
* @param {Event} evt the event from the browser for the script
* that was loaded.
*
* @private
*/
req.onScriptLoad = function (evt) {
//Using currentTarget instead of target for Firefox 2.0's sake. Not
//all old browsers will be supported, but this one was easy enough
//to support and still makes sense.
var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
context;
if (evt.type === "load" || (node && readyRegExp.test(node.readyState))) {
//Reset interactive script so a script node is not held onto for
//to long.
interactiveScript = null;
//Pull out the name of the module and the context.
contextName = node.getAttribute("data-requirecontext");
moduleName = node.getAttribute("data-requiremodule");
context = contexts[contextName];
contexts[contextName].completeLoad(moduleName);
//Clean up script binding. Favor detachEvent because of IE9
//issue, see attachEvent/addEventListener comment elsewhere
//in this file.
if (node.detachEvent && !isOpera) {
//Probably IE. If not it will throw an error, which will be
//useful to know.
node.detachEvent("onreadystatechange", req.onScriptLoad);
} else {
node.removeEventListener("load", req.onScriptLoad, false);
}
}
};
/**
* Attaches the script represented by the URL to the current
* environment. Right now only supports browser loading,
* but can be redefined in other environments to do the right thing.
* @param {String} url the url of the script to attach.
* @param {Object} context the context that wants the script.
* @param {moduleName} the name of the module that is associated with the script.
* @param {Function} [callback] optional callback, defaults to require.onScriptLoad
* @param {String} [type] optional type, defaults to text/javascript
* @param {Function} [fetchOnlyFunction] optional function to indicate the script node
* should be set up to fetch the script but do not attach it to the DOM
* so that it can later be attached to execute it. This is a way for the
* order plugin to support ordered loading in IE. Once the script is fetched,
* but not executed, the fetchOnlyFunction will be called.
*/
req.attach = function (url, context, moduleName, callback, type, fetchOnlyFunction) {
var node;
if (isBrowser) {
//In the browser so use a script tag
callback = callback || req.onScriptLoad;
node = context && context.config && context.config.xhtml ?
document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
document.createElement("script");
node.type = type || (context && context.config.scriptType) ||
"text/javascript";
node.charset = "utf-8";
//Use async so Gecko does not block on executing the script if something
//like a long-polling comet tag is being run first. Gecko likes
//to evaluate scripts in DOM order, even for dynamic scripts.
//It will fetch them async, but only evaluate the contents in DOM
//order, so a long-polling script tag can delay execution of scripts
//after it. But telling Gecko we expect async gets us the behavior
//we want -- execute it whenever it is finished downloading. Only
//Helps Firefox 3.6+
//Allow some URLs to not be fetched async. Mostly helps the order!
//plugin
node.async = !s.skipAsync[url];
if (context) {
node.setAttribute("data-requirecontext", context.contextName);
}
node.setAttribute("data-requiremodule", moduleName);
//Set up load listener. Test attachEvent first because IE9 has
//a subtle issue in its addEventListener and script onload firings
//that do not match the behavior of all other browsers with
//addEventListener support, which fire the onload event for a
//script right after the script execution. See:
//https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
//UNFORTUNATELY Opera implements attachEvent but does not follow the script
//script execution mode.
if (node.attachEvent && !isOpera) {
//Probably IE. IE (at least 6-8) do not fire
//script onload right after executing the script, so
//we cannot tie the anonymous define call to a name.
//However, IE reports the script as being in "interactive"
//readyState at the time of the define call.
useInteractive = true;
if (fetchOnlyFunction) {
//Need to use old school onreadystate here since
//when the event fires and the node is not attached
//to the DOM, the evt.srcElement is null, so use
//a closure to remember the node.
node.onreadystatechange = function (evt) {
//Script loaded but not executed.
//Clear loaded handler, set the real one that
//waits for script execution.
if (node.readyState === 'loaded') {
node.onreadystatechange = null;
node.attachEvent("onreadystatechange", callback);
fetchOnlyFunction(node);
}
};
} else {
node.attachEvent("onreadystatechange", callback);
}
} else {
node.addEventListener("load", callback, false);
}
node.src = url;
//Fetch only means waiting to attach to DOM after loaded.
if (!fetchOnlyFunction) {
req.addScriptToDom(node);
}
return node;
} else if (isWebWorker) {
//In a web worker, use importScripts. This is not a very
//efficient use of importScripts, importScripts will block until
//its script is downloaded and evaluated. However, if web workers
//are in play, the expectation that a build has been done so that
//only one script needs to be loaded anyway. This may need to be
//reevaluated if other use cases become common.
importScripts(url);
//Account for anonymous modules
context.completeLoad(moduleName);
}
return null;
};
//Look for a data-main script attribute, which could also adjust the baseUrl.
if (isBrowser) {
//Figure out baseUrl. Get it from the script tag with require.js in it.
scripts = document.getElementsByTagName("script");
for (globalI = scripts.length - 1; globalI > -1 && (script = scripts[globalI]); globalI--) {
//Set the "head" where we can append children by
//using the script's parent.
if (!head) {
head = script.parentNode;
}
//Look for a data-main attribute to set main script for the page
//to load. If it is there, the path to data main becomes the
//baseUrl, if it is not already set.
if ((dataMain = script.getAttribute('data-main'))) {
if (!cfg.baseUrl) {
//Pull off the directory of data-main for use as the
//baseUrl.
src = dataMain.split('/');
mainScript = src.pop();
subPath = src.length ? src.join('/') + '/' : './';
//Set final config.
cfg.baseUrl = subPath;
//Strip off any trailing .js since dataMain is now
//like a module name.
dataMain = mainScript.replace(jsSuffixRegExp, '');
}
//Put the data-main script in the files to load.
cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
break;
}
}
}
//See if there is nothing waiting across contexts, and if not, trigger
//resourcesReady.
req.checkReadyState = function () {
var contexts = s.contexts, prop;
for (prop in contexts) {
if (!(prop in empty)) {
if (contexts[prop].waitCount) {
return;
}
}
}
req.resourcesReady(true);
};
/**
* Internal function that is triggered whenever all scripts/resources
* have been loaded by the loader. Can be overridden by other, for
* instance the domReady plugin, which wants to know when all resources
* are loaded.
*/
req.resourcesReady = function (isReady) {
var contexts, context, prop;
//First, set the public variable indicating that resources are loading.
req.resourcesDone = isReady;
if (req.resourcesDone) {
//If jQuery with DOM ready delayed, release it now.
contexts = s.contexts;
for (prop in contexts) {
if (!(prop in empty)) {
context = contexts[prop];
if (context.jQueryIncremented) {
jQueryHoldReady(context.jQuery, false);
context.jQueryIncremented = false;
}
}
}
}
};
//FF < 3.6 readyState fix. Needed so that domReady plugin
//works well in that environment, since require.js is normally
//loaded via an HTML script tag so it will be there before window load,
//where the domReady plugin is more likely to be loaded after window load.
req.pageLoaded = function () {
if (document.readyState !== "complete") {
document.readyState = "complete";
}
};
if (isBrowser) {
if (document.addEventListener) {
if (!document.readyState) {
document.readyState = "loading";
window.addEventListener("load", req.pageLoaded, false);
}
}
}
//Set up default context. If require was a configuration object, use that as base config.
req(cfg);
//If modules are built into require.js, then need to make sure dependencies are
//traced. Use a setTimeout in the browser world, to allow all the modules to register
//themselves. In a non-browser env, assume that modules are not built into require.js,
//which seems odd to do on the server.
if (req.isAsync && typeof setTimeout !== "undefined") {
ctx = s.contexts[(cfg.context || defContextName)];
//Indicate that the script that includes require() is still loading,
//so that require()'d dependencies are not traced until the end of the
//file is parsed (approximated via the setTimeout call).
ctx.requireWait = true;
setTimeout(function () {
ctx.requireWait = false;
if (!ctx.scriptCount) {
ctx.resume();
}
req.checkReadyState();
}, 0);
}
}());
// Underscore.js 1.3.1
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===n)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(x&&a.map===x)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==
null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})});
return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});return b};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=
b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];return d},[]);
return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,
d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};
var F=function(){};b.bind=function(a,c){var d,e;if(a.bind===s&&s)return s.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;var b=new F,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,
c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true:
a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};
b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")};b.mixin=function(a){j(b.functions(a),
function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
This source diff could not be displayed because it is too large. You can view the blob instead.
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