diff --git a/assets/js/libs/can.ejs.js b/assets/js/libs/can.ejs.js index 1d3c9e3..41a07be 100755 --- a/assets/js/libs/can.ejs.js +++ b/assets/js/libs/can.ejs.js @@ -1,8 +1,8 @@ /*! - * CanJS - 2.0.3 + * CanJS - 2.0.4 * http://canjs.us/ * Copyright (c) 2013 Bitovi - * Thu, 19 Dec 2013 10:56:42 GMT + * Mon, 23 Dec 2013 19:49:28 GMT * Licensed MIT * Includes: can/view/ejs * Download from: http://canjs.com diff --git a/assets/js/libs/can.jquery.js b/assets/js/libs/can.jquery.js old mode 100644 new mode 100755 index 80ea2b2..be9d037 --- a/assets/js/libs/can.jquery.js +++ b/assets/js/libs/can.jquery.js @@ -1,8 +1,8 @@ /*! - * CanJS - 2.0.3 + * CanJS - 2.0.4 * http://canjs.us/ * Copyright (c) 2013 Bitovi - * Thu, 19 Dec 2013 10:56:41 GMT + * Mon, 23 Dec 2013 19:49:25 GMT * Licensed MIT * Includes: can/component,can/construct,can/map,can/list,can/observe,can/compute,can/model,can/view,can/control,can/route,can/control/route,can/view/mustache,can/view/bindings,can/view/live,can/view/scope,can/util/string * Download from: http://canjs.com @@ -30,7 +30,7 @@ return object._cid = (name || "") + (++cid) } } - can.VERSION = '2.0.3'; + can.VERSION = '2.0.4'; can.simpleExtend = function(d, s) { for (var prop in s) { @@ -58,6 +58,12 @@ } } } else if (elements.hasOwnProperty) { + if (can.Map && elements instanceof can.Map) { + can.__reading && can.__reading(elements, '__keys'); + elements = elements.__get() + } + + for (key in elements) { if (elements.hasOwnProperty(key)) { if (callback.call(context || elements[key], elements[key], key, elements) === false) { @@ -78,6 +84,8 @@ // Given a list of elements, check if they are in the dom, if they // are in the dom, trigger inserted on them. can.inserted = function(elems) { + // prevent mutations from changing the looping + elems = can.makeArray(elems); var inDocument = false, checked = false, children; @@ -96,8 +104,8 @@ } if (inDocument && elem.getElementsByTagName) { - can.trigger(elem, "inserted", [], false); children = can.makeArray(elem.getElementsByTagName("*")); + can.trigger(elem, "inserted", [], false); for (var j = 0, child; (child = children[j]) !== undefined; j++) { // Trigger the destroyed event @@ -356,6 +364,11 @@ } return this; + }, + proxy: function(fn, context) { + return function() { + return fn.apply(context, arguments) + } } }); @@ -1240,27 +1253,6 @@ // A map that temporarily houses a reference // to maps that have already been made for a plain ole JS object madeMap = null, - addToMap = function(obj, instance) { - var teardown = false; - if (!madeMap) { - teardown = true; - madeMap = {} - } - // record if it has a Cid before we add one - var hasCid = obj._cid; - var cid = can.cid(obj); - - // only update if there already isn't one - if (!madeMap[cid]) { - - madeMap[cid] = { - obj: obj, - instance: instance, - added: !hasCid - } - } - return teardown; - }, teardownMap = function() { for (var cid in madeMap) { if (madeMap[cid].added) { @@ -1273,6 +1265,7 @@ return madeMap && madeMap[obj._cid] && madeMap[obj._cid].instance }; + var Map = can.Map = can.Construct.extend({ setup: function() { @@ -1284,9 +1277,13 @@ if (!this.defaults) { this.defaults = {}; } + // a list of the compute properties + this._computes = []; for (var prop in this.prototype) { if (typeof this.prototype[prop] !== "function") { this.defaults[prop] = this.prototype[prop]; + } else if (this.prototype[prop].isComputed) { + this._computes.push(prop) } } } @@ -1298,6 +1295,7 @@ } }, + _computes: [], // keep so it can be overwritten bind: can.bindAndSetup, on: can.bindAndSetup, @@ -1305,6 +1303,28 @@ off: can.unbindAndTeardown, id: "id", helpers: { + addToMap: function(obj, instance) { + var teardown; + if (!madeMap) { + teardown = teardownMap; + madeMap = {} + } + // record if it has a Cid before we add one + var hasCid = obj._cid; + var cid = can.cid(obj); + + // only update if there already isn't one + if (!madeMap[cid]) { + + madeMap[cid] = { + obj: obj, + instance: instance, + added: !hasCid + } + } + return teardown; + }, + canMakeObserve: function(obj) { return obj && !can.isDeferred(obj) && (can.isArray(obj) || can.isPlainObject(obj) || (obj instanceof can.Map)); }, @@ -1388,30 +1408,28 @@ // Sets all `attrs`. this._init = 1; this._setupComputes(); - var teardownMapping = obj && addToMap(obj, this); + var teardownMapping = obj && can.Map.helpers.addToMap(obj, this); var data = can.extend(can.extend(true, {}, this.constructor.defaults || {}), obj) this.attr(data); - if (teardownMapping) { - teardownMap() - } + + teardownMapping && teardownMapping() + this.bind('change', can.proxy(this._changes, this)); delete this._init; }, _setupComputes: function() { - var prototype = this.constructor.prototype; - this._computedBindings = {} - for (var prop in prototype) { - if (prototype[prop] && prototype[prop].isComputed) { - this[prop] = prototype[prop].clone(this); - this._computedBindings[prop] = { - count: 0 - } + var computes = this.constructor._computes; + this._computedBindings = {}; + for (var i = 0, len = computes.length, prop; i < len; i++) { + prop = computes[i]; + this[prop] = this[prop].clone(this); + this._computedBindings[prop] = { + count: 0 } } - }, _bindsetup: makeBindSetup(), _bindteardown: function() { @@ -1724,6 +1742,16 @@ // Helpers for `observable` lists. var splice = [].splice, + // test if splice works correctly + spliceRemovesProps = (function() { + // IE's splice doesn't remove properties + var obj = { + 0: "a", + length: 1 + }; + splice.call(obj, 0, 1); + return !obj[0]; + })(), list = Map( @@ -1738,11 +1766,18 @@ this.length = 0; can.cid(this, ".map") this._init = 1; + instances = instances || []; + + if (can.isDeferred(instances)) { this.replace(instances) } else { + var teardownMapping = instances.length && can.Map.helpers.addToMap(instances, this); this.push.apply(this, can.makeArray(instances || [])); } + + teardownMapping && teardownMapping(); + // this change needs to be ignored this.bind('change', can.proxy(this._changes, this)); can.simpleExtend(this, options); @@ -1803,6 +1838,13 @@ howMany = args[1] = this.length - index; } var removed = splice.apply(this, args); + + if (!spliceRemovesProps) { + for (var i = this.length; i < removed.length + this.length; i++) { + delete this[i] + } + } + can.batch.start(); if (howMany > 0) { this._triggerChange("" + index, "remove", undefined, removed); @@ -1977,7 +2019,6 @@ return this; } }); - can.List = Map.List = list; return can.List; })(__m2, __m12); @@ -3157,6 +3198,7 @@ // elements whos default value we should set defaultValue: ["input", "textarea"], // a map of parent element to child elements + tagMap: { "": "span", table: "tbody", @@ -3177,11 +3219,11 @@ th: "tr", li: "ul" }, - + // Used to determine the parentNode if el is directly within a documentFragment getParentNode: function(el, defaultParentNode) { return defaultParentNode && el.parentNode.nodeType === 11 ? defaultParentNode : el.parentNode; }, - // set an attribute on an element + // Set an attribute on an element setAttr: function(el, attrName, val) { var tagName = el.nodeName.toString().toLowerCase(), prop = elements.attrMap[attrName]; @@ -3200,14 +3242,14 @@ el.setAttribute(attrName, val); } }, - // gets the value of an attribute + // Gets the value of an attribute. getAttr: function(el, attrName) { // Default to a blank string for IE7/8 return (elements.attrMap[attrName] && el[elements.attrMap[attrName]] ? el[elements.attrMap[attrName]] : el.getAttribute(attrName)) || ''; }, - // removes the attribute + // Removes the attribute. removeAttr: function(el, attrName) { var setter = elements.attrMap[attrName]; if (typeof prop === "function") { @@ -3221,6 +3263,7 @@ el.removeAttribute(attrName); } }, + // Gets a "pretty" value for something contentText: function(text) { if (typeof text == 'string') { return text; @@ -3230,9 +3273,25 @@ return ''; } return "" + text; + }, + + after: function(oldElements, newFrag) { + var last = oldElements[oldElements.length - 1]; + + // Insert it in the `document` or `documentFragment` + if (last.nextSibling) { + can.insertBefore(last.parentNode, newFrag, last.nextSibling) + } else { + can.appendChild(last.parentNode, newFrag); + } + }, + + replace: function(oldElements, newFrag) { + elements.after(oldElements, newFrag); + can.remove(can.$(oldElements)); } }; - + // TODO: this doesn't seem to be doing anything // feature detect if setAttribute works with styles (function() { // feature detect if @@ -3412,12 +3471,14 @@ fn(el); }); - var helperTags = hookupOptions.options.read('helpers._tags', {}).value, - tagName = hookupOptions.tagName, - tagCallback = (helperTags && helperTags[tagName]) || Scanner.tags[tagName] + var tagName = hookupOptions.tagName, + helperTagCallback = hookupOptions.options.read('helpers._tags.' + tagName, { + isArgument: true, + proxyMethods: false + }).value, + tagCallback = helperTagCallback || Scanner.tags[tagName]; - - // if this was an element like that doesn't have a component, just render its content + // If this was an element like that doesn't have a component, just render its content var scope = hookupOptions.scope, res = tagCallback ? tagCallback(el, hookupOptions) : scope; @@ -3707,7 +3768,10 @@ default: // Track the current tag if (lastToken === '<') { - tagName = token.split(/\s|!--/)[0]; + + tagName = token.substr(0, 3) === "!--" ? + "!--" : token.split(/\s/)[0]; + var isClosingTag = false; if (tagName.indexOf("/") === 0) { @@ -3905,10 +3969,11 @@ return Scanner; })(__m19, __m21); - // ## view/node_lists.js + // ## view/node_lists/node_lists.js var __m24 = (function(can) { - // text node expando test + // In some browsers, text nodes can not take expando properties. + // We test that here. var canExpando = true; try { document.createTextNode('')._ = 0; @@ -3916,12 +3981,10 @@ canExpando = false; } - // a mapping of element ids to nodeList ids + // A mapping of element ids to nodeList id var nodeMap = {}, - // a mapping of ids to text nodes + // A mapping of ids to text nodes textNodeMap = {}, - // a mapping of nodeList ids to nodeList - nodeListMap = {}, expando = "ejs_" + Math.random(), _id = 0, id = function(node) { @@ -3942,98 +4005,90 @@ return "text_" + _id; } }, - // removes a nodeListId from a node's nodeListIds - removeNodeListId = function(node, nodeListId) { - var nodeListIds = nodeMap[id(node)]; - if (nodeListIds) { - var index = can.inArray(nodeListId, nodeListIds); + splice = [].splice; - if (index >= 0) { - nodeListIds.splice(index, 1); - } - if (!nodeListIds.length) { - delete nodeMap[id(node)]; - } - } - }, - addNodeListId = function(node, nodeListId) { - var nodeListIds = nodeMap[id(node)]; - if (!nodeListIds) { - nodeListIds = nodeMap[id(node)] = []; - } - nodeListIds.push(nodeListId); - }; var nodeLists = { id: id, - // replaces the contents of one node list with the nodes in another list - replace: function(oldNodeList, newNodes) { - // for each node in the node list - oldNodeList = can.makeArray(oldNodeList); - - // try every set - //can.each( oldNodeList, function(node){ - var node = oldNodeList[0] - // for each nodeList the node is in - can.each(can.makeArray(nodeMap[id(node)]), function(nodeListId) { - - // if startNode to endNode is - // within list, replace that list - // I think the problem is not the WHOLE part is being - // matched - var nodeList = nodeListMap[nodeListId], - startIndex = can.inArray(node, nodeList), - endIndex = can.inArray(oldNodeList[oldNodeList.length - 1], nodeList); - // remove this nodeListId from each node - if (startIndex >= 0 && endIndex >= 0) { - for (var i = startIndex; i <= endIndex; i++) { - var n = nodeList[i]; - removeNodeListId(n, nodeListId); - } - // swap in new nodes into the nodeLIst - nodeList.splice.apply(nodeList, [startIndex, endIndex - startIndex + 1].concat(newNodes)); + update: function(nodeList, newNodes) { + // Unregister all childNodes. + can.each(nodeList.childNodeLists, function(nodeList) { + nodeLists.unregister(nodeList) + }) + nodeList.childNodeLists = []; - // tell these new nodes they belong to the nodeList - can.each(newNodes, function(node) { - addNodeListId(node, nodeListId); - }); - } else { - nodeLists.unregister(nodeList); + // Remove old node pointers to this list. + can.each(nodeList, function(node) { + delete nodeMap[id(node)]; + }); + + var newNodes = can.makeArray(newNodes); + + // indicate the new nodes belong to this list + can.each(newNodes, function(node) { + nodeMap[id(node)] = nodeList; + }); + + + var oldListLength = nodeList.length, + firstNode = nodeList[0]; + // Replace oldNodeLists's contents' + splice.apply(nodeList, [0, oldListLength].concat(newNodes)); + + // update all parent nodes so they are able to replace the correct elements + var parentNodeList = nodeList; + while (parentNodeList = parentNodeList.parentNodeList) { + splice.apply(parentNodeList, [can.inArray(firstNode, parentNodeList), oldListLength].concat(newNodes)); + } + + + }, + + register: function(nodeList, unregistered, parent) { + + // add an id to the nodeList + nodeList.unregistered = unregistered, + + nodeList.childNodeLists = []; + + if (!parent) { + // find the parent by looking up where this node is + if (nodeList.length > 1) { + throw "does not work" } - }); - //}); - }, - // registers a list of nodes - register: function(nodeList) { - var nLId = id(nodeList); - nodeListMap[nLId] = nodeList; - - can.each(nodeList, function(node) { - addNodeListId(node, nLId); - }); + var nodeId = id(nodeList[0]); + parent = nodeMap[nodeId]; + } + nodeList.parentNodeList = parent; + parent && parent.childNodeLists.push(nodeList); + return nodeList; }, - // removes mappings + // removes node in all parent nodes and unregisters all childNodes + unregister: function(nodeList) { - var nLId = id(nodeList); - can.each(nodeList, function(node) { - removeNodeListId(node, nLId); - }); - delete nodeListMap[nLId]; + if (!nodeList.isUnregistered) { + nodeList.isUnregistered = true; + // unregister all childNodeLists + delete nodeList.parentNodeList; + can.each(nodeList, function(node) { + var nodeId = id(node); + delete nodeMap[nodeId] + }); + // this can unbind which will call itself + nodeList.unregistered && nodeList.unregistered(); + can.each(nodeList.childNodeLists, function(nodeList) { + nodeLists.unregister(nodeList) + }); + } }, nodeMap: nodeMap, - nodeListMap: nodeListMap - } - var ids = function(nodeList) { - return nodeList.map(function(n) { - return id(n) + ":" + (n.innerHTML || n.nodeValue) - }) } return nodeLists; - })(__m2); + })(__m2, __m21); // ## view/live/live.js var __m23 = (function(can, elements, view, nodeLists) { @@ -4048,12 +4103,21 @@ // `setup(HTMLElement, bind(data), unbind(data)) -> data` // Calls bind right away, but will call unbind // if the element is "destroyed" (removed from the DOM). + var setupCount = 0; var setup = function(el, bind, unbind) { - var teardown = function() { - unbind(data) - can.unbind.call(el, 'removed', teardown); - return true - }, + // Removing an element can call teardown which + // unregister the nodeList which calls teardown + var tornDown = false, + teardown = function() { + if (!tornDown) { + tornDown = true; + unbind(data) + can.unbind.call(el, 'removed', teardown); + + } + + return true + }, data = { // returns true if no parent teardownCheck: function(parent) { @@ -4083,65 +4147,82 @@ getAttributeParts = function(newVal) { return (newVal || "").replace(/['"]/g, '').split('=') }, - // #### insertElementsAfter - // Appends elements after the last item in oldElements. - insertElementsAfter = function(oldElements, newFrag) { - var last = oldElements[oldElements.length - 1]; + splice = [].splice; - // Insert it in the `document` or `documentFragment` - if (last.nextSibling) { - can.insertBefore(last.parentNode, newFrag, last.nextSibling) - } else { - can.appendChild(last.parentNode, newFrag); - } - }; var live = { - nodeLists: nodeLists, - list: function(el, compute, func, context, parentNode) { - // A mapping of the index to an array - // of elements that represent the item. - // Each array is registered so child or parent - // live structures can update the elements - var nodesMap = [], - // called when an item is added + list: function(el, compute, render, context, parentNode) { + + + // A nodeList of all elements this live-list manages. + // This is here so that if this live list is within another section + // that section is able to remove the items in this list. + var masterNodeList = [el], + // A mapping of the index of an item to an array + // of elements that represent the item. + // Each array is registered so child or parent + // live structures can update the elements. + itemIndexToNodeListsMap = [], + // A mapping of items to their indicies' + indexMap = [], + + // Called when items are added to the list. add = function(ev, items, index) { - // check that the placeholder textNode still has a parent. - // it's possible someone removed the contents of - // this element without removing the parent - if (data.teardownCheck(text.parentNode)) { - return - } // Collect new html and mappings var frag = document.createDocumentFragment(), - newMappings = []; - can.each(items, function(item, key) { - var itemHTML = func.call(context, item, (key + index)), - itemFrag = can.view.frag(itemHTML, parentNode); + newNodeLists = [], + newIndicies = []; - newMappings.push(can.makeArray(itemFrag.childNodes)); - frag.appendChild(itemFrag); + // For each new item, + can.each(items, function(item, key) { + + var itemIndex = can.compute(key + index), + // get its string content + itemHTML = render.call(context, item, itemIndex), + // and convert it into elements. + itemFrag = can.view.fragment(itemHTML) + + + // Add those elements to the mappings. + newNodeLists.push( + // Register those nodes with nodeLists. + nodeLists.register(can.makeArray(itemFrag.childNodes), undefined, masterNodeList)); + + // Hookup the fragment (which sets up child live-bindings) and + // add it to the collection of all added elements. + frag.appendChild(can.view.hookup(itemFrag)); + newIndicies.push(itemIndex) }) - // Inserting at the end of the list - if (!nodesMap[index]) { - insertElementsAfter( - index == 0 ? [text] : - nodesMap[index - 1], frag) + // Check if we are adding items at the end + if (!itemIndexToNodeListsMap[index]) { + + elements.after( + // If we are adding items to an empty list + index == 0 ? + // add those items after the placeholder text element. + [text] : + // otherwise, add them after the last element in the previous index. + itemIndexToNodeListsMap[index - 1], frag) } else { - var el = nodesMap[index][0]; + // Add elements before the next index's first element. + var el = itemIndexToNodeListsMap[index][0]; can.insertBefore(el.parentNode, frag, el); } - // register each item - can.each(newMappings, function(nodeList) { - nodeLists.register(nodeList) - }); - [].splice.apply(nodesMap, [index, 0].concat(newMappings)); + + splice.apply(itemIndexToNodeListsMap, [index, 0].concat(newNodeLists)); + + // update indices after insert point + splice.apply(indexMap, [index, 0].concat(newIndicies)); + for (var i = index + newIndicies.length, len = indexMap.length; i < len; i++) { + indexMap[i](i) + } + }, - // Remove can be called during teardown or when items are - // removed from the element. + + // Called when items are removed or when the bindings are torn down. remove = function(ev, items, index, duringTeardown) { // If this is because an element was removed, we should @@ -4151,61 +4232,72 @@ return } - var removedMappings = nodesMap.splice(index, items.length), + var removedMappings = itemIndexToNodeListsMap.splice(index, items.length), itemsToRemove = []; can.each(removedMappings, function(nodeList) { // add items that we will remove all at once [].push.apply(itemsToRemove, nodeList) // Update any parent lists to remove these items - nodeLists.replace(nodeList, []); + nodeLists.update(nodeList, []); // unregister the list nodeLists.unregister(nodeList); }); + // update indices after remove point + indexMap.splice(index, items.length) + for (var i = index, len = indexMap.length; i < len; i++) { + indexMap[i](i) + } + can.remove(can.$(itemsToRemove)); }, parentNode = elements.getParentNode(el, parentNode), text = document.createTextNode(""), - list; + // The current list. + list, - var teardownList = function() { - // there might be no list right away, and the list might be a plain - // array - list && list.unbind && list.unbind("add", add).unbind("remove", remove); - // use remove to clean stuff up for us - remove({}, { - length: nodesMap.length - }, 0, true); - } + // Called when the list is replaced with a new list or the binding is torn-down. + teardownList = function() { + // there might be no list right away, and the list might be a plain + // array + list && list.unbind && list.unbind("add", add).unbind("remove", remove); + // use remove to clean stuff up for us + remove({}, { + length: itemIndexToNodeListsMap.length + }, 0, true); + }, + // Called when the list is replaced or setup. + updateList = function(ev, newList, oldList) { + teardownList(); + // make an empty list if the compute returns null or undefined + list = newList || []; + // list might be a plain array + list.bind && list.bind("add", add).bind("remove", remove); + add({}, list, 0); + } - var updateList = function(ev, newList, oldList) { - teardownList(); - // make an empty list if the compute returns null or undefined - list = newList || []; - // list might be a plain array - list.bind && list.bind("add", add).bind("remove", remove); - add({}, list, 0); - } - insertElementsAfter([el], text); - can.remove(can.$(el)); - // Setup binding and teardown to add and remove events + // Setup binding and teardown to add and remove events var data = setup(parentNode, function() { can.isFunction(compute) && compute.bind("change", updateList) }, function() { can.isFunction(compute) && compute.unbind("change", updateList) teardownList() - }) + }); + live.replace(masterNodeList, text, data.teardownCheck) + + // run the list setup updateList({}, can.isFunction(compute) ? compute() : compute) }, + html: function(el, compute, parentNode) { var parentNode = elements.getParentNode(el, parentNode), - data = listen(parentNode, compute, function(ev, newVal, oldVal) { + // TODO: remove teardownCheck in 2.1 var attached = nodes[0].parentNode; // update the nodes in the DOM with the new rendered value if (attached) { @@ -4214,37 +4306,52 @@ data.teardownCheck(nodes[0].parentNode); }); - var nodes, + var nodes = [el], makeAndPut = function(val) { - // create the fragment, but don't hook it up - // we need to insert it into the document first - var frag = can.view.frag(val, parentNode), - // keep a reference to each node - newNodes = can.makeArray(frag.childNodes); - // Insert it in the `document` or `documentFragment` - insertElementsAfter(nodes || [el], frag) - // nodes hasn't been set yet - if (!nodes) { - can.remove(can.$(el)); - nodes = newNodes; - // set the teardown nodeList - data.nodeList = nodes; - nodeLists.register(nodes); - } else { - // Update node Array's to point to new nodes - // and then remove the old nodes. - // It has to be in this order for Mootools - // and IE because somehow, after an element - // is removed from the DOM, it loses its - // expando values. - var nodesToRemove = can.makeArray(nodes); - nodeLists.replace(nodes, newNodes); - can.remove(can.$(nodesToRemove)); - } + var frag = can.view.fragment("" + val), + oldNodes = can.makeArray(nodes); + + // We need to mark each node as belonging to the node list. + nodeLists.update(nodes, frag.childNodes) + + frag = can.view.hookup(frag, parentNode) + + elements.replace(oldNodes, frag) }; - makeAndPut(compute(), [el]); + + data.nodeList = nodes; + // register the span so nodeLists knows the parentNodeList + nodeLists.register(nodes, data.teardownCheck) + makeAndPut(compute()); }, + + replace: function(nodes, val, teardown) { + var oldNodes = nodes.slice(0), + frag; + + nodeLists.register(nodes, teardown); + if (typeof val === "string") { + frag = can.view.fragment(val) + } else if (val.nodeType !== 11) { + frag = document.createDocumentFragment(); + frag.appendChild(val) + } else { + frag = val; + } + + // We need to mark each node as belonging to the node list. + nodeLists.update(nodes, frag.childNodes) + + if (typeof val === "string") { + // if it was a string, check for hookups + frag = can.view.hookup(frag, nodes[0].parentNode); + } + elements.replace(oldNodes, frag); + + return nodes; + }, + text: function(el, compute, parentNode) { var parent = elements.getParentNode(el, parentNode); @@ -4254,20 +4361,16 @@ if (typeof node.nodeValue != 'unknown') { node.nodeValue = "" + newVal; } + // TODO: remove in 2.1 data.teardownCheck(node.parentNode); - }); + }), + // The text node that will be updated + node = document.createTextNode(compute()); - var node = document.createTextNode(compute()); - - if (el.parentNode !== parent) { - parent = el.parentNode; - parent.insertBefore(node, el); - parent.removeChild(el); - } else { - parent.insertBefore(node, el); - parent.removeChild(el); - } + // Replace the placeholder with the live node and do the nodeLists thing. + live.replace([el], node, data.teardownCheck); }, + attributes: function(el, compute, currentValue) { var setAttrs = function(newVal) { var parts = getAttributeParts(newVal), @@ -4372,6 +4475,8 @@ return /^["'].*["']$/.test(val) ? val.substr(1, val.length - 2) : val } can.view.live = live; + can.view.nodeLists = nodeLists; + can.view.elements = elements; return live; })(__m2, __m21, __m19, __m24); @@ -4538,6 +4643,7 @@ } if (listData) { + unbind && unbind(); return "<" + tag + can.view.hook(function(el, parentNode) { live.list(el, listData.list, listData.renderer, self, parentNode); }) + ">"; @@ -4558,7 +4664,8 @@ if (status === 0 && !contentProp) { // Return an element tag with a hookup in place of the content return "<" + tag + can.view.hook( - escape ? + // if value is an object, it's likely something returned by .safeString + escape && typeof value != "object" ? // If we are escaping, replace the parentNode with // a text node who's value is `func`'s return value. @@ -5443,25 +5550,23 @@ // Implements the `each` built-in helper. 'each': function(expr, options) { - if (!expr) { - return; - } + // Check if this is a list or a compute that resolves to a list, and setup + // the incremental live-binding - if (expr.isComputed || isObserveLike(expr) && typeof expr.attr('length') !== 'undefined') { - return can.view.lists && can.view.lists(expr, function(item, key) { - // Create a compute that listens to whenever the index of the item in our list changes. - var index = function() { - var exprResolved = Mustache.resolve(expr), - fromIndex = key < (exprResolved).attr('length') ? key : undefined; - return (exprResolved).indexOf(item, fromIndex); - }; + // First, see what we are dealing with. It's ok to read the compute + // because can.view.text is only temporarily binding to what is going on here. + // Calling can.view.lists prevents anything from listening on that compute. + var resolved = Mustache.resolve(expr); + + if (resolved instanceof can.List) { + return can.view.lists && can.view.lists(expr, function(item, index) { return options.fn(options.scope.add({ "@index": index }).add(item)); }); } - expr = Mustache.resolve(expr); + expr = resolved; if ( !! expr && isArrayLike(expr)) { var result = []; @@ -5888,6 +5993,9 @@ scope: this.scope }); + + var self = this; + // if this component has a template (that we've already converted to a renderer) if (this.constructor.renderer) { // add content to tags @@ -5899,15 +6007,33 @@ helpers._tags.content = function(el, rendererOptions) { // first check if there was content within the custom tag // otherwise, render what was within , the default code - var subtemplate = hookupOptions.subtemplate || rendererOptions.subtemplate + var subtemplate = hookupOptions.subtemplate || rendererOptions.subtemplate; + if (subtemplate) { - var frag = can.view.frag(subtemplate(rendererOptions.scope, rendererOptions.options.add(helpers))); - can.insertBefore(el.parentNode, frag, el); - can.remove(can.$(el)); + + + // rendererOptions.options is a scope of helpers where `` was found, so + // the right helpers should already be available. + // However, _tags.content is going to point to this current content callback. We need to + // remove that so it will walk up the chain + + delete helpers._tags.content; + + can.view.live.replace([el], subtemplate( + // This is the context of where `` was found + // which will have the the component's context + rendererOptions.scope, + + + + rendererOptions.options)); + + // restore the content tag so it could potentially be used again (as in lists) + helpers._tags.content = arguments.callee; } } // render the component's template - var frag = this.constructor.renderer(renderedScope, helpers); + var frag = this.constructor.renderer(renderedScope, hookupOptions.options.add(helpers)); } else { // otherwise render the contents between the var frag = can.view.frag(hookupOptions.subtemplate ? hookupOptions.subtemplate(renderedScope, hookupOptions.options.add(helpers)) : ""); @@ -6948,4 +7074,4 @@ })(__m2, __m27, __m8); window['can'] = __m4; -})(); \ No newline at end of file +})(); diff --git a/assets/js/libs/can.jquery.min.js b/assets/js/libs/can.jquery.min.js index 1bc4c8e..3870f17 100755 --- a/assets/js/libs/can.jquery.min.js +++ b/assets/js/libs/can.jquery.min.js @@ -1,12 +1,12 @@ /*! - * CanJS - 2.0.3 + * CanJS - 2.0.4 * http://canjs.us/ * Copyright (c) 2013 Bitovi - * Thu, 19 Dec 2013 10:56:35 GMT + * Mon, 23 Dec 2013 19:49:14 GMT * Licensed MIT * Includes: CanJS default build * Download from: http://canjs.us/ */ -!function(undefined){var __m4=function(){var a=window.can||{};("undefined"==typeof GLOBALCAN||GLOBALCAN!==!1)&&(window.can=a),a.isDeferred=function(a){var b=this.isFunction;return a&&b(a.then)&&b(a.pipe)};var b=0;return a.cid=function(a,c){return a._cid?a._cid:a._cid=(c||"")+ ++b},a.VERSION="2.0.3",a.simpleExtend=function(a,b){for(var c in b)a[c]=b[c];return a},a}(),__m5=function(a){return a.each=function(a,b,c){var d,e=0;if(a)if("number"==typeof a.length&&a.pop)for(a.attr&&a.attr("length"),d=a.length;d>e&&b.call(c||a[e],a[e],e,a)!==!1;e++);else if(a.hasOwnProperty)for(d in a)if(a.hasOwnProperty(d)&&b.call(c||a[d],a[d],d,a)===!1)break;return a},a}(__m4),__m6=function(a){a.inserted=function(b){for(var c,d,e=!1,f=0;(d=b[f])!==undefined;f++){if(!e){if(!d.getElementsByTagName)continue;if(!a.has(a.$(document),d).length)return;e=!0}if(e&&d.getElementsByTagName){a.trigger(d,"inserted",[],!1),c=a.makeArray(d.getElementsByTagName("*"));for(var g,h=0;(g=c[h])!==undefined;h++)a.trigger(g,"inserted",[],!1)}}},a.appendChild=function(b,c){if(11===c.nodeType)var d=a.makeArray(c.childNodes);else var d=[c];b.appendChild(c),a.inserted(d)},a.insertBefore=function(b,c,d){if(11===c.nodeType)var e=a.makeArray(c.childNodes);else var e=[c];b.insertBefore(c,d),a.inserted(e)}}(__m4),__m7=function(a){return a.addEvent=function(a,b){var c=this.__bindEvents||(this.__bindEvents={}),d=c[a]||(c[a]=[]);return d.push({handler:b,name:a}),this},a.listenTo=function(b,c,d){var e=this.__listenToEvents;e||(e=this.__listenToEvents={});var f=a.cid(b),g=e[f];g||(g=e[f]={obj:b,events:{}});var h=g.events[c];h||(h=g.events[c]=[]),h.push(d),a.bind.call(b,c,d)},a.stopListening=function(b,c,d){var e=this.__listenToEvents,f=e,g=0;if(!e)return this;if(b){var h=a.cid(b);if((f={})[h]=e[h],!e[h])return this}for(var i in f){var j,k=f[i];b=e[i].obj,c?(j={})[c]=k.events[c]:j=k.events;for(var l in j){var m=j[l]||[];for(g=0;gf;f++)c=e[f],c.handler.apply(this,b)}},a}(__m4),__m2=function(a,b){var c=function(a){return a.nodeName&&(1==a.nodeType||9==a.nodeType)||a==window};a.extend(b,a,{trigger:function(c,d,e){c.nodeName||c===window?a.event.trigger(d,e,c,!0):c.trigger?c.trigger(d,e):("string"==typeof d&&(d={type:d}),d.target=d.target||c,b.dispatch.call(c,d,e))},addEvent:b.addEvent,removeEvent:b.removeEvent,buildFragment:function(b,c){var d,e=a.buildFragment;return b=[b],c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d=e.call(jQuery,b,c),d.cacheable?a.clone(d.fragment):d.fragment||d},$:a,each:b.each,bind:function(d,e){return this.bind&&this.bind!==b.bind?this.bind(d,e):c(this)?a.event.add(this,d,e):b.addEvent.call(this,d,e),this},unbind:function(d,e){return this.unbind&&this.unbind!==b.unbind?this.unbind(d,e):c(this)?a.event.remove(this,d,e):b.removeEvent.call(this,d,e),this},delegate:function(b,d,e){return this.delegate?this.delegate(b,d,e):c(this)&&a(this).delegate(b,d,e),this},undelegate:function(b,d,e){return this.undelegate?this.undelegate(b,d,e):c(this)&&a(this).undelegate(b,d,e),this}}),b.on=b.bind,b.off=b.unbind,a.each(["append","filter","addClass","remove","data","get","has"],function(a,c){b[c]=function(a){return a[c].apply(a,b.makeArray(arguments).slice(1))}});var d=a.cleanData;a.cleanData=function(c){a.each(c,function(a,c){c&&b.trigger(c,"removed",[],!1)}),d(c)};var e,f=a.fn.domManip;return a.fn.domManip=function(){for(var a=1;a/g,">").replace(h,""").replace(i,"'")},getObject:function(b,c,d){var e,f,g,h,i=b?b.split("."):[],j=i.length,k=0;if(c=a.isArray(c)?c:[c||window],h=c.length,!j)return c[0];for(k;h>k;k++){for(e=c[k],g=undefined,f=0;j>f&&m(e);f++)g=e,e=l(g,i[f]);if(g!==undefined&&e!==undefined)break}if(d===!1&&e!==undefined&&delete g[i[f-1]],d===!0&&e===undefined)for(e=c[0],f=0;j>f&&m(e);f++)e=l(e,i[f],!0);return e},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},camelize:function(a){return n(a).replace(j,function(a,b){return b?b.toUpperCase():""})},hyphenate:function(a){return n(a).replace(k,function(a){return a.charAt(0)+"-"+a.charAt(1).toLowerCase()})},underscore:function(a){return a.replace(c,"/").replace(d,"$1_$2").replace(e,"$1_$2").replace(f,"_").toLowerCase()},sub:function(b,c,d){var e=[];return b=b||"",e.push(b.replace(g,function(b,f){var g=a.getObject(f,c,d===!0?!1:undefined);return g===undefined||null===g?(e=null,""):m(g)&&e?(e.push(g),""):""+g})),null===e?e:e.length<=1?e[0]:e},replacer:g,undHash:b}),a}(__m2),__m9=function(a){var b=0;return a.Construct=function(){return arguments.length?a.Construct.extend.apply(a.Construct,arguments):void 0},a.extend(a.Construct,{constructorExtends:!0,newInstance:function(){var a,b=this.instance();return b.setup&&(a=b.setup.apply(b,arguments)),b.init&&b.init.apply(b,a||arguments),b},_inherit:function(b,c,d){a.extend(d||b,b||{})},_overwrite:function(a,b,c,d){a[c]=d},setup:function(b){this.defaults=a.extend(!0,{},b.defaults,this.defaults)},instance:function(){b=1;var a=new this;return b=0,a},extend:function(c,d,e){function f(){return b?void 0:this.constructor!==f&&arguments.length&&f.constructorExtends?arguments.callee.extend.apply(arguments.callee,arguments):f.newInstance.apply(f,arguments)}"string"!=typeof c&&(e=d,d=c,c=null),e||(e=d,d=null),e=e||{};var g,h,i,j,k=this,l=this.prototype;j=this.instance(),a.Construct._inherit(e,l,j);for(g in k)k.hasOwnProperty(g)&&(f[g]=k[g]);if(a.Construct._inherit(d,k,f),c){var m=c.split("."),h=m.pop(),n=a.getObject(m.join("."),window,!0),i=n,o=a.underscore(c.replace(/\./g,"_")),p=a.underscore(h);n[h]=f}a.extend(f,{constructor:f,prototype:j,namespace:i,_shortName:p,fullName:c,_fullName:o}),h!==undefined&&(f.shortName=h),f.prototype.constructor=f;var q=[k].concat(a.makeArray(arguments)),r=f.setup.apply(f,q);return f.init&&f.init.apply(f,r||q),f}}),a.Construct.prototype.setup=function(){},a.Construct.prototype.init=function(){},a.Construct}(__m10),__m8=function(a){var b,c=function(b,c,d){return a.bind.call(b,c,d),function(){a.unbind.call(b,c,d)}},d=a.isFunction,e=a.extend,f=a.each,g=[].slice,h=/\{([^\}]+)\}/g,i=a.getObject("$.event.special",[a])||{},j=function(b,c,d,e){return a.delegate.call(b,c,d,e),function(){a.undelegate.call(b,c,d,e)}},k=function(b,d,e,f){return f?j(b,a.trim(f),d,e):c(b,d,e)},l=a.Control=a.Construct({setup:function(){if(a.Construct.setup.apply(this,arguments),a.Control){var b,c=this;c.actions={};for(b in c.prototype)c._isAction(b)&&(c.actions[b]=c._action(b))}},_shifter:function(b,c){var e="string"==typeof c?b[c]:c;return d(e)||(e=b[e]),function(){return b.called=c,e.apply(b,[this.nodeName?a.$(this):this].concat(g.call(arguments,0)))}},_isAction:function(a){var b=this.prototype[a],c=typeof b;return"constructor"!==a&&("function"==c||"string"==c&&d(this.prototype[b]))&&!!(i[a]||m[a]||/[^\w]/.test(a))},_action:function(c,d){if(h.lastIndex=0,d||!h.test(c)){var e=d?a.sub(c,this._lookup(d)):c;if(!e)return null;var f=a.isArray(e),g=f?e[1]:e,i=g.split(/\s+/g),j=i.pop();return{processor:m[j]||b,parts:[g,i.join(" "),j],delegate:f?e[0]:undefined}}},_lookup:function(a){return[a,window]},processors:{},defaults:{}},{setup:function(b,c){var d,f=this.constructor,g=f.pluginName||f._fullName;return this.element=a.$(b),g&&"can_control"!==g&&this.element.addClass(g),(d=a.data(this.element,"controls"))||a.data(this.element,"controls",d=[]),d.push(this),this.options=e({},f.defaults,c),this.on(),[this.element,this.options]},on:function(b,c,d,e){if(!b){this.off();var f,g,h=this.constructor,i=this._bindings,j=h.actions,l=this.element,m=a.Control._shifter(this,"destroy");for(f in j)j.hasOwnProperty(f)&&(g=j[f]||h._action(f,this.options))&&i.push(g.processor(g.delegate||l,g.parts[2],g.parts[1],f,this));return a.bind.call(l,"removed",m),i.push(function(b){a.unbind.call(b,"removed",m)}),i.length}return"string"==typeof b&&(e=d,d=c,c=b,b=this.element),e===undefined&&(e=d,d=c,c=null),"string"==typeof e&&(e=a.Control._shifter(this,e)),this._bindings.push(k(b,d,e,c)),this._bindings.length},off:function(){var a=this.element[0];f(this._bindings||[],function(b){b(a)}),this._bindings=[]},destroy:function(){if(null!==this.element){var b,c=this.constructor,d=c.pluginName||c._fullName;this.off(),d&&"can_control"!==d&&this.element.removeClass(d),b=a.data(this.element,"controls"),b.splice(a.inArray(this,b),1),a.trigger(this,"destroyed"),this.element=null}}}),m=a.Control.processors,b=function(b,c,d,e,f){return k(b,c,a.Control._shifter(f,e),d)};return f(["change","click","contextmenu","dblclick","keydown","keyup","keypress","mousedown","mousemove","mouseout","mouseover","mouseup","reset","resize","scroll","select","submit","focusin","focusout","mouseenter","mouseleave","touchstart","touchmove","touchcancel","touchend","touchleave"],function(a){m[a]=b}),l}(__m2,__m9),__m13=function(a){return a.bindAndSetup=function(){return a.addEvent.apply(this,arguments),this._init||(this._bindings?this._bindings++:(this._bindings=1,this._bindsetup&&this._bindsetup())),this},a.unbindAndTeardown=function(){return a.removeEvent.apply(this,arguments),null==this._bindings?this._bindings=0:this._bindings--,this._bindings||this._bindteardown&&this._bindteardown(),this},a}(__m2),__m14=function(a){var b=1,c=0,d=[],e=[];a.batch={start:function(a){c++,a&&e.push(a)},stop:function(f,g){if(f?c=0:c--,0==c){var h=d.slice(0),i=e.slice(0);d=[],e=[],b++,g&&a.batch.start(),a.each(h,function(b){a.trigger.apply(a,b)}),a.each(i,function(a){a()})}},trigger:function(e,f,g){if(!e._init){if(0==c)return a.trigger(e,f,g);f="string"==typeof f?{type:f}:f,f.batchNum=b,d.push([e,f,g])}}}}(__m4),__m12=function(a){var b=function(b,c,d){a.listenTo.call(d,b,"change",function(){var e=a.makeArray(arguments),f=e.shift();e[0]=("*"===c?[d.indexOf(b),e[0]]:[c,e[0]]).join("."),f.triggeredNS=f.triggeredNS||{},f.triggeredNS[d._cid]||(f.triggeredNS[d._cid]=!0,a.trigger(d,f,e))})},c=function(b,c){return c?[b]:a.isArray(b)?b:(""+b).split(".")},d=function(a){return function(){var c=this;this._each(function(d,e){d&&d.bind&&b(d,a||e,c)})}},e=null,f=function(b,c){var d=!1;e||(d=!0,e={});var f=b._cid,g=a.cid(b);return e[g]||(e[g]={obj:b,instance:c,added:!f}),d},g=function(){for(var a in e)e[a].added&&delete e[a].obj._cid;e=null},h=function(a){return e&&e[a._cid]&&e[a._cid].instance},i=a.Map=a.Construct.extend({setup:function(){if(a.Construct.setup.apply(this,arguments),a.Map){this.defaults||(this.defaults={});for(var b in this.prototype)"function"!=typeof this.prototype[b]&&(this.defaults[b]=this.prototype[b])}!a.List||this.prototype instanceof a.List||(this.List=i.List({Map:this},{}))},bind:a.bindAndSetup,on:a.bindAndSetup,unbind:a.unbindAndTeardown,off:a.unbindAndTeardown,id:"id",helpers:{canMakeObserve:function(b){return b&&!a.isDeferred(b)&&(a.isArray(b)||a.isPlainObject(b)||b instanceof a.Map)},unhookup:function(b,c){return a.each(b,function(b){b&&b.unbind&&a.stopListening.call(c,b,"change")})},hookupBubble:function(c,d,e,f,g){return f=f||i,g=g||i.List,c instanceof i?e._bindings&&i.helpers.unhookup([c],e):c=a.isArray(c)?h(c)||new g(c):h(c)||new f(c),e._bindings&&b(c,d,e),c},serialize:function(b,c,d){return b.each(function(b,e){d[e]=i.helpers.canMakeObserve(b)&&a.isFunction(b[c])?b[c]():b}),d},makeBindSetup:d},keys:function(b){var c=[];a.__reading&&a.__reading(b,"__keys");for(var d in b._data)c.push(d);return c}},{setup:function(b){this._data={},a.cid(this,".map"),this._init=1,this._setupComputes();var c=b&&f(b,this),d=a.extend(a.extend(!0,{},this.constructor.defaults||{}),b);this.attr(d),c&&g(),this.bind("change",a.proxy(this._changes,this)),delete this._init},_setupComputes:function(){var a=this.constructor.prototype;this._computedBindings={};for(var b in a)a[b]&&a[b].isComputed&&(this[b]=a[b].clone(this),this._computedBindings[b]={count:0})},_bindsetup:d(),_bindteardown:function(){var a=this;this._each(function(b){i.helpers.unhookup([b],a)})},_changes:function(b,c,d,e,f){a.batch.trigger(this,{type:c,batchNum:b.batchNum},[e,f])},_triggerChange:function(){a.batch.trigger(this,"change",a.makeArray(arguments))},_each:function(a){var b=this.__get();for(var c in b)b.hasOwnProperty(c)&&a(b[c],c)},attr:function(b,c){var d=typeof b;return"string"!==d&&"number"!==d?this._attrs(b,c):1===arguments.length?(a.__reading&&a.__reading(this,b),this._get(b)):(this._set(b,c),this)},each:function(){return a.__reading&&a.__reading(this,"__keys"),a.each.apply(undefined,[this.__get()].concat(a.makeArray(arguments)))},removeAttr:function(b){var d=a.List&&this instanceof a.List,e=c(b),f=e.shift(),g=d?this[f]:this._data[f];return e.length?g.removeAttr(e):(d?this.splice(f,1):f in this._data&&(delete this._data[f],f in this.constructor.prototype||delete this[f],a.batch.trigger(this,"__keys"),this._triggerChange(f,"remove",undefined,g)),g)},_get:function(a){var b="string"==typeof a&&!!~a.indexOf(".")&&this.__get(a);if(b)return b;var d=c(a),e=this.__get(d.shift());return d.length?e?e._get(d):undefined:e},__get:function(b){return b?this[b]&&this[b].isComputed&&a.isFunction(this.constructor.prototype[b])?this[b]():this._data[b]:this._data},_set:function(a,b,d){var e=c(a,d),f=e.shift(),g=this.__get(f);if(i.helpers.canMakeObserve(g)&&e.length)g._set(e,b);else{if(e.length)throw"can.Map: Object does not exist";this.__convert&&(b=this.__convert(f,b)),this.__set(f,b,g)}},__set:function(b,c,d){if(c!==d){var e=this.__get().hasOwnProperty(b)?"set":"add";this.___set(b,i.helpers.canMakeObserve(c)?i.helpers.hookupBubble(c,b,this):c),"add"==e&&a.batch.trigger(this,"__keys",undefined),this._triggerChange(b,e,c,d),d&&i.helpers.unhookup([d],this)}},___set:function(b,c){this[b]&&this[b].isComputed&&a.isFunction(this.constructor.prototype[b])&&this[b](c),this._data[b]=c,a.isFunction(this.constructor.prototype[b])||(this[b]=c)},bind:function(b){var c=this._computedBindings&&this._computedBindings[b];if(c)if(c.count)c.count++;else{c.count=1;var d=this;c.handler=function(c,e,f){a.batch.trigger(d,{type:b,batchNum:c.batchNum},[e,f])},this[b].bind("change",c.handler)}return a.bindAndSetup.apply(this,arguments)},unbind:function(b){var c=this._computedBindings&&this._computedBindings[b];return c&&(1==c.count?(c.count=0,this[b].unbind("change",c.handler),delete c.handler):c.count++),a.unbindAndTeardown.apply(this,arguments)},serialize:function(){return a.Map.helpers.serialize(this,"serialize",{})},_attrs:function(b,c){if(b===undefined)return i.helpers.serialize(this,"attr",{});b=a.simpleExtend({},b);var d,e,f=this;a.batch.start(),this.each(function(d,g){if("_cid"!==g){if(e=b[g],e===undefined)return c&&f.removeAttr(g),void 0;f.__convert&&(e=f.__convert(g,e)),e instanceof a.Map?f.__set(g,e,d):i.helpers.canMakeObserve(d)&&i.helpers.canMakeObserve(e)&&d.attr?d.attr(e,c):d!=e&&f.__set(g,e,d),delete b[g]}});for(var d in b)"_cid"!==d&&(e=b[d],this._set(d,e,!0));return a.batch.stop(),this},compute:function(b){return a.isFunction(this.constructor.prototype[b])?a.compute(this[b],this):a.compute(this,b)}});return i.prototype.on=i.prototype.bind,i.prototype.off=i.prototype.unbind,i}(__m2,__m13,__m9,__m14),__m15=function(a,b){var c=[].splice,d=b({Map:b},{setup:function(b,c){this.length=0,a.cid(this,".map"),this._init=1,a.isDeferred(b)?this.replace(b):this.push.apply(this,a.makeArray(b||[])),this.bind("change",a.proxy(this._changes,this)),a.simpleExtend(this,c),delete this._init},_triggerChange:function(c,d,e,f){b.prototype._triggerChange.apply(this,arguments),~c.indexOf(".")||("add"===d?(a.batch.trigger(this,d,[e,+c]),a.batch.trigger(this,"length",[this.length])):"remove"===d?(a.batch.trigger(this,d,[f,+c]),a.batch.trigger(this,"length",[this.length])):a.batch.trigger(this,d,[e,+c]))},__get:function(a){return a?this[a]:this},___set:function(a,b){this[a]=b,+a>=this.length&&(this.length=+a+1)},_each:function(a){for(var b=this.__get(),c=0;c0&&(this._triggerChange(""+d,"remove",undefined,i),b.helpers.unhookup(i,this)),g.length>2&&this._triggerChange(""+d,"add",g.slice(2),i),a.batch.stop(),i},_attrs:function(c,d){return c===undefined?b.helpers.serialize(this,"attr",[]):(c=a.makeArray(c),a.batch.start(),this._updateAttrs(c,d),a.batch.stop(),void 0)},_updateAttrs:function(a,c){for(var d=Math.min(a.length,this.length),e=0;d>e;e++){var f=this[e],g=a[e];b.helpers.canMakeObserve(f)&&b.helpers.canMakeObserve(g)?f.attr(g,c):f!=g&&this._set(e,g)}a.length>this.length?this.push.apply(this,a.slice(this.length)):a.lengthj;j++)a=f[j],h[a.obj._cid+"|"+a.attr]?h[a.obj._cid+"|"+a.attr].matched=i:(h[a.obj._cid+"|"+a.attr]={matched:i,observe:a},a.obj.bind(a.attr,k));for(var m in h){var a=h[m];a.matched!==i&&(a.observe.obj.unbind(a.observe.attr,k),delete h[m])}return g};return j.value=l(),j.isListening=!a.isEmptyObject(h),j};a.compute=function(b,c,g){if(b&&b.isComputed)return b;var h,i,j,k,l={bound:!1,hasDependencies:!1},m=d,n=d,o=function(){return j},p=function(a){j=a},q=!0,r=a.makeArray(arguments),s=function(b,c){j=b,a.batch.trigger(i,"change",[b,c])};if(i=function(b){if(arguments.length){var d=j,e=p.call(c,b,d);return i.hasDependencies?o.call(c):(j=e===undefined?o.call(c):e,d!==j&&a.batch.trigger(i,"change",[j,d]),j)}return a.__reading&&q&&(a.__reading(i,"change"),!l.bound&&a.compute.temporarilyBind(i)),l.bound?j:o.call(c)},"function"==typeof b)p=b,o=b,q=g===!1?!1:!0,i.hasDependencies=!1,m=function(a){h=f(b,c||this,a,l),i.hasDependencies=h.isListening,j=h.value},n=function(){h&&h.teardown()};else if(c)if("string"==typeof c){var t=c,u=b instanceof a.Map;u&&(i.hasDependencies=!0),o=function(){return u?b.attr(t):b[t]},p=function(a){u?b.attr(t,a):b[t]=a};var v;m=function(c){v=function(){c(o(),j)},a.bind.call(b,g||t,v),j=e(o).value},n=function(){a.unbind.call(b,g||t,v)}}else if("function"==typeof c)j=b,p=c,c=g,k="setter";else{j=b;var w=c;o=w.get||o,p=w.set||p,m=w.on||m,n=w.off||n}else j=b;return a.cid(i,"compute"),a.simpleExtend(i,{isComputed:!0,_bindsetup:function(){l.bound=!0;var b=a.__reading;delete a.__reading,m.call(this,s),a.__reading=b},_bindteardown:function(){n.call(this,s),l.bound=!1},bind:a.bindAndSetup,unbind:a.unbindAndTeardown,clone:function(b){return b&&("setter"==k?r[2]=b:r[1]=b),a.compute.apply(a,r)}})};var g,h=function(){for(var a=0,b=g.length;b>a;a++)g[a].unbind("change",d);g=null};return a.compute.temporarilyBind=function(a){a.bind("change",d),g||(g=[],setTimeout(h,10)),g.push(a)},a.compute.binder=f,a.compute.truthy=function(b){return a.compute(function(){var a=b();return"function"==typeof a&&(a=a()),!!a})},a.compute}(__m2,__m13,__m14),__m11=function(a){return a.Observe=a.Map,a.Observe.startBatch=a.batch.start,a.Observe.stopBatch=a.batch.stop,a.Observe.triggerBatch=a.batch.trigger,a}(__m2,__m12,__m15,__m16),__m19=function(a){var b=a.isFunction,c=a.makeArray,d=1,e=a.view=a.template=function(c,d,f,g){b(f)&&(g=f,f=undefined);var h=function(a){return e.frag(a)},i=b(g)?function(a){g(h(a))}:null,j=b(c)?c(d,f,i):e.render(c,d,f,i),k=a.Deferred();return b(j)?j:a.isDeferred(j)?(j.then(function(a,b){k.resolve.call(k,h(a),b)},function(){k.fail.apply(k,arguments)}),k):h(j)};a.extend(e,{frag:function(a,b){return e.hookup(e.fragment(a),b)},fragment:function(b){var c=a.buildFragment(b,document.body);return c.childNodes.length||c.appendChild(document.createTextNode("")),c},toId:function(b){return a.map(b.toString().split(/\/|\./g),function(a){return a?a:void 0}).join("_")},hookup:function(b,c){var d,f,g=[];return a.each(b.childNodes?a.makeArray(b.childNodes):b,function(b){1===b.nodeType&&(g.push(b),g.push.apply(g,a.makeArray(b.getElementsByTagName("*"))))}),a.each(g,function(a){a.getAttribute&&(d=a.getAttribute("data-view-id"))&&(f=e.hookups[d])&&(f(a,c,d),delete e.hookups[d],a.removeAttribute("data-view-id"))}),b},hookups:{},hook:function(a){return e.hookups[++d]=a," data-view-id='"+d+"'"},cached:{},cachedRenderers:{},cache:!0,register:function(a){this.types["."+a.suffix]=a},types:{},ext:".ejs",registerScript:function(){},preload:function(){},render:function(d,f,j,k){b(j)&&(k=j,j=undefined);var l=h(f);if(l.length){var m=new a.Deferred,n=a.extend({},f);return l.push(g(d,!0)),a.when.apply(a,l).then(function(b){var d,e=c(arguments),g=e.pop();if(a.isDeferred(f))n=i(b);else for(var h in f)a.isDeferred(f[h])&&(n[h]=i(e.shift()));d=g(n,j),m.resolve(d,n),k&&k(d,n)},function(){m.reject.apply(m,arguments)}),m}if(a.__reading){var o=a.__reading;a.__reading=null}var p,q=b(k),m=g(d,q);if(a.Map&&a.__reading&&(a.__reading=o),q)p=m,m.then(function(a){k(f?a(f,j):a)});else{if("resolved"===m.state()&&m.__view_id){var r=e.cachedRenderers[m.__view_id];return f?r(f,j):r}m.then(function(a){p=f?a(f,j):a})}return p},registerView:function(b,c,d,f){var g=(d||e.types[e.ext]).renderer(b,c);return f=f||new a.Deferred,e.cache&&(e.cached[b]=f,f.__view_id=b,e.cachedRenderers[b]=g),f.resolve(g)}});var f=function(a,b){if(!a.length)throw"can.view: No template or empty template:"+b},g=function(b,c){var d,g,h,i="string"==typeof b?b:b.url,j=b.engine||i.match(/\.[\w\d]+$/);if(i.match(/^#/)&&(i=i.substr(1)),(g=document.getElementById(i))&&(j="."+g.type.match(/\/(x\-)?(.+)/)[2]),j||e.cached[i]||(i+=j=e.ext),a.isArray(j)&&(j=j[0]),h=e.toId(i),i.match(/^\/\//)){var k=i.substr(2);i=window.steal?steal.config().root.mapJoin(""+steal.id(k)):k}if(d=e.types[j],e.cached[h])return e.cached[h];if(g)return e.registerView(h,g.innerHTML,d);var l=new a.Deferred;return a.ajax({async:c,url:i,dataType:"text",error:function(a){f("",i),l.reject(a)},success:function(a){f(a,i),e.registerView(h,a,d,l)}}),l},h=function(b){var c=[];if(a.isDeferred(b))return[b];for(var d in b)a.isDeferred(b[d])&&c.push(b[d]);return c},i=function(b){return a.isArray(b)&&"success"===b[1]?b[0]:b};return window.steal&&steal.type("view js",function(a,b){var c=e.types["."+a.type],d=e.toId(a.id);a.text="steal('"+(c.plugin||"can/view/"+a.type)+"',function(can){return can.view.preload('"+d+"',"+a.text+");\n})",b()}),a.extend(e,{register:function(a){this.types["."+a.suffix]=a,window.steal&&steal.type(a.suffix+" view js",function(a,b){var c=e.types["."+a.type],d=e.toId(a.id+"");a.text=c.script(d,a.text),b()}),e[a.suffix]=function(b,c){if(!c){var d=function(){return e.frag(d.render.apply(this,arguments))};return d.render=function(){var c=a.renderer(null,b);return c.apply(c,arguments)},d}return e.preload(b,a.renderer(b,c))}},registerScript:function(a,b,c){return"can.view.preload('"+b+"',"+e.types["."+a].script(b,c)+");"},preload:function(b,c){function d(){return e.frag(c.apply(this,arguments))}var f=e.cached[b]=(new a.Deferred).resolve(function(a,b){return c.call(a,a,b)});return d.render=c,f.__view_id=b,e.cachedRenderers[b]=c,d}}),a}(__m2),__m18=function(a){var b=function(b){return b instanceof a.Map||b&&b.__get},c=/(\\)?\./g,d=/\\\./g,e=function(a){var b=[],e=0;return a.replace(c,function(c,f,g){f||(b.push(a.slice(e,g).replace(d,".")),e=g+c.length)}),b.push(a.slice(e).replace(d,".")),b},f=a.Construct.extend({read:function(c,d,e){e=e||{};for(var f,g,h,i=c,j=0,k=d.length;k>j;j++)if(g=i,g&&g.isComputed&&(e.foundObservable&&e.foundObservable(g,j),g=g()),b(g)?(!h&&e.foundObservable&&e.foundObservable(g,j),h=1,i="function"==typeof g[d[j]]&&g.constructor.prototype[d[j]]===g[d[j]]?e.returnObserveMethods?i[d[j]]:g[d[j]].apply(g,e.args||[]):i.attr(d[j])):i=g[d[j]],i&&i.isComputed&&!e.isArgument&&k-1>j&&(!h&&e.foundObservable&&e.foundObservable(g,j+1),i=i()),f=typeof i,jo&&(g=j,n=k,o=c,i=m,h=a.__clearReading&&a.__clearReading())}},c));if(p.value!==undefined)return{scope:m,rootObserve:j,value:p.value,reads:k}}a.__clearReading&&a.__clearReading(),m=m._parent}return g?(a.__setReading&&a.__setReading(h),{scope:i,rootObserve:g,reads:n,value:undefined}):{names:l,value:undefined}}});return a.view.Scope=f,f}(__m2,__m9,__m12,__m15,__m19,__m16),__m21=function(){var a={tagToContentPropMap:{option:"textContent"in document.createElement("option")?"textContent":"innerText",textarea:"value"},attrMap:{"class":"className",value:"value",innerText:"innerText",textContent:"textContent",checked:!0,disabled:!0,readonly:!0,required:!0,src:function(a,b){null==b||""==b?a.removeAttribute("src"):a.setAttribute("src",b)}},attrReg:/([^\s]+)[\s]*=[\s]*/,defaultValue:["input","textarea"],tagMap:{"":"span",table:"tbody",tr:"td",ol:"li",ul:"li",tbody:"tr",thead:"tr",tfoot:"tr",select:"option",optgroup:"option"},reverseTagMap:{tr:"tbody",option:"select",td:"tr",th:"tr",li:"ul"},getParentNode:function(a,b){return b&&11===a.parentNode.nodeType?b:a.parentNode},setAttr:function(b,c,d){var e=b.nodeName.toString().toLowerCase(),f=a.attrMap[c];"function"==typeof f?f(b,d):f===!0?b[c]=!0:f?(b[f]=d,"value"===f&&can.inArray(e,a.defaultValue)>=0&&(b.defaultValue=d)):b.setAttribute(c,d)},getAttr:function(b,c){return(a.attrMap[c]&&b[a.attrMap[c]]?b[a.attrMap[c]]:b.getAttribute(c))||""},removeAttr:function(b,c){var d=a.attrMap[c];"function"==typeof prop&&prop(b,undefined),d===!0?b[c]=!1:"string"==typeof d?b[d]="":b.removeAttribute(c)},contentText:function(a){return"string"==typeof a?a:a||0===a?""+a:""}};return function(){var b=document.createElement("div");b.setAttribute("style","width: 5px"),b.setAttribute("style","width: 10px"),a.attrMap.style=function(a,b){a.style.cssText=b||""}}(),a}(),__m20=function(can,elements){var newLine=/(\r|\n)+/g,clean=function(a){return a.split("\\").join("\\\\").split("\n").join("\\n").split('"').join('\\"').split(" ").join("\\t")},getTag=function(a,b,c){if(a)return a;for(;c":">",'"':'"',"'":"'"},this.tokenComplex=[],this.tokenMap={};for(var b,c=0;b=this.tokens[c];c++)b[2]?(this.tokenReg.push(b[2]),this.tokenComplex.push({abbr:b[1],re:new RegExp(b[2]),rescan:b[3]})):(this.tokenReg.push(b[1]),this.tokenSimple[b[1]]=b[0]),this.tokenMap[b[0]]=b[1];this.tokenReg=new RegExp("("+this.tokenReg.slice(0).concat(["<",">",'"',"'"]).join("|")+")","g")},Scanner.attributes={},Scanner.regExpAttributes={},Scanner.attribute=function(a,b){"string"==typeof a?Scanner.attributes[a]=b:Scanner.regExpAttributes[a]={match:a,callback:b} -},Scanner.hookupAttributes=function(a,b){can.each(a&&a.attrs||[],function(c){a.attr=c,Scanner.attributes[c]?Scanner.attributes[c](a,b):can.each(Scanner.regExpAttributes,function(d){d.match.test(c)&&d.callback(a,b)})})},Scanner.tag=function(a,b){window.html5&&(html5.elements+=" "+a,html5.shivDocument()),Scanner.tags[a.toLowerCase()]=b},Scanner.tags={},Scanner.hookupTag=function(a){var b=can.view.getHooks();return can.view.hook(function(c){can.each(b,function(a){a(c)});var d=a.options.read("helpers._tags",{}).value,e=a.tagName,f=d&&d[e]||Scanner.tags[e],g=a.scope,h=f?f(c,a):g;if(h&&a.subtemplate){g!==h&&(g=g.add(h));var i=can.view.frag(a.subtemplate(g,a.options));can.appendChild(c,i)}can.view.Scanner.hookupAttributes(a,c)})},Scanner.prototype={helpers:[],scan:function(a,b){var c=[],d=0,e=this.tokenSimple,f=this.tokenComplex;a=a.replace(newLine,"\n"),this.transform&&(a=this.transform(a)),a.replace(this.tokenReg,function(b,g){var h=arguments[arguments.length-2];if(h>d&&c.push(a.substring(d,h)),e[b])c.push(b);else for(var i,j=0;i=f[j];j++)if(i.re.test(b)){c.push(i.abbr),i.rescan&&c.push(i.rescan(g));break}d=h+g.length}),d":htmlTag=0;var x="/"==k.substr(k.length-1)||"--"==k.substr(k.length-2),y="";if(q.attributeHookups.length&&(y="attrs: ['"+q.attributeHookups.join("','")+"'], ",q.attributeHookups=[]),r===top(q.tagHookups))x&&(k=k.substr(0,k.length-1)),l.push(put_cmd,'"',clean(k),'"',",can.view.Scanner.hookupTag({tagName:'"+r+"',"+y+"scope: "+(this.text.scope||"this")+this.text.options),x?(l.push("}));"),k="/>",q.tagHookups.pop()):"<"===c[v]&&c[v+1]==="/"+r?(l.push("}));"),k=i,q.tagHookups.pop()):(l.push(",subtemplate: function("+this.text.argNames+"){\n"+startTxt+(this.text.start||"")),k="");else if(p||!t&&elements.tagToContentPropMap[s[s.length-1]]||y){var z=",can.view.pending({"+y+"scope: "+(this.text.scope||"this")+this.text.options+'}),"';x?m(k.substr(0,k.length-1),z+'/>"'):m(k,z+'>"'),k="",p=0}else k+=i;(x||t)&&(s.pop(),r=s[s.length-1],t=!1),q.attributeHookups=[];break;case"'":case'"':if(htmlTag)if(quote&"e===i){quote=null;var A=getAttrName();if(Scanner.attributes[A]?q.attributeHookups.push(A):can.each(Scanner.regExpAttributes,function(a){a.match.test(A)&&q.attributeHookups.push(A)}),u){k+=i,m(k),l.push(finishTxt,"}));\n"),k="",u=!1;break}}else if(null===quote&&(quote=i,beforeQuote=g,j=getAttrName(),"img"==r&&"src"==j||"style"===j)){m(k.replace(attrReg,"")),k="",u=!0,l.push(insert_cmd,"can.view.txt(2,'"+getTag(r,c,v)+"',"+status()+",this,function(){",startTxt),m(j+"="+i);break}default:if("<"===g){r=i.split(/\s|!--/)[0];var B=!1;if(0===r.indexOf("/")){B=!0;var C=r.substr(1)}B?(top(s)===C&&(r=C,t=!0),top(q.tagHookups)==C&&(m(k.substr(0,k.length-1)),l.push(finishTxt+"}}) );"),k="><",q.tagHookups.pop())):(r.lastIndexOf("/")===r.length-1&&(r=r.substr(0,r.length-1)),"!--"!==r&&(Scanner.tags[r]||automaticCustomElementCharacters.test(r))&&("content"===r&&elements.tagMap[top(s)]&&(i=i.replace("content",elements.tagMap[top(s)])),q.tagHookups.push(r)),s.push(r))}k+=i}else switch(i){case w.right:case w.returnRight:switch(o){case w.left:h=bracketNum(k),1==h?(l.push(insert_cmd,"can.view.txt(0,'"+getTag(r,c,v)+"',"+status()+",this,function(){",startTxt,k),n.push({before:"",after:finishTxt+"}));\n"})):(d=n.length&&-1==h?n.pop():{after:";"},d.before&&l.push(d.before),l.push(k,";",d.after));break;case w.escapeLeft:case w.returnLeft:h=bracketNum(k),h&&n.push({before:finishTxt,after:"}));\n"});for(var D=o===w.escapeLeft?1:0,E={insert:insert_cmd,tagName:getTag(r,c,v),status:status(),specialAttribute:u},F=0;F[\s]*\w*/.source&&(D=0);break}}"object"==typeof k?k.raw&&l.push(k.raw):u?l.push(insert_cmd,k,");"):l.push(insert_cmd,"can.view.txt(\n"+D+",\n'"+r+"',\n"+status()+",\nthis,\nfunction(){ "+(this.text.escape||"")+"return ",k,h?startTxt:"}));\n"),rescan&&rescan.after&&rescan.after.length&&(m(rescan.after.length),rescan=null)}o=null,k="";break;case w.templateLeft:k+=w.left;break;default:k+=i}g=i}k.length&&m(k),l.push(";");var H=l.join(""),I={out:(this.text.outStart||"")+H+" "+finishTxt+(this.text.outEnd||"")};return myEval.call(I,"this.fn = (function("+this.text.argNames+"){"+I.out+"});\r\n//@ sourceURL="+b+".js"),I}},can.view.Scanner.tag("content",function(a,b){return b.scope}),Scanner}(__m19,__m21),__m24=function(a){var b=!0;try{document.createTextNode("")._=0}catch(c){b=!1}var d={},e={},f={},g="ejs_"+Math.random(),h=0,i=function(a){if(b||3!==a.nodeType)return a[g]?a[g]:a[g]=(a.nodeName?"element_":"obj_")+ ++h;for(var c in e)if(e[c]===a)return c;return e["text_"+ ++h]=a,"text_"+h},j=function(b,c){var e=d[i(b)];if(e){var f=a.inArray(c,e);f>=0&&e.splice(f,1),e.length||delete d[i(b)]}},k=function(a,b){var c=d[i(a)];c||(c=d[i(a)]=[]),c.push(b)},l={id:i,replace:function(b,c){b=a.makeArray(b);var e=b[0];a.each(a.makeArray(d[i(e)]),function(d){var g=f[d],h=a.inArray(e,g),i=a.inArray(b[b.length-1],g);if(h>=0&&i>=0){for(var m=h;i>=m;m++){var n=g[m];j(n,d)}g.splice.apply(g,[h,i-h+1].concat(c)),a.each(c,function(a){k(a,d)})}else l.unregister(g)})},register:function(b){var c=i(b);f[c]=b,a.each(b,function(a){k(a,c)})},unregister:function(b){var c=i(b);a.each(b,function(a){j(a,c)}),delete f[c]},nodeMap:d,nodeListMap:f};return l}(__m2),__m23=function(a,b,c,d){var e=function(b,c,d){var e=function(){return d(f),a.unbind.call(b,"removed",e),!0},f={teardownCheck:function(a){return a?!1:e()}};return a.bind.call(b,"removed",e),c(f),f},f=function(a,b,c){return e(a,function(){b.bind("change",c)},function(a){b.unbind("change",c),a.nodeList&&d.unregister(a.nodeList)})},g=function(a){return(a||"").replace(/['"]/g,"").split("=")},h=function(b,c){var d=b[b.length-1];d.nextSibling?a.insertBefore(d.parentNode,c,d.nextSibling):a.appendChild(d.parentNode,c)},i={nodeLists:d,list:function(c,f,g,i,j){var k,l=[],m=function(b,c,e){if(!r.teardownCheck(o.parentNode)){var f=document.createDocumentFragment(),k=[];if(a.each(c,function(b,c){var d=g.call(i,b,c+e),h=a.view.frag(d,j);k.push(a.makeArray(h.childNodes)),f.appendChild(h)}),l[e]){var m=l[e][0];a.insertBefore(m.parentNode,f,m)}else h(0==e?[o]:l[e-1],f);a.each(k,function(a){d.register(a)}),[].splice.apply(l,[e,0].concat(k))}},n=function(b,c,e,f){if(f||!r.teardownCheck(o.parentNode)){var g=l.splice(e,c.length),h=[];a.each(g,function(a){[].push.apply(h,a),d.replace(a,[]),d.unregister(a)}),a.remove(a.$(h))}},j=b.getParentNode(c,j),o=document.createTextNode(""),p=function(){k&&k.unbind&&k.unbind("add",m).unbind("remove",n),n({},{length:l.length},0,!0)},q=function(a,b){p(),k=b||[],k.bind&&k.bind("add",m).bind("remove",n),m({},k,0)};h([c],o),a.remove(a.$(c));var r=e(j,function(){a.isFunction(f)&&f.bind("change",q)},function(){a.isFunction(f)&&f.unbind("change",q),p()});q({},a.isFunction(f)?f():f)},html:function(c,e,g){var i,g=b.getParentNode(c,g),j=f(g,e,function(a,b){var c=i[0].parentNode;c&&k(b),j.teardownCheck(i[0].parentNode)}),k=function(b){var e=a.view.frag(b,g),f=a.makeArray(e.childNodes);if(h(i||[c],e),i){var k=a.makeArray(i);d.replace(i,f),a.remove(a.$(k))}else a.remove(a.$(c)),i=f,j.nodeList=i,d.register(i)};k(e(),[c])},text:function(a,c,d){var e=b.getParentNode(a,d),g=f(e,c,function(a,b){"unknown"!=typeof h.nodeValue&&(h.nodeValue=""+b),g.teardownCheck(h.parentNode)}),h=document.createTextNode(c());a.parentNode!==e?(e=a.parentNode,e.insertBefore(h,a),e.removeChild(a)):(e.insertBefore(h,a),e.removeChild(a))},attributes:function(a,c,d){var e=function(c){var d=g(c),e=d.shift();e!=h&&h&&b.removeAttr(a,h),e&&(b.setAttr(a,e,d.join("=")),h=e)};if(f(a,c,function(a,b){e(b)}),arguments.length>=3)var h=g(d)[0];else e(c())},attributePlaceholder:"__!!__",attributeReplace:/__!!__/g,attribute:function(c,d,e){f(c,e,function(){b.setAttr(c,d,j.render())});var g,h=a.$(c);g=a.data(h,"hooks"),g||a.data(h,"hooks",g={});var j,k=b.getAttr(c,d),l=k.split(i.attributePlaceholder),m=[];m.push(l.shift(),l.join(i.attributePlaceholder)),g[d]?g[d].computes.push(e):g[d]={render:function(){var a=0,c=k?k.replace(i.attributeReplace,function(){return b.contentText(j.computes[a++]())}):b.contentText(j.computes[a++]());return c},computes:[e],batchNum:undefined},j=g[d],m.splice(1,0,e()),b.setAttr(c,d,m.join(""))},specialAttribute:function(a,c,d){f(a,d,function(d,e){b.setAttr(a,c,k(e))}),b.setAttr(a,c,k(d()))}},j=/(\r|\n)+/g,k=function(a){return a=a.replace(b.attrReg,"").replace(j,""),/^["'].*["']$/.test(a)?a.substr(1,a.length-2):a};return a.view.live=i,i}(__m2,__m21,__m19,__m24),__m22=function(a,b,c){var d,e=[],f=function(a){var c=b.tagMap[a]||"span";return"span"===c?"@@!!@@":"<"+c+">"+f(c)+""},g=function(b,c){if("string"==typeof b)return b;if(!b&&0!==b)return"";var d=b.hookup&&function(a,c){b.hookup.call(b,a,c)}||"function"==typeof b&&b;return d?c?"<"+c+" "+a.view.hook(d)+">":(e.push(d),""):""+b},h=function(b,c){return"string"==typeof b||"number"==typeof b?a.esc(b):g(b,c)},i=!1,j=function(){};return a.extend(a.view,{live:c,setupLists:function(){var b,c=a.view.lists;return a.view.lists=function(a,c){return b={list:a,renderer:c},Math.random()},function(){return a.view.lists=c,b}},pending:function(b){var c=a.view.getHooks();return a.view.hook(function(d){a.each(c,function(a){a(d)}),a.view.Scanner.hookupAttributes(b,d)})},getHooks:function(){var a=e.slice(0);return d=a,e=[],a},onlytxt:function(a,b){return h(b.call(a))},txt:function(k,l,m,n,o){var p,q=b.tagMap[l]||"span",r=!1;if(i)p=o.call(n);else{("string"==typeof m||1===m)&&(i=!0);var s=a.view.setupLists(),t=function(){u.unbind("change",j)},u=a.compute(o,n,!1);u.bind("change",j);var v=s();p=u(),i=!1,r=u.hasDependencies}if(v)return"<"+q+a.view.hook(function(a,b){c.list(a,v.list,v.renderer,n,b)})+">";if(!r||"function"==typeof p)return t&&t(),(!k&&"string"!=typeof m||2===k?g:h)(p,0===m&&q);var w=b.tagToContentPropMap[l];if(0!==m||w){if(1===m)return e.push(function(a){c.attributes(a,u,u()),t()}),u();if(2===k){var x=m;return e.push(function(a){c.specialAttribute(a,x,u),t()}),u()}var x=0===m?w:m;return(0===m?d:e).push(function(a){c.attribute(a,x,u),t()}),c.attributePlaceholder}return"<"+q+a.view.hook(k?function(a,b){c.text(a,u,b),t()}:function(a,b){c.html(a,u,b),t()})+">"+f(q)+""}}),a}(__m19,__m21,__m23,__m10),__m17=function(a){a.view.ext=".mustache";var b="scope",c="___h4sh",d="{scope:"+b+",options:options}",e=b+",options",f=/((([^\s]+?=)?('.*?'|".*?"))|.*?)\s/g,g=/^(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false|null|undefined)|((.+?)=(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false)|(.+))))$/,h=function(a){return'{get:"'+a.replace(/"/g,'\\"')+'"}'},i=function(a){return a&&"string"==typeof a.get},j=function(b){return b instanceof a.Map||b&&!!b._get},k=function(a){return a&&a.splice&&"number"==typeof a.length},l=function(b,c,d){return function(e,f){return e===undefined||e instanceof a.view.Scope||(e=c.add(e)),f===undefined||f instanceof o||(f=d.add(f)),b(e,f||d)}};Mustache=function(b){if(this.constructor!=Mustache){var c=new Mustache(b);return function(a,b){return c.render(a,b)}}return"function"==typeof b?(this.template={fn:b},void 0):(a.extend(this,b),this.template=this.scanner.scan(this.text,this.name),void 0)},a.Mustache=window.Mustache=Mustache,Mustache.prototype.render=function(b,c){return b instanceof a.view.Scope||(b=new a.view.Scope(b||{})),c instanceof o||(c=new o(c||{})),c=c||{},this.template.fn.call(b,b,c)},a.extend(Mustache.prototype,{scanner:new a.view.Scanner({text:{start:"",scope:b,options:",options: options",argNames:e},tokens:[["returnLeft","{{{","{{[{&]"],["commentFull","{{!}}","^[\\s\\t]*{{!.+?}}\\n"],["commentLeft","{{!","(\\n[\\s\\t]*{{!|{{!)"],["escapeFull","{{}}","(^[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}$)",function(a){return{before:/^\n.+?\n$/.test(a)?"\n":"",content:a.match(/\{\{(.+?)\}\}/)[1]||""}}],["escapeLeft","{{"],["returnRight","}}}"],["right","}}"]],helpers:[{name:/^>[\s]*\w*/,fn:function(b){var c=a.trim(b.replace(/^>\s?/,"")).replace(/["|']/g,"");return"can.Mustache.renderPartial('"+c+"',"+e+")"}},{name:/^\s*data\s/,fn:function(a){var c=a.match(/["|'](.*)["|']/)[1];return"can.proxy(function(__){can.data(can.$(__),'"+c+"', this.attr('.')); }, "+b+")"}},{name:/\s*\(([\$\w]+)\)\s*->([^\n]*)/,fn:function(a){var c=/\s*\(([\$\w]+)\)\s*->([^\n]*)/,d=a.match(c);return"can.proxy(function(__){var "+d[1]+"=can.$(__);with("+b+".attr('.')){"+d[2]+"}}, this);"}},{name:/^.*$/,fn:function(b,i){var j=!1,k=[];if(b=a.trim(b),b.length&&(j=b.match(/^([#^/]|else$)/))){switch(j=j[0]){case"#":case"^":i.specialAttribute?k.push(i.insert+"can.view.onlytxt(this,function(){ return "):k.push(i.insert+"can.view.txt(0,'"+i.tagName+"',"+i.status+",this,function(){ return ");break;case"/":return{raw:'return ___v1ew.join("");}}])}));'}}b=b.substring(1)}if("else"!=j){var l,m=[],n=0;k.push("can.Mustache.txt(\n"+d+",\n"+(j?'"'+j+'"':"null")+",");var m=[],o=[];(a.trim(b)+" ").replace(f,function(a,b){n&&(l=b.match(g))?l[2]?m.push(l[0]):o.push(l[4]+":"+(l[6]?l[6]:h(l[5]))):m.push(h(b)),n++}),k.push(m.join(",")),o.length&&k.push(",{"+c+":{"+o.join(",")+"}}")}switch(j&&"else"!=j&&k.push(",[\n\n"),j){case"#":k.push("{fn:function("+e+"){var ___v1ew = [];");break;case"else":k.push('return ___v1ew.join("");}},\n{inverse:function('+e+"){\nvar ___v1ew = [];");break;case"^":k.push("{inverse:function("+e+"){\nvar ___v1ew = [];");break;default:k.push(")")}return k=k.join(""),j?{raw:k}:k}}]})});for(var m=a.view.Scanner.prototype.helpers,n=0;nk;k++)j[d[k]]||(j[d[k]]=b.test(d[k+1])||"[]"==d[k+1]?[]:{}),j=j[d[k]];h=d.pop(),"[]"==h?j.push(g):j[h]=g}})),i}}),a}(__m2,__m10),__m27=function(a){var b,c,d,e,f=/\:([\w\.]+)/g,g=/^(?:&[^=]+=[^&]*)+/,h=function(b){var c=[];return a.each(b,function(b,d){c.push(("className"===d?"class":d)+'="'+("href"===d?b:a.esc(b))+'"')}),c.join(" ")},i=function(a,b){var c=0,d=0,e={};for(var f in a.defaults)a.defaults[f]===b[f]&&(e[f]=1,c++);for(;dg&&(d=a,g=e),e>=j?!1:void 0}),a.route.routes[h]&&i(a.route.routes[h],b)===g&&(d=a.route.routes[h]),d){var k,n=m({},b),o=d.route.replace(f,function(a,c){return delete n[c],b[c]===d.defaults[c]?"":encodeURIComponent(b[c])}).replace("\\","");return l(d.defaults,function(a,b){n[b]===a&&delete n[b]}),k=a.param(n),c&&a.route.attr("route",d.route),o+(k?a.route._call("querySeparator")+k:"")}return a.isEmptyObject(b)?"":a.route._call("querySeparator")+a.param(b)},deparam:function(b){var c=a.route._call("root");c.lastIndexOf("/")==c.length-1&&0===b.indexOf("/")&&(b=b.substr(1));var d={length:-1},e=a.route._call("querySeparator"),f=a.route._call("paramsMatcher");if(l(a.route.routes,function(a){a.test.test(b)&&a.length>d.length&&(d=a)}),d.length>-1){var g=b.match(d.test),h=g.shift(),i=b.substr(h.length-(g[g.length-1]===e?1:0)),j=i&&f.test(i)?a.deparam(i.slice(1)):{};return j=m(!0,{},d.defaults,j),l(g,function(a,b){a&&a!==e&&(j[d.names[b]]=decodeURIComponent(a))}),j.route=d.route,j}return b.charAt(0)!==e&&(b=e+b),f.test(b)?a.deparam(b.slice(1)):{}},data:new a.Map({}),routes:{},ready:function(b){return b!==!0&&(a.route._setup(),a.route.setState()),a.route},url:function(b,c){return c&&(b=a.extend({},a.route.deparam(a.route._call("matchingPartOfURL")),b)),a.route._call("root")+a.route.param(b)},link:function(b,c,d,e){return""+b+""},current:function(b){return this._call("matchingPartOfURL")===a.route.param(b)},bindings:{hashchange:{paramsMatcher:g,querySeparator:"&",bind:function(){a.bind.call(window,"hashchange",q)},unbind:function(){a.unbind.call(window,"hashchange",q)},matchingPartOfURL:function(){return j.href.split(/#!?/)[1]||""},setURL:function(a){return j.hash="#!"+a,a},root:"#!"}},defaultBinding:"hashchange",currentBinding:null,_setup:function(){a.route.currentBinding||(a.route._call("bind"),a.route.bind("change",p),a.route.currentBinding=a.route.defaultBinding)},_teardown:function(){a.route.currentBinding&&(a.route._call("unbind"),a.route.unbind("change",p),a.route.currentBinding=null),clearTimeout(b),e=0},_call:function(){var b=a.makeArray(arguments),c=b.shift(),d=a.route.bindings[a.route.currentBinding||a.route.defaultBinding];return method=d[c],"function"==typeof method?method.apply(d,b):method}}),l(["bind","unbind","on","off","delegate","undelegate","removeAttr","compute","_get","__get"],function(b){a.route[b]=function(){return a.route.data[b]?a.route.data[b].apply(a.route.data,arguments):void 0 -}}),a.route.attr=function(b,c){var d,e=typeof b;return d=c===undefined?arguments:"string"!==e&&"number"!==e?[n(b),c]:[b,n(c)],a.route.data.attr.apply(a.route.data,d)};var q=a.route.setState=function(){var b=a.route._call("matchingPartOfURL");c=a.route.deparam(b),e&&b===d||a.route.attr(c,!0)};return a.route}(__m2,__m12,__m28),__m29=function(a){return a.Control.processors.route=function(b,c,d,e,f){d=d||"",a.route.routes[d]||a.route(d);var g,h=function(b){if(a.route.attr("route")===d&&(b.batchNum===undefined||b.batchNum!==g)){g=b.batchNum;var c=a.route.attr();delete c.route,a.isFunction(f[e])?f[e](c):f[f[e]](c)}};return a.route.bind("change",h),function(){a.route.unbind("change",h)}},a}(__m2,__m27,__m8);window.can=__m4}(); \ No newline at end of file +!function(undefined){var __m4=function(){var a=window.can||{};("undefined"==typeof GLOBALCAN||GLOBALCAN!==!1)&&(window.can=a),a.isDeferred=function(a){var b=this.isFunction;return a&&b(a.then)&&b(a.pipe)};var b=0;return a.cid=function(a,c){return a._cid?a._cid:a._cid=(c||"")+ ++b},a.VERSION="2.0.4",a.simpleExtend=function(a,b){for(var c in b)a[c]=b[c];return a},a}(),__m5=function(a){return a.each=function(b,c,d){var e,f=0;if(b)if("number"==typeof b.length&&b.pop)for(b.attr&&b.attr("length"),e=b.length;e>f&&c.call(d||b[f],b[f],f,b)!==!1;f++);else if(b.hasOwnProperty){a.Map&&b instanceof a.Map&&(a.__reading&&a.__reading(b,"__keys"),b=b.__get());for(e in b)if(b.hasOwnProperty(e)&&c.call(d||b[e],b[e],e,b)===!1)break}return b},a}(__m4),__m6=function(a){a.inserted=function(b){b=a.makeArray(b);for(var c,d,e=!1,f=0;(d=b[f])!==undefined;f++){if(!e){if(!d.getElementsByTagName)continue;if(!a.has(a.$(document),d).length)return;e=!0}if(e&&d.getElementsByTagName){c=a.makeArray(d.getElementsByTagName("*")),a.trigger(d,"inserted",[],!1);for(var g,h=0;(g=c[h])!==undefined;h++)a.trigger(g,"inserted",[],!1)}}},a.appendChild=function(b,c){if(11===c.nodeType)var d=a.makeArray(c.childNodes);else var d=[c];b.appendChild(c),a.inserted(d)},a.insertBefore=function(b,c,d){if(11===c.nodeType)var e=a.makeArray(c.childNodes);else var e=[c];b.insertBefore(c,d),a.inserted(e)}}(__m4),__m7=function(a){return a.addEvent=function(a,b){var c=this.__bindEvents||(this.__bindEvents={}),d=c[a]||(c[a]=[]);return d.push({handler:b,name:a}),this},a.listenTo=function(b,c,d){var e=this.__listenToEvents;e||(e=this.__listenToEvents={});var f=a.cid(b),g=e[f];g||(g=e[f]={obj:b,events:{}});var h=g.events[c];h||(h=g.events[c]=[]),h.push(d),a.bind.call(b,c,d)},a.stopListening=function(b,c,d){var e=this.__listenToEvents,f=e,g=0;if(!e)return this;if(b){var h=a.cid(b);if((f={})[h]=e[h],!e[h])return this}for(var i in f){var j,k=f[i];b=e[i].obj,c?(j={})[c]=k.events[c]:j=k.events;for(var l in j){var m=j[l]||[];for(g=0;gf;f++)c=e[f],c.handler.apply(this,b)}},a}(__m4),__m2=function(a,b){var c=function(a){return a.nodeName&&(1==a.nodeType||9==a.nodeType)||a==window};a.extend(b,a,{trigger:function(c,d,e){c.nodeName||c===window?a.event.trigger(d,e,c,!0):c.trigger?c.trigger(d,e):("string"==typeof d&&(d={type:d}),d.target=d.target||c,b.dispatch.call(c,d,e))},addEvent:b.addEvent,removeEvent:b.removeEvent,buildFragment:function(b,c){var d,e=a.buildFragment;return b=[b],c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d=e.call(jQuery,b,c),d.cacheable?a.clone(d.fragment):d.fragment||d},$:a,each:b.each,bind:function(d,e){return this.bind&&this.bind!==b.bind?this.bind(d,e):c(this)?a.event.add(this,d,e):b.addEvent.call(this,d,e),this},unbind:function(d,e){return this.unbind&&this.unbind!==b.unbind?this.unbind(d,e):c(this)?a.event.remove(this,d,e):b.removeEvent.call(this,d,e),this},delegate:function(b,d,e){return this.delegate?this.delegate(b,d,e):c(this)&&a(this).delegate(b,d,e),this},undelegate:function(b,d,e){return this.undelegate?this.undelegate(b,d,e):c(this)&&a(this).undelegate(b,d,e),this},proxy:function(a,b){return function(){return a.apply(b,arguments)}}}),b.on=b.bind,b.off=b.unbind,a.each(["append","filter","addClass","remove","data","get","has"],function(a,c){b[c]=function(a){return a[c].apply(a,b.makeArray(arguments).slice(1))}});var d=a.cleanData;a.cleanData=function(c){a.each(c,function(a,c){c&&b.trigger(c,"removed",[],!1)}),d(c)};var e,f=a.fn.domManip;return a.fn.domManip=function(){for(var a=1;a/g,">").replace(h,""").replace(i,"'")},getObject:function(b,c,d){var e,f,g,h,i=b?b.split("."):[],j=i.length,k=0;if(c=a.isArray(c)?c:[c||window],h=c.length,!j)return c[0];for(k;h>k;k++){for(e=c[k],g=undefined,f=0;j>f&&m(e);f++)g=e,e=l(g,i[f]);if(g!==undefined&&e!==undefined)break}if(d===!1&&e!==undefined&&delete g[i[f-1]],d===!0&&e===undefined)for(e=c[0],f=0;j>f&&m(e);f++)e=l(e,i[f],!0);return e},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},camelize:function(a){return n(a).replace(j,function(a,b){return b?b.toUpperCase():""})},hyphenate:function(a){return n(a).replace(k,function(a){return a.charAt(0)+"-"+a.charAt(1).toLowerCase()})},underscore:function(a){return a.replace(c,"/").replace(d,"$1_$2").replace(e,"$1_$2").replace(f,"_").toLowerCase()},sub:function(b,c,d){var e=[];return b=b||"",e.push(b.replace(g,function(b,f){var g=a.getObject(f,c,d===!0?!1:undefined);return g===undefined||null===g?(e=null,""):m(g)&&e?(e.push(g),""):""+g})),null===e?e:e.length<=1?e[0]:e},replacer:g,undHash:b}),a}(__m2),__m9=function(a){var b=0;return a.Construct=function(){return arguments.length?a.Construct.extend.apply(a.Construct,arguments):void 0},a.extend(a.Construct,{constructorExtends:!0,newInstance:function(){var a,b=this.instance();return b.setup&&(a=b.setup.apply(b,arguments)),b.init&&b.init.apply(b,a||arguments),b},_inherit:function(b,c,d){a.extend(d||b,b||{})},_overwrite:function(a,b,c,d){a[c]=d},setup:function(b){this.defaults=a.extend(!0,{},b.defaults,this.defaults)},instance:function(){b=1;var a=new this;return b=0,a},extend:function(c,d,e){function f(){return b?void 0:this.constructor!==f&&arguments.length&&f.constructorExtends?arguments.callee.extend.apply(arguments.callee,arguments):f.newInstance.apply(f,arguments)}"string"!=typeof c&&(e=d,d=c,c=null),e||(e=d,d=null),e=e||{};var g,h,i,j,k=this,l=this.prototype;j=this.instance(),a.Construct._inherit(e,l,j);for(g in k)k.hasOwnProperty(g)&&(f[g]=k[g]);if(a.Construct._inherit(d,k,f),c){var m=c.split("."),h=m.pop(),n=a.getObject(m.join("."),window,!0),i=n,o=a.underscore(c.replace(/\./g,"_")),p=a.underscore(h);n[h]=f}a.extend(f,{constructor:f,prototype:j,namespace:i,_shortName:p,fullName:c,_fullName:o}),h!==undefined&&(f.shortName=h),f.prototype.constructor=f;var q=[k].concat(a.makeArray(arguments)),r=f.setup.apply(f,q);return f.init&&f.init.apply(f,r||q),f}}),a.Construct.prototype.setup=function(){},a.Construct.prototype.init=function(){},a.Construct}(__m10),__m8=function(a){var b,c=function(b,c,d){return a.bind.call(b,c,d),function(){a.unbind.call(b,c,d)}},d=a.isFunction,e=a.extend,f=a.each,g=[].slice,h=/\{([^\}]+)\}/g,i=a.getObject("$.event.special",[a])||{},j=function(b,c,d,e){return a.delegate.call(b,c,d,e),function(){a.undelegate.call(b,c,d,e)}},k=function(b,d,e,f){return f?j(b,a.trim(f),d,e):c(b,d,e)},l=a.Control=a.Construct({setup:function(){if(a.Construct.setup.apply(this,arguments),a.Control){var b,c=this;c.actions={};for(b in c.prototype)c._isAction(b)&&(c.actions[b]=c._action(b))}},_shifter:function(b,c){var e="string"==typeof c?b[c]:c;return d(e)||(e=b[e]),function(){return b.called=c,e.apply(b,[this.nodeName?a.$(this):this].concat(g.call(arguments,0)))}},_isAction:function(a){var b=this.prototype[a],c=typeof b;return"constructor"!==a&&("function"==c||"string"==c&&d(this.prototype[b]))&&!!(i[a]||m[a]||/[^\w]/.test(a))},_action:function(c,d){if(h.lastIndex=0,d||!h.test(c)){var e=d?a.sub(c,this._lookup(d)):c;if(!e)return null;var f=a.isArray(e),g=f?e[1]:e,i=g.split(/\s+/g),j=i.pop();return{processor:m[j]||b,parts:[g,i.join(" "),j],delegate:f?e[0]:undefined}}},_lookup:function(a){return[a,window]},processors:{},defaults:{}},{setup:function(b,c){var d,f=this.constructor,g=f.pluginName||f._fullName;return this.element=a.$(b),g&&"can_control"!==g&&this.element.addClass(g),(d=a.data(this.element,"controls"))||a.data(this.element,"controls",d=[]),d.push(this),this.options=e({},f.defaults,c),this.on(),[this.element,this.options]},on:function(b,c,d,e){if(!b){this.off();var f,g,h=this.constructor,i=this._bindings,j=h.actions,l=this.element,m=a.Control._shifter(this,"destroy");for(f in j)j.hasOwnProperty(f)&&(g=j[f]||h._action(f,this.options))&&i.push(g.processor(g.delegate||l,g.parts[2],g.parts[1],f,this));return a.bind.call(l,"removed",m),i.push(function(b){a.unbind.call(b,"removed",m)}),i.length}return"string"==typeof b&&(e=d,d=c,c=b,b=this.element),e===undefined&&(e=d,d=c,c=null),"string"==typeof e&&(e=a.Control._shifter(this,e)),this._bindings.push(k(b,d,e,c)),this._bindings.length},off:function(){var a=this.element[0];f(this._bindings||[],function(b){b(a)}),this._bindings=[]},destroy:function(){if(null!==this.element){var b,c=this.constructor,d=c.pluginName||c._fullName;this.off(),d&&"can_control"!==d&&this.element.removeClass(d),b=a.data(this.element,"controls"),b.splice(a.inArray(this,b),1),a.trigger(this,"destroyed"),this.element=null}}}),m=a.Control.processors,b=function(b,c,d,e,f){return k(b,c,a.Control._shifter(f,e),d)};return f(["change","click","contextmenu","dblclick","keydown","keyup","keypress","mousedown","mousemove","mouseout","mouseover","mouseup","reset","resize","scroll","select","submit","focusin","focusout","mouseenter","mouseleave","touchstart","touchmove","touchcancel","touchend","touchleave"],function(a){m[a]=b}),l}(__m2,__m9),__m13=function(a){return a.bindAndSetup=function(){return a.addEvent.apply(this,arguments),this._init||(this._bindings?this._bindings++:(this._bindings=1,this._bindsetup&&this._bindsetup())),this},a.unbindAndTeardown=function(){return a.removeEvent.apply(this,arguments),null==this._bindings?this._bindings=0:this._bindings--,this._bindings||this._bindteardown&&this._bindteardown(),this},a}(__m2),__m14=function(a){var b=1,c=0,d=[],e=[];a.batch={start:function(a){c++,a&&e.push(a)},stop:function(f,g){if(f?c=0:c--,0==c){var h=d.slice(0),i=e.slice(0);d=[],e=[],b++,g&&a.batch.start(),a.each(h,function(b){a.trigger.apply(a,b)}),a.each(i,function(a){a()})}},trigger:function(e,f,g){if(!e._init){if(0==c)return a.trigger(e,f,g);f="string"==typeof f?{type:f}:f,f.batchNum=b,d.push([e,f,g])}}}}(__m4),__m12=function(a){var b=function(b,c,d){a.listenTo.call(d,b,"change",function(){var e=a.makeArray(arguments),f=e.shift();e[0]=("*"===c?[d.indexOf(b),e[0]]:[c,e[0]]).join("."),f.triggeredNS=f.triggeredNS||{},f.triggeredNS[d._cid]||(f.triggeredNS[d._cid]=!0,a.trigger(d,f,e))})},c=function(b,c){return c?[b]:a.isArray(b)?b:(""+b).split(".")},d=function(a){return function(){var c=this;this._each(function(d,e){d&&d.bind&&b(d,a||e,c)})}},e=null,f=function(){for(var a in e)e[a].added&&delete e[a].obj._cid;e=null},g=function(a){return e&&e[a._cid]&&e[a._cid].instance},h=a.Map=a.Construct.extend({setup:function(){if(a.Construct.setup.apply(this,arguments),a.Map){this.defaults||(this.defaults={}),this._computes=[];for(var b in this.prototype)"function"!=typeof this.prototype[b]?this.defaults[b]=this.prototype[b]:this.prototype[b].isComputed&&this._computes.push(b)}!a.List||this.prototype instanceof a.List||(this.List=h.List({Map:this},{}))},_computes:[],bind:a.bindAndSetup,on:a.bindAndSetup,unbind:a.unbindAndTeardown,off:a.unbindAndTeardown,id:"id",helpers:{addToMap:function(b,c){var d;e||(d=f,e={});var g=b._cid,h=a.cid(b);return e[h]||(e[h]={obj:b,instance:c,added:!g}),d},canMakeObserve:function(b){return b&&!a.isDeferred(b)&&(a.isArray(b)||a.isPlainObject(b)||b instanceof a.Map)},unhookup:function(b,c){return a.each(b,function(b){b&&b.unbind&&a.stopListening.call(c,b,"change")})},hookupBubble:function(c,d,e,f,i){return f=f||h,i=i||h.List,c instanceof h?e._bindings&&h.helpers.unhookup([c],e):c=a.isArray(c)?g(c)||new i(c):g(c)||new f(c),e._bindings&&b(c,d,e),c},serialize:function(b,c,d){return b.each(function(b,e){d[e]=h.helpers.canMakeObserve(b)&&a.isFunction(b[c])?b[c]():b}),d},makeBindSetup:d},keys:function(b){var c=[];a.__reading&&a.__reading(b,"__keys");for(var d in b._data)c.push(d);return c}},{setup:function(b){this._data={},a.cid(this,".map"),this._init=1,this._setupComputes();var c=b&&a.Map.helpers.addToMap(b,this),d=a.extend(a.extend(!0,{},this.constructor.defaults||{}),b);this.attr(d),c&&c(),this.bind("change",a.proxy(this._changes,this)),delete this._init},_setupComputes:function(){var a=this.constructor._computes;this._computedBindings={};for(var b,c=0,d=a.length;d>c;c++)b=a[c],this[b]=this[b].clone(this),this._computedBindings[b]={count:0}},_bindsetup:d(),_bindteardown:function(){var a=this;this._each(function(b){h.helpers.unhookup([b],a)})},_changes:function(b,c,d,e,f){a.batch.trigger(this,{type:c,batchNum:b.batchNum},[e,f])},_triggerChange:function(){a.batch.trigger(this,"change",a.makeArray(arguments))},_each:function(a){var b=this.__get();for(var c in b)b.hasOwnProperty(c)&&a(b[c],c)},attr:function(b,c){var d=typeof b;return"string"!==d&&"number"!==d?this._attrs(b,c):1===arguments.length?(a.__reading&&a.__reading(this,b),this._get(b)):(this._set(b,c),this)},each:function(){return a.__reading&&a.__reading(this,"__keys"),a.each.apply(undefined,[this.__get()].concat(a.makeArray(arguments)))},removeAttr:function(b){var d=a.List&&this instanceof a.List,e=c(b),f=e.shift(),g=d?this[f]:this._data[f];return e.length?g.removeAttr(e):(d?this.splice(f,1):f in this._data&&(delete this._data[f],f in this.constructor.prototype||delete this[f],a.batch.trigger(this,"__keys"),this._triggerChange(f,"remove",undefined,g)),g)},_get:function(a){var b="string"==typeof a&&!!~a.indexOf(".")&&this.__get(a);if(b)return b;var d=c(a),e=this.__get(d.shift());return d.length?e?e._get(d):undefined:e},__get:function(b){return b?this[b]&&this[b].isComputed&&a.isFunction(this.constructor.prototype[b])?this[b]():this._data[b]:this._data},_set:function(a,b,d){var e=c(a,d),f=e.shift(),g=this.__get(f);if(h.helpers.canMakeObserve(g)&&e.length)g._set(e,b);else{if(e.length)throw"can.Map: Object does not exist";this.__convert&&(b=this.__convert(f,b)),this.__set(f,b,g)}},__set:function(b,c,d){if(c!==d){var e=this.__get().hasOwnProperty(b)?"set":"add";this.___set(b,h.helpers.canMakeObserve(c)?h.helpers.hookupBubble(c,b,this):c),"add"==e&&a.batch.trigger(this,"__keys",undefined),this._triggerChange(b,e,c,d),d&&h.helpers.unhookup([d],this)}},___set:function(b,c){this[b]&&this[b].isComputed&&a.isFunction(this.constructor.prototype[b])&&this[b](c),this._data[b]=c,a.isFunction(this.constructor.prototype[b])||(this[b]=c)},bind:function(b){var c=this._computedBindings&&this._computedBindings[b];if(c)if(c.count)c.count++;else{c.count=1;var d=this;c.handler=function(c,e,f){a.batch.trigger(d,{type:b,batchNum:c.batchNum},[e,f])},this[b].bind("change",c.handler)}return a.bindAndSetup.apply(this,arguments)},unbind:function(b){var c=this._computedBindings&&this._computedBindings[b];return c&&(1==c.count?(c.count=0,this[b].unbind("change",c.handler),delete c.handler):c.count++),a.unbindAndTeardown.apply(this,arguments)},serialize:function(){return a.Map.helpers.serialize(this,"serialize",{})},_attrs:function(b,c){if(b===undefined)return h.helpers.serialize(this,"attr",{});b=a.simpleExtend({},b);var d,e,f=this;a.batch.start(),this.each(function(d,g){if("_cid"!==g){if(e=b[g],e===undefined)return c&&f.removeAttr(g),void 0;f.__convert&&(e=f.__convert(g,e)),e instanceof a.Map?f.__set(g,e,d):h.helpers.canMakeObserve(d)&&h.helpers.canMakeObserve(e)&&d.attr?d.attr(e,c):d!=e&&f.__set(g,e,d),delete b[g]}});for(var d in b)"_cid"!==d&&(e=b[d],this._set(d,e,!0));return a.batch.stop(),this},compute:function(b){return a.isFunction(this.constructor.prototype[b])?a.compute(this[b],this):a.compute(this,b)}});return h.prototype.on=h.prototype.bind,h.prototype.off=h.prototype.unbind,h}(__m2,__m13,__m9,__m14),__m15=function(a,b){var c=[].splice,d=function(){var a={0:"a",length:1};return c.call(a,0,1),!a[0]}(),e=b({Map:b},{setup:function(b,c){if(this.length=0,a.cid(this,".map"),this._init=1,b=b||[],a.isDeferred(b))this.replace(b);else{var d=b.length&&a.Map.helpers.addToMap(b,this);this.push.apply(this,a.makeArray(b||[]))}d&&d(),this.bind("change",a.proxy(this._changes,this)),a.simpleExtend(this,c),delete this._init},_triggerChange:function(c,d,e,f){b.prototype._triggerChange.apply(this,arguments),~c.indexOf(".")||("add"===d?(a.batch.trigger(this,d,[e,+c]),a.batch.trigger(this,"length",[this.length])):"remove"===d?(a.batch.trigger(this,d,[f,+c]),a.batch.trigger(this,"length",[this.length])):a.batch.trigger(this,d,[e,+c]))},__get:function(a){return a?this[a]:this},___set:function(a,b){this[a]=b,+a>=this.length&&(this.length=+a+1)},_each:function(a){for(var b=this.__get(),c=0;c0&&(this._triggerChange(""+e,"remove",undefined,j),b.helpers.unhookup(j,this)),h.length>2&&this._triggerChange(""+e,"add",h.slice(2),j),a.batch.stop(),j},_attrs:function(c,d){return c===undefined?b.helpers.serialize(this,"attr",[]):(c=a.makeArray(c),a.batch.start(),this._updateAttrs(c,d),a.batch.stop(),void 0)},_updateAttrs:function(a,c){for(var d=Math.min(a.length,this.length),e=0;d>e;e++){var f=this[e],g=a[e];b.helpers.canMakeObserve(f)&&b.helpers.canMakeObserve(g)?f.attr(g,c):f!=g&&this._set(e,g)}a.length>this.length?this.push.apply(this,a.slice(this.length)):a.lengthj;j++)a=f[j],h[a.obj._cid+"|"+a.attr]?h[a.obj._cid+"|"+a.attr].matched=i:(h[a.obj._cid+"|"+a.attr]={matched:i,observe:a},a.obj.bind(a.attr,k));for(var m in h){var a=h[m];a.matched!==i&&(a.observe.obj.unbind(a.observe.attr,k),delete h[m])}return g};return j.value=l(),j.isListening=!a.isEmptyObject(h),j};a.compute=function(b,c,g){if(b&&b.isComputed)return b;var h,i,j,k,l={bound:!1,hasDependencies:!1},m=d,n=d,o=function(){return j},p=function(a){j=a},q=!0,r=a.makeArray(arguments),s=function(b,c){j=b,a.batch.trigger(i,"change",[b,c])};if(i=function(b){if(arguments.length){var d=j,e=p.call(c,b,d);return i.hasDependencies?o.call(c):(j=e===undefined?o.call(c):e,d!==j&&a.batch.trigger(i,"change",[j,d]),j)}return a.__reading&&q&&(a.__reading(i,"change"),!l.bound&&a.compute.temporarilyBind(i)),l.bound?j:o.call(c)},"function"==typeof b)p=b,o=b,q=g===!1?!1:!0,i.hasDependencies=!1,m=function(a){h=f(b,c||this,a,l),i.hasDependencies=h.isListening,j=h.value},n=function(){h&&h.teardown()};else if(c)if("string"==typeof c){var t=c,u=b instanceof a.Map;u&&(i.hasDependencies=!0),o=function(){return u?b.attr(t):b[t]},p=function(a){u?b.attr(t,a):b[t]=a};var v;m=function(c){v=function(){c(o(),j)},a.bind.call(b,g||t,v),j=e(o).value},n=function(){a.unbind.call(b,g||t,v)}}else if("function"==typeof c)j=b,p=c,c=g,k="setter";else{j=b;var w=c;o=w.get||o,p=w.set||p,m=w.on||m,n=w.off||n}else j=b;return a.cid(i,"compute"),a.simpleExtend(i,{isComputed:!0,_bindsetup:function(){l.bound=!0;var b=a.__reading;delete a.__reading,m.call(this,s),a.__reading=b},_bindteardown:function(){n.call(this,s),l.bound=!1},bind:a.bindAndSetup,unbind:a.unbindAndTeardown,clone:function(b){return b&&("setter"==k?r[2]=b:r[1]=b),a.compute.apply(a,r)}})};var g,h=function(){for(var a=0,b=g.length;b>a;a++)g[a].unbind("change",d);g=null};return a.compute.temporarilyBind=function(a){a.bind("change",d),g||(g=[],setTimeout(h,10)),g.push(a)},a.compute.binder=f,a.compute.truthy=function(b){return a.compute(function(){var a=b();return"function"==typeof a&&(a=a()),!!a})},a.compute}(__m2,__m13,__m14),__m11=function(a){return a.Observe=a.Map,a.Observe.startBatch=a.batch.start,a.Observe.stopBatch=a.batch.stop,a.Observe.triggerBatch=a.batch.trigger,a}(__m2,__m12,__m15,__m16),__m19=function(a){var b=a.isFunction,c=a.makeArray,d=1,e=a.view=a.template=function(c,d,f,g){b(f)&&(g=f,f=undefined);var h=function(a){return e.frag(a)},i=b(g)?function(a){g(h(a))}:null,j=b(c)?c(d,f,i):e.render(c,d,f,i),k=a.Deferred();return b(j)?j:a.isDeferred(j)?(j.then(function(a,b){k.resolve.call(k,h(a),b)},function(){k.fail.apply(k,arguments)}),k):h(j)};a.extend(e,{frag:function(a,b){return e.hookup(e.fragment(a),b)},fragment:function(b){var c=a.buildFragment(b,document.body);return c.childNodes.length||c.appendChild(document.createTextNode("")),c},toId:function(b){return a.map(b.toString().split(/\/|\./g),function(a){return a?a:void 0}).join("_")},hookup:function(b,c){var d,f,g=[];return a.each(b.childNodes?a.makeArray(b.childNodes):b,function(b){1===b.nodeType&&(g.push(b),g.push.apply(g,a.makeArray(b.getElementsByTagName("*"))))}),a.each(g,function(a){a.getAttribute&&(d=a.getAttribute("data-view-id"))&&(f=e.hookups[d])&&(f(a,c,d),delete e.hookups[d],a.removeAttribute("data-view-id"))}),b},hookups:{},hook:function(a){return e.hookups[++d]=a," data-view-id='"+d+"'"},cached:{},cachedRenderers:{},cache:!0,register:function(a){this.types["."+a.suffix]=a},types:{},ext:".ejs",registerScript:function(){},preload:function(){},render:function(d,f,j,k){b(j)&&(k=j,j=undefined);var l=h(f);if(l.length){var m=new a.Deferred,n=a.extend({},f);return l.push(g(d,!0)),a.when.apply(a,l).then(function(b){var d,e=c(arguments),g=e.pop();if(a.isDeferred(f))n=i(b);else for(var h in f)a.isDeferred(f[h])&&(n[h]=i(e.shift()));d=g(n,j),m.resolve(d,n),k&&k(d,n)},function(){m.reject.apply(m,arguments)}),m}if(a.__reading){var o=a.__reading;a.__reading=null}var p,q=b(k),m=g(d,q);if(a.Map&&a.__reading&&(a.__reading=o),q)p=m,m.then(function(a){k(f?a(f,j):a)});else{if("resolved"===m.state()&&m.__view_id){var r=e.cachedRenderers[m.__view_id];return f?r(f,j):r}m.then(function(a){p=f?a(f,j):a})}return p},registerView:function(b,c,d,f){var g=(d||e.types[e.ext]).renderer(b,c);return f=f||new a.Deferred,e.cache&&(e.cached[b]=f,f.__view_id=b,e.cachedRenderers[b]=g),f.resolve(g)}});var f=function(a,b){if(!a.length)throw"can.view: No template or empty template:"+b},g=function(b,c){var d,g,h,i="string"==typeof b?b:b.url,j=b.engine||i.match(/\.[\w\d]+$/);if(i.match(/^#/)&&(i=i.substr(1)),(g=document.getElementById(i))&&(j="."+g.type.match(/\/(x\-)?(.+)/)[2]),j||e.cached[i]||(i+=j=e.ext),a.isArray(j)&&(j=j[0]),h=e.toId(i),i.match(/^\/\//)){var k=i.substr(2);i=window.steal?steal.config().root.mapJoin(""+steal.id(k)):k}if(d=e.types[j],e.cached[h])return e.cached[h];if(g)return e.registerView(h,g.innerHTML,d);var l=new a.Deferred;return a.ajax({async:c,url:i,dataType:"text",error:function(a){f("",i),l.reject(a)},success:function(a){f(a,i),e.registerView(h,a,d,l)}}),l},h=function(b){var c=[];if(a.isDeferred(b))return[b];for(var d in b)a.isDeferred(b[d])&&c.push(b[d]);return c},i=function(b){return a.isArray(b)&&"success"===b[1]?b[0]:b};return window.steal&&steal.type("view js",function(a,b){var c=e.types["."+a.type],d=e.toId(a.id);a.text="steal('"+(c.plugin||"can/view/"+a.type)+"',function(can){return can.view.preload('"+d+"',"+a.text+");\n})",b()}),a.extend(e,{register:function(a){this.types["."+a.suffix]=a,window.steal&&steal.type(a.suffix+" view js",function(a,b){var c=e.types["."+a.type],d=e.toId(a.id+"");a.text=c.script(d,a.text),b()}),e[a.suffix]=function(b,c){if(!c){var d=function(){return e.frag(d.render.apply(this,arguments))};return d.render=function(){var c=a.renderer(null,b);return c.apply(c,arguments)},d}return e.preload(b,a.renderer(b,c))}},registerScript:function(a,b,c){return"can.view.preload('"+b+"',"+e.types["."+a].script(b,c)+");"},preload:function(b,c){function d(){return e.frag(c.apply(this,arguments))}var f=e.cached[b]=(new a.Deferred).resolve(function(a,b){return c.call(a,a,b)});return d.render=c,f.__view_id=b,e.cachedRenderers[b]=c,d}}),a}(__m2),__m18=function(a){var b=function(b){return b instanceof a.Map||b&&b.__get},c=/(\\)?\./g,d=/\\\./g,e=function(a){var b=[],e=0;return a.replace(c,function(c,f,g){f||(b.push(a.slice(e,g).replace(d,".")),e=g+c.length)}),b.push(a.slice(e).replace(d,".")),b},f=a.Construct.extend({read:function(c,d,e){e=e||{};for(var f,g,h,i=c,j=0,k=d.length;k>j;j++)if(g=i,g&&g.isComputed&&(e.foundObservable&&e.foundObservable(g,j),g=g()),b(g)?(!h&&e.foundObservable&&e.foundObservable(g,j),h=1,i="function"==typeof g[d[j]]&&g.constructor.prototype[d[j]]===g[d[j]]?e.returnObserveMethods?i[d[j]]:g[d[j]].apply(g,e.args||[]):i.attr(d[j])):i=g[d[j]],i&&i.isComputed&&!e.isArgument&&k-1>j&&(!h&&e.foundObservable&&e.foundObservable(g,j+1),i=i()),f=typeof i,jo&&(g=j,n=k,o=c,i=m,h=a.__clearReading&&a.__clearReading())}},c));if(p.value!==undefined)return{scope:m,rootObserve:j,value:p.value,reads:k}}a.__clearReading&&a.__clearReading(),m=m._parent}return g?(a.__setReading&&a.__setReading(h),{scope:i,rootObserve:g,reads:n,value:undefined}):{names:l,value:undefined}}});return a.view.Scope=f,f}(__m2,__m9,__m12,__m15,__m19,__m16),__m21=function(){var a={tagToContentPropMap:{option:"textContent"in document.createElement("option")?"textContent":"innerText",textarea:"value"},attrMap:{"class":"className",value:"value",innerText:"innerText",textContent:"textContent",checked:!0,disabled:!0,readonly:!0,required:!0,src:function(a,b){null==b||""==b?a.removeAttribute("src"):a.setAttribute("src",b)}},attrReg:/([^\s]+)[\s]*=[\s]*/,defaultValue:["input","textarea"],tagMap:{"":"span",table:"tbody",tr:"td",ol:"li",ul:"li",tbody:"tr",thead:"tr",tfoot:"tr",select:"option",optgroup:"option"},reverseTagMap:{tr:"tbody",option:"select",td:"tr",th:"tr",li:"ul"},getParentNode:function(a,b){return b&&11===a.parentNode.nodeType?b:a.parentNode},setAttr:function(b,c,d){var e=b.nodeName.toString().toLowerCase(),f=a.attrMap[c];"function"==typeof f?f(b,d):f===!0?b[c]=!0:f?(b[f]=d,"value"===f&&can.inArray(e,a.defaultValue)>=0&&(b.defaultValue=d)):b.setAttribute(c,d)},getAttr:function(b,c){return(a.attrMap[c]&&b[a.attrMap[c]]?b[a.attrMap[c]]:b.getAttribute(c))||""},removeAttr:function(b,c){var d=a.attrMap[c];"function"==typeof prop&&prop(b,undefined),d===!0?b[c]=!1:"string"==typeof d?b[d]="":b.removeAttribute(c)},contentText:function(a){return"string"==typeof a?a:a||0===a?""+a:""},after:function(a,b){var c=a[a.length-1];c.nextSibling?can.insertBefore(c.parentNode,b,c.nextSibling):can.appendChild(c.parentNode,b)},replace:function(b,c){a.after(b,c),can.remove(can.$(b))}};return function(){var b=document.createElement("div");b.setAttribute("style","width: 5px"),b.setAttribute("style","width: 10px"),a.attrMap.style=function(a,b){a.style.cssText=b||""}}(),a}(),__m20=function(can,elements){var newLine=/(\r|\n)+/g,clean=function(a){return a.split("\\").join("\\\\").split("\n").join("\\n").split('"').join('\\"').split(" ").join("\\t")},getTag=function(a,b,c){if(a)return a;for(;c":">",'"':'"',"'":"'"},this.tokenComplex=[],this.tokenMap={};for(var b,c=0;b=this.tokens[c];c++)b[2]?(this.tokenReg.push(b[2]),this.tokenComplex.push({abbr:b[1],re:new RegExp(b[2]),rescan:b[3]})):(this.tokenReg.push(b[1]),this.tokenSimple[b[1]]=b[0]),this.tokenMap[b[0]]=b[1];this.tokenReg=new RegExp("("+this.tokenReg.slice(0).concat(["<",">",'"',"'"]).join("|")+")","g")},Scanner.attributes={},Scanner.regExpAttributes={},Scanner.attribute=function(a,b){"string"==typeof a?Scanner.attributes[a]=b:Scanner.regExpAttributes[a]={match:a,callback:b}},Scanner.hookupAttributes=function(a,b){can.each(a&&a.attrs||[],function(c){a.attr=c,Scanner.attributes[c]?Scanner.attributes[c](a,b):can.each(Scanner.regExpAttributes,function(d){d.match.test(c)&&d.callback(a,b)})})},Scanner.tag=function(a,b){window.html5&&(html5.elements+=" "+a,html5.shivDocument()),Scanner.tags[a.toLowerCase()]=b},Scanner.tags={},Scanner.hookupTag=function(a){var b=can.view.getHooks();return can.view.hook(function(c){can.each(b,function(a){a(c)});var d=a.tagName,e=a.options.read("helpers._tags."+d,{isArgument:!0,proxyMethods:!1}).value,f=e||Scanner.tags[d],g=a.scope,h=f?f(c,a):g;if(h&&a.subtemplate){g!==h&&(g=g.add(h));var i=can.view.frag(a.subtemplate(g,a.options));can.appendChild(c,i)}can.view.Scanner.hookupAttributes(a,c)})},Scanner.prototype={helpers:[],scan:function(a,b){var c=[],d=0,e=this.tokenSimple,f=this.tokenComplex;a=a.replace(newLine,"\n"),this.transform&&(a=this.transform(a)),a.replace(this.tokenReg,function(b,g){var h=arguments[arguments.length-2];if(h>d&&c.push(a.substring(d,h)),e[b])c.push(b);else for(var i,j=0;i=f[j];j++)if(i.re.test(b)){c.push(i.abbr),i.rescan&&c.push(i.rescan(g));break}d=h+g.length}),d":htmlTag=0;var x="/"==k.substr(k.length-1)||"--"==k.substr(k.length-2),y="";if(q.attributeHookups.length&&(y="attrs: ['"+q.attributeHookups.join("','")+"'], ",q.attributeHookups=[]),r===top(q.tagHookups))x&&(k=k.substr(0,k.length-1)),l.push(put_cmd,'"',clean(k),'"',",can.view.Scanner.hookupTag({tagName:'"+r+"',"+y+"scope: "+(this.text.scope||"this")+this.text.options),x?(l.push("}));"),k="/>",q.tagHookups.pop()):"<"===c[v]&&c[v+1]==="/"+r?(l.push("}));"),k=i,q.tagHookups.pop()):(l.push(",subtemplate: function("+this.text.argNames+"){\n"+startTxt+(this.text.start||"")),k="");else if(p||!t&&elements.tagToContentPropMap[s[s.length-1]]||y){var z=",can.view.pending({"+y+"scope: "+(this.text.scope||"this")+this.text.options+'}),"';x?m(k.substr(0,k.length-1),z+'/>"'):m(k,z+'>"'),k="",p=0}else k+=i;(x||t)&&(s.pop(),r=s[s.length-1],t=!1),q.attributeHookups=[];break;case"'":case'"':if(htmlTag)if(quote&"e===i){quote=null;var A=getAttrName();if(Scanner.attributes[A]?q.attributeHookups.push(A):can.each(Scanner.regExpAttributes,function(a){a.match.test(A)&&q.attributeHookups.push(A)}),u){k+=i,m(k),l.push(finishTxt,"}));\n"),k="",u=!1;break}}else if(null===quote&&(quote=i,beforeQuote=g,j=getAttrName(),"img"==r&&"src"==j||"style"===j)){m(k.replace(attrReg,"")),k="",u=!0,l.push(insert_cmd,"can.view.txt(2,'"+getTag(r,c,v)+"',"+status()+",this,function(){",startTxt),m(j+"="+i);break}default:if("<"===g){r="!--"===i.substr(0,3)?"!--":i.split(/\s/)[0];var B=!1;if(0===r.indexOf("/")){B=!0;var C=r.substr(1)}B?(top(s)===C&&(r=C,t=!0),top(q.tagHookups)==C&&(m(k.substr(0,k.length-1)),l.push(finishTxt+"}}) );"),k="><",q.tagHookups.pop())):(r.lastIndexOf("/")===r.length-1&&(r=r.substr(0,r.length-1)),"!--"!==r&&(Scanner.tags[r]||automaticCustomElementCharacters.test(r))&&("content"===r&&elements.tagMap[top(s)]&&(i=i.replace("content",elements.tagMap[top(s)])),q.tagHookups.push(r)),s.push(r))}k+=i}else switch(i){case w.right:case w.returnRight:switch(o){case w.left:h=bracketNum(k),1==h?(l.push(insert_cmd,"can.view.txt(0,'"+getTag(r,c,v)+"',"+status()+",this,function(){",startTxt,k),n.push({before:"",after:finishTxt+"}));\n"})):(d=n.length&&-1==h?n.pop():{after:";"},d.before&&l.push(d.before),l.push(k,";",d.after));break;case w.escapeLeft:case w.returnLeft:h=bracketNum(k),h&&n.push({before:finishTxt,after:"}));\n"});for(var D=o===w.escapeLeft?1:0,E={insert:insert_cmd,tagName:getTag(r,c,v),status:status(),specialAttribute:u},F=0;F[\s]*\w*/.source&&(D=0);break}}"object"==typeof k?k.raw&&l.push(k.raw):u?l.push(insert_cmd,k,");"):l.push(insert_cmd,"can.view.txt(\n"+D+",\n'"+r+"',\n"+status()+",\nthis,\nfunction(){ "+(this.text.escape||"")+"return ",k,h?startTxt:"}));\n"),rescan&&rescan.after&&rescan.after.length&&(m(rescan.after.length),rescan=null)}o=null,k="";break;case w.templateLeft:k+=w.left;break;default:k+=i}g=i}k.length&&m(k),l.push(";");var H=l.join(""),I={out:(this.text.outStart||"")+H+" "+finishTxt+(this.text.outEnd||"")};return myEval.call(I,"this.fn = (function("+this.text.argNames+"){"+I.out+"});\r\n//@ sourceURL="+b+".js"),I}},can.view.Scanner.tag("content",function(a,b){return b.scope}),Scanner}(__m19,__m21),__m24=function(a){var b=!0;try{document.createTextNode("")._=0}catch(c){b=!1}var d={},e={},f="ejs_"+Math.random(),g=0,h=function(a){if(b||3!==a.nodeType)return a[f]?a[f]:a[f]=(a.nodeName?"element_":"obj_")+ ++g;for(var c in e)if(e[c]===a)return c;return e["text_"+ ++g]=a,"text_"+g},i=[].splice,j={id:h,update:function(b,c){a.each(b.childNodeLists,function(a){j.unregister(a)}),b.childNodeLists=[],a.each(b,function(a){delete d[h(a)]});var c=a.makeArray(c);a.each(c,function(a){d[h(a)]=b});var e=b.length,f=b[0];i.apply(b,[0,e].concat(c));for(var g=b;g=g.parentNodeList;)i.apply(g,[a.inArray(f,g),e].concat(c))},register:function(a,b,c){if(a.unregistered=b,a.childNodeLists=[],!c){if(a.length>1)throw"does not work";var e=h(a[0]);c=d[e]}return a.parentNodeList=c,c&&c.childNodeLists.push(a),a},unregister:function(b){b.isUnregistered||(b.isUnregistered=!0,delete b.parentNodeList,a.each(b,function(a){var b=h(a);delete d[b]}),b.unregistered&&b.unregistered(),a.each(b.childNodeLists,function(a){j.unregister(a)}))},nodeMap:d};return j}(__m2,__m21),__m23=function(a,b,c,d){var e=function(b,c,d){var e=!1,f=function(){return e||(e=!0,d(g),a.unbind.call(b,"removed",f)),!0},g={teardownCheck:function(a){return a?!1:f()}};return a.bind.call(b,"removed",f),c(g),g},f=function(a,b,c){return e(a,function(){b.bind("change",c)},function(a){b.unbind("change",c),a.nodeList&&d.unregister(a.nodeList)})},g=function(a){return(a||"").replace(/['"]/g,"").split("=")},h=[].splice,i={list:function(c,f,g,j,k){var l,m=[c],n=[],o=[],p=function(c,e,f){var i=document.createDocumentFragment(),k=[],l=[];if(a.each(e,function(b,c){var e=a.compute(c+f),h=g.call(j,b,e),n=a.view.fragment(h);k.push(d.register(a.makeArray(n.childNodes),undefined,m)),i.appendChild(a.view.hookup(n)),l.push(e)}),n[f]){var p=n[f][0];a.insertBefore(p.parentNode,i,p)}else b.after(0==f?[r]:n[f-1],i);h.apply(n,[f,0].concat(k)),h.apply(o,[f,0].concat(l));for(var q=f+l.length,s=o.length;s>q;q++)o[q](q)},q=function(b,c,e,f){if(f||!u.teardownCheck(r.parentNode)){var g=n.splice(e,c.length),h=[];a.each(g,function(a){[].push.apply(h,a),d.update(a,[]),d.unregister(a)}),o.splice(e,c.length);for(var i=e,j=o.length;j>i;i++)o[i](i);a.remove(a.$(h))}},k=b.getParentNode(c,k),r=document.createTextNode(""),s=function(){l&&l.unbind&&l.unbind("add",p).unbind("remove",q),q({},{length:n.length},0,!0)},t=function(a,b){s(),l=b||[],l.bind&&l.bind("add",p).bind("remove",q),p({},l,0)},u=e(k,function(){a.isFunction(f)&&f.bind("change",t)},function(){a.isFunction(f)&&f.unbind("change",t),s()});i.replace(m,r,u.teardownCheck),t({},a.isFunction(f)?f():f)},html:function(c,e,g){var g=b.getParentNode(c,g),h=f(g,e,function(a,b){var c=i[0].parentNode;c&&j(b),h.teardownCheck(i[0].parentNode)}),i=[c],j=function(c){var e=a.view.fragment(""+c),f=a.makeArray(i);d.update(i,e.childNodes),e=a.view.hookup(e,g),b.replace(f,e)};h.nodeList=i,d.register(i,h.teardownCheck),j(e())},replace:function(c,e,f){var g,h=c.slice(0);return d.register(c,f),"string"==typeof e?g=a.view.fragment(e):11!==e.nodeType?(g=document.createDocumentFragment(),g.appendChild(e)):g=e,d.update(c,g.childNodes),"string"==typeof e&&(g=a.view.hookup(g,c[0].parentNode)),b.replace(h,g),c},text:function(a,c,d){var e=b.getParentNode(a,d),g=f(e,c,function(a,b){"unknown"!=typeof h.nodeValue&&(h.nodeValue=""+b),g.teardownCheck(h.parentNode)}),h=document.createTextNode(c());i.replace([a],h,g.teardownCheck)},attributes:function(a,c,d){var e=function(c){var d=g(c),e=d.shift();e!=h&&h&&b.removeAttr(a,h),e&&(b.setAttr(a,e,d.join("=")),h=e)};if(f(a,c,function(a,b){e(b)}),arguments.length>=3)var h=g(d)[0];else e(c())},attributePlaceholder:"__!!__",attributeReplace:/__!!__/g,attribute:function(c,d,e){f(c,e,function(){b.setAttr(c,d,j.render())});var g,h=a.$(c);g=a.data(h,"hooks"),g||a.data(h,"hooks",g={});var j,k=b.getAttr(c,d),l=k.split(i.attributePlaceholder),m=[];m.push(l.shift(),l.join(i.attributePlaceholder)),g[d]?g[d].computes.push(e):g[d]={render:function(){var a=0,c=k?k.replace(i.attributeReplace,function(){return b.contentText(j.computes[a++]())}):b.contentText(j.computes[a++]());return c},computes:[e],batchNum:undefined},j=g[d],m.splice(1,0,e()),b.setAttr(c,d,m.join(""))},specialAttribute:function(a,c,d){f(a,d,function(d,e){b.setAttr(a,c,k(e))}),b.setAttr(a,c,k(d()))}},j=/(\r|\n)+/g,k=function(a){return a=a.replace(b.attrReg,"").replace(j,""),/^["'].*["']$/.test(a)?a.substr(1,a.length-2):a};return a.view.live=i,a.view.nodeLists=d,a.view.elements=b,i}(__m2,__m21,__m19,__m24),__m22=function(a,b,c){var d,e=[],f=function(a){var c=b.tagMap[a]||"span";return"span"===c?"@@!!@@":"<"+c+">"+f(c)+""},g=function(b,c){if("string"==typeof b)return b;if(!b&&0!==b)return"";var d=b.hookup&&function(a,c){b.hookup.call(b,a,c)}||"function"==typeof b&&b;return d?c?"<"+c+" "+a.view.hook(d)+">":(e.push(d),""):""+b},h=function(b,c){return"string"==typeof b||"number"==typeof b?a.esc(b):g(b,c)},i=!1,j=function(){};return a.extend(a.view,{live:c,setupLists:function(){var b,c=a.view.lists;return a.view.lists=function(a,c){return b={list:a,renderer:c},Math.random()},function(){return a.view.lists=c,b}},pending:function(b){var c=a.view.getHooks();return a.view.hook(function(d){a.each(c,function(a){a(d)}),a.view.Scanner.hookupAttributes(b,d)})},getHooks:function(){var a=e.slice(0);return d=a,e=[],a},onlytxt:function(a,b){return h(b.call(a))},txt:function(k,l,m,n,o){var p,q=b.tagMap[l]||"span",r=!1;if(i)p=o.call(n);else{("string"==typeof m||1===m)&&(i=!0);var s=a.view.setupLists(),t=function(){u.unbind("change",j)},u=a.compute(o,n,!1);u.bind("change",j);var v=s();p=u(),i=!1,r=u.hasDependencies}if(v)return t&&t(),"<"+q+a.view.hook(function(a,b){c.list(a,v.list,v.renderer,n,b)})+">";if(!r||"function"==typeof p)return t&&t(),(!k&&"string"!=typeof m||2===k?g:h)(p,0===m&&q);var w=b.tagToContentPropMap[l];if(0!==m||w){if(1===m)return e.push(function(a){c.attributes(a,u,u()),t()}),u();if(2===k){var x=m;return e.push(function(a){c.specialAttribute(a,x,u),t()}),u()}var x=0===m?w:m;return(0===m?d:e).push(function(a){c.attribute(a,x,u),t()}),c.attributePlaceholder}return"<"+q+a.view.hook(k&&"object"!=typeof p?function(a,b){c.text(a,u,b),t()}:function(a,b){c.html(a,u,b),t()})+">"+f(q)+""}}),a}(__m19,__m21,__m23,__m10),__m17=function(a){a.view.ext=".mustache";var b="scope",c="___h4sh",d="{scope:"+b+",options:options}",e=b+",options",f=/((([^\s]+?=)?('.*?'|".*?"))|.*?)\s/g,g=/^(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false|null|undefined)|((.+?)=(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false)|(.+))))$/,h=function(a){return'{get:"'+a.replace(/"/g,'\\"')+'"}'},i=function(a){return a&&"string"==typeof a.get},j=function(b){return b instanceof a.Map||b&&!!b._get},k=function(a){return a&&a.splice&&"number"==typeof a.length},l=function(b,c,d){return function(e,f){return e===undefined||e instanceof a.view.Scope||(e=c.add(e)),f===undefined||f instanceof o||(f=d.add(f)),b(e,f||d)}};Mustache=function(b){if(this.constructor!=Mustache){var c=new Mustache(b);return function(a,b){return c.render(a,b)}}return"function"==typeof b?(this.template={fn:b},void 0):(a.extend(this,b),this.template=this.scanner.scan(this.text,this.name),void 0)},a.Mustache=window.Mustache=Mustache,Mustache.prototype.render=function(b,c){return b instanceof a.view.Scope||(b=new a.view.Scope(b||{})),c instanceof o||(c=new o(c||{})),c=c||{},this.template.fn.call(b,b,c)},a.extend(Mustache.prototype,{scanner:new a.view.Scanner({text:{start:"",scope:b,options:",options: options",argNames:e},tokens:[["returnLeft","{{{","{{[{&]"],["commentFull","{{!}}","^[\\s\\t]*{{!.+?}}\\n"],["commentLeft","{{!","(\\n[\\s\\t]*{{!|{{!)"],["escapeFull","{{}}","(^[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}$)",function(a){return{before:/^\n.+?\n$/.test(a)?"\n":"",content:a.match(/\{\{(.+?)\}\}/)[1]||""}}],["escapeLeft","{{"],["returnRight","}}}"],["right","}}"]],helpers:[{name:/^>[\s]*\w*/,fn:function(b){var c=a.trim(b.replace(/^>\s?/,"")).replace(/["|']/g,"");return"can.Mustache.renderPartial('"+c+"',"+e+")"}},{name:/^\s*data\s/,fn:function(a){var c=a.match(/["|'](.*)["|']/)[1];return"can.proxy(function(__){can.data(can.$(__),'"+c+"', this.attr('.')); }, "+b+")"}},{name:/\s*\(([\$\w]+)\)\s*->([^\n]*)/,fn:function(a){var c=/\s*\(([\$\w]+)\)\s*->([^\n]*)/,d=a.match(c);return"can.proxy(function(__){var "+d[1]+"=can.$(__);with("+b+".attr('.')){"+d[2]+"}}, this);"}},{name:/^.*$/,fn:function(b,i){var j=!1,k=[];if(b=a.trim(b),b.length&&(j=b.match(/^([#^/]|else$)/))){switch(j=j[0]){case"#":case"^":i.specialAttribute?k.push(i.insert+"can.view.onlytxt(this,function(){ return "):k.push(i.insert+"can.view.txt(0,'"+i.tagName+"',"+i.status+",this,function(){ return ");break;case"/":return{raw:'return ___v1ew.join("");}}])}));'}}b=b.substring(1)}if("else"!=j){var l,m=[],n=0;k.push("can.Mustache.txt(\n"+d+",\n"+(j?'"'+j+'"':"null")+",");var m=[],o=[];(a.trim(b)+" ").replace(f,function(a,b){n&&(l=b.match(g))?l[2]?m.push(l[0]):o.push(l[4]+":"+(l[6]?l[6]:h(l[5]))):m.push(h(b)),n++}),k.push(m.join(",")),o.length&&k.push(",{"+c+":{"+o.join(",")+"}}")}switch(j&&"else"!=j&&k.push(",[\n\n"),j){case"#":k.push("{fn:function("+e+"){var ___v1ew = [];");break;case"else":k.push('return ___v1ew.join("");}},\n{inverse:function('+e+"){\nvar ___v1ew = [];");break;case"^":k.push("{inverse:function("+e+"){\nvar ___v1ew = [];");break;default:k.push(")")}return k=k.join(""),j?{raw:k}:k}}]})});for(var m=a.view.Scanner.prototype.helpers,n=0;nk;k++)j[d[k]]||(j[d[k]]=b.test(d[k+1])||"[]"==d[k+1]?[]:{}),j=j[d[k]];h=d.pop(),"[]"==h?j.push(g):j[h]=g}})),i}}),a}(__m2,__m10),__m27=function(a){var b,c,d,e,f=/\:([\w\.]+)/g,g=/^(?:&[^=]+=[^&]*)+/,h=function(b){var c=[];return a.each(b,function(b,d){c.push(("className"===d?"class":d)+'="'+("href"===d?b:a.esc(b))+'"')}),c.join(" ")},i=function(a,b){var c=0,d=0,e={};for(var f in a.defaults)a.defaults[f]===b[f]&&(e[f]=1,c++);for(;dg&&(d=a,g=e),e>=j?!1:void 0}),a.route.routes[h]&&i(a.route.routes[h],b)===g&&(d=a.route.routes[h]),d){var k,n=m({},b),o=d.route.replace(f,function(a,c){return delete n[c],b[c]===d.defaults[c]?"":encodeURIComponent(b[c])}).replace("\\","");return l(d.defaults,function(a,b){n[b]===a&&delete n[b]}),k=a.param(n),c&&a.route.attr("route",d.route),o+(k?a.route._call("querySeparator")+k:"")}return a.isEmptyObject(b)?"":a.route._call("querySeparator")+a.param(b)},deparam:function(b){var c=a.route._call("root");c.lastIndexOf("/")==c.length-1&&0===b.indexOf("/")&&(b=b.substr(1));var d={length:-1},e=a.route._call("querySeparator"),f=a.route._call("paramsMatcher");if(l(a.route.routes,function(a){a.test.test(b)&&a.length>d.length&&(d=a)}),d.length>-1){var g=b.match(d.test),h=g.shift(),i=b.substr(h.length-(g[g.length-1]===e?1:0)),j=i&&f.test(i)?a.deparam(i.slice(1)):{};return j=m(!0,{},d.defaults,j),l(g,function(a,b){a&&a!==e&&(j[d.names[b]]=decodeURIComponent(a))}),j.route=d.route,j}return b.charAt(0)!==e&&(b=e+b),f.test(b)?a.deparam(b.slice(1)):{}},data:new a.Map({}),routes:{},ready:function(b){return b!==!0&&(a.route._setup(),a.route.setState()),a.route},url:function(b,c){return c&&(b=a.extend({},a.route.deparam(a.route._call("matchingPartOfURL")),b)),a.route._call("root")+a.route.param(b)},link:function(b,c,d,e){return""+b+"" +},current:function(b){return this._call("matchingPartOfURL")===a.route.param(b)},bindings:{hashchange:{paramsMatcher:g,querySeparator:"&",bind:function(){a.bind.call(window,"hashchange",q)},unbind:function(){a.unbind.call(window,"hashchange",q)},matchingPartOfURL:function(){return j.href.split(/#!?/)[1]||""},setURL:function(a){return j.hash="#!"+a,a},root:"#!"}},defaultBinding:"hashchange",currentBinding:null,_setup:function(){a.route.currentBinding||(a.route._call("bind"),a.route.bind("change",p),a.route.currentBinding=a.route.defaultBinding)},_teardown:function(){a.route.currentBinding&&(a.route._call("unbind"),a.route.unbind("change",p),a.route.currentBinding=null),clearTimeout(b),e=0},_call:function(){var b=a.makeArray(arguments),c=b.shift(),d=a.route.bindings[a.route.currentBinding||a.route.defaultBinding];return method=d[c],"function"==typeof method?method.apply(d,b):method}}),l(["bind","unbind","on","off","delegate","undelegate","removeAttr","compute","_get","__get"],function(b){a.route[b]=function(){return a.route.data[b]?a.route.data[b].apply(a.route.data,arguments):void 0}}),a.route.attr=function(b,c){var d,e=typeof b;return d=c===undefined?arguments:"string"!==e&&"number"!==e?[n(b),c]:[b,n(c)],a.route.data.attr.apply(a.route.data,d)};var q=a.route.setState=function(){var b=a.route._call("matchingPartOfURL");c=a.route.deparam(b),e&&b===d||a.route.attr(c,!0)};return a.route}(__m2,__m12,__m28),__m29=function(a){return a.Control.processors.route=function(b,c,d,e,f){d=d||"",a.route.routes[d]||a.route(d);var g,h=function(b){if(a.route.attr("route")===d&&(b.batchNum===undefined||b.batchNum!==g)){g=b.batchNum;var c=a.route.attr();delete c.route,a.isFunction(f[e])?f[e](c):f[f[e]](c)}};return a.route.bind("change",h),function(){a.route.unbind("change",h)}},a}(__m2,__m27,__m8);window.can=__m4}(); \ No newline at end of file